From 4892401568a6874c023b15f4392d087bebb2ad16 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 Feb 2008 22:27:33 +0100 Subject: make sure $ID is set correct when rendering metadata darcs-hash:20080208212733-7ad00-b111663f6397e220beac70b9f54bdffd0d8c2760.gz --- inc/parserutils.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'inc/parserutils.php') diff --git a/inc/parserutils.php b/inc/parserutils.php index d24417898..66d1ae13c 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -375,6 +375,11 @@ function p_read_metadata($id,$cache=false) { * @author Esther Brunner */ function p_render_metadata($id, $orig){ + // make sure the correct ID is in global ID + global $ID; + $keep = $ID; + $ID = $id; + // add an extra key for the event - to tell event handlers the page whose metadata this is $orig['page'] = $id; @@ -385,7 +390,10 @@ function p_render_metadata($id, $orig){ // get instructions $instructions = p_cached_instructions(wikiFN($id),false,$id); - if(is_null($instructions)) return null; // something went wrong with the instructions + if(is_null($instructions)){ + $ID = $keep; + return null; // something went wrong with the instructions + } // set up the renderer $renderer = & new Doku_Renderer_metadata(); @@ -402,6 +410,7 @@ function p_render_metadata($id, $orig){ } $evt->advise_after(); + $ID = $keep; return $evt->result; } @@ -515,7 +524,7 @@ function p_sort_modes($a, $b){ * @author Harry Fuecks * @author Andreas Gohr */ -function p_render($mode,$instructions,& $info){ +function p_render($mode,$instructions,&$info){ if(is_null($instructions)) return ''; // try default renderer first: -- cgit v1.2.3