diff options
Diffstat (limited to 'inc/parserutils.php')
-rw-r--r-- | inc/parserutils.php | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/inc/parserutils.php b/inc/parserutils.php index 20f992ba2..1733fcf09 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -386,9 +386,18 @@ function p_set_metadata($id, $data, $render=false, $persistent=true){ if ($key == 'relation'){ foreach ($value as $subkey => $subvalue){ - $meta['current'][$key][$subkey] = !empty($meta['current'][$key][$subkey]) ? array_merge($meta['current'][$key][$subkey], $subvalue) : $subvalue; - if ($persistent) - $meta['persistent'][$key][$subkey] = !empty($meta['persistent'][$key][$subkey]) ? array_merge($meta['persistent'][$key][$subkey], $subvalue) : $subvalue; + if(isset($meta['current'][$key][$subkey]) && is_array($meta['current'][$key][$subkey])) { + $meta['current'][$key][$subkey] = array_merge($meta['current'][$key][$subkey], (array)$subvalue); + } else { + $meta['current'][$key][$subkey] = $subvalue; + } + if($persistent) { + if(isset($meta['persistent'][$key][$subkey]) && is_array($meta['persistent'][$key][$subkey])) { + $meta['persistent'][$key][$subkey] = array_merge($meta['persistent'][$key][$subkey], (array)$subvalue); + } else { + $meta['persistent'][$key][$subkey] = $subvalue; + } + } } // be careful with some senisitive arrays of $meta @@ -396,10 +405,10 @@ function p_set_metadata($id, $data, $render=false, $persistent=true){ // these keys, must have subkeys - a legitimate value must be an array if (is_array($value)) { - $meta['current'][$key] = !empty($meta['current'][$key]) ? array_merge($meta['current'][$key],$value) : $value; + $meta['current'][$key] = !empty($meta['current'][$key]) ? array_merge((array)$meta['current'][$key],$value) : $value; if ($persistent) { - $meta['persistent'][$key] = !empty($meta['persistent'][$key]) ? array_merge($meta['persistent'][$key],$value) : $value; + $meta['persistent'][$key] = !empty($meta['persistent'][$key]) ? array_merge((array)$meta['persistent'][$key],$value) : $value; } } @@ -570,7 +579,7 @@ function p_get_parsermodes(){ $obj = null; foreach($pluginlist as $p){ /** @var DokuWiki_Syntax_Plugin $obj */ - if(!$obj =& plugin_load('syntax',$p)) continue; //attempt to load plugin into $obj + if(!$obj = plugin_load('syntax',$p)) continue; //attempt to load plugin into $obj $PARSER_MODES[$obj->getType()][] = "plugin_$p"; //register mode type //add to modes $modes[] = array( @@ -668,7 +677,9 @@ function p_render($mode,$instructions,&$info){ // Loop through the instructions foreach ( $instructions as $instruction ) { // Execute the callback against the Renderer - call_user_func_array(array(&$Renderer, $instruction[0]), $instruction[1] ? $instruction[1] : array()); + if(method_exists($Renderer, $instruction[0])){ + call_user_func_array(array(&$Renderer, $instruction[0]), $instruction[1] ? $instruction[1] : array()); + } } //set info array |