From 4b8edb9d27253137965d9c07ac1b0abe1af3bc31 Mon Sep 17 00:00:00 2001 From: chris <chris@teacherscpd.co.uk> Date: Tue, 2 Aug 2005 02:58:46 +0200 Subject: [PATCH] syntax plugin class prototypes : fixes to previous update darcs-hash:20050802005846-50fdc-9e5ec3b31966b308543d5a16da10c1af22489553.gz --- lib/plugins/syntax.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php index 59b02d7dc..25d0c6c17 100644 --- a/lib/plugins/syntax.php +++ b/lib/plugins/syntax.php @@ -73,7 +73,9 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { /** * Handler to prepare matched data for the rendering process - * This function is called statically - it may not reference any object properties + * + * This function can only pass data to render() via its return value - render() + * may be not be run during the object's current life. * * Usually you should only need the $match param. * @@ -89,7 +91,10 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { /** * Handles the actual output creation. - * This function is called statically - it may not reference any object properties + * + * The function must not assume any other of the classes methods have been run + * during the object's current life. The only reliable data it receives are its + * parameters. * * The function should always check for the given mode and return false * when a mode isn't supported. @@ -109,28 +114,28 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { */ function render($mode, &$renderer, $data) { trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING); + } /** * There should be no need to override this function */ function accepts($mode) { - - if (!$allowedModesSetup) { + + if (!$this->allowedModesSetup) { global $PARSER_MODES; $allowedModeTypes = $this->getAllowedTypes(); foreach($allowedModeTypes as $mt) { - array_merge($this->allowedModes, $PARSER_MODES[$mt]); + $this->allowedModes = array_merge($this->allowedModes, $PARSER_MODES[$mt]); } unset($this->allowedModes[array_search(substr(get_class($this), 7), $this->allowedModes)]); - $allowedModesSetup = true; + $this->allowedModesSetup = true; } return parent::accepts($mode); } } - -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 enc=utf-8 : \ No newline at end of file -- GitLab