From c993f2a5d1a298ca1b29f69c5bde78f9f7ebcf96 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 19 Mar 2005 05:18:56 +0000 Subject: [PATCH] Removed debugging code and old code. --- template.php | 83 ++-------------------------------------------------- 1 file changed, 3 insertions(+), 80 deletions(-) diff --git a/template.php b/template.php index 9ca8dbf..71c4f8c 100644 --- a/template.php +++ b/template.php @@ -392,12 +392,13 @@ class DB_Template { global $_isso; - // Tag data + // tag data $tag_start = '>>>>> " . $end . " >>>>>> "; // extract the condition $condition = substr($template, $i, $end - $i); - //echo "||||||" . $_isso->sanitize($condition) . "||||||"; - // complete the open array_push($stack, $i); @@ -432,8 +428,6 @@ class DB_Template // calculate the end of the tag $end = $i + strlen($tag_end); - //echo ">>>>> $end <<<<<<"; - // find the most recently opened condition $last = array_pop($stack); $depth = count($stack); @@ -458,97 +452,26 @@ class DB_Template // remove the tailing end tag $conditional = substr($conditional, 0, strlen($conditional) - strlen($tag_end)); - //echo ">>>>>>> " . $_isso->sanitize($conditional) . " >>>>>>>"; - // save all the data for later so we can do a quick replacement $parsed["$depth"]["$last"] = array( 'raw' => $fullspread, 'parsed' => '" . iff(' . stripslashes($expression) . ',"' . $conditional . '") . "', - /*'start' => $last, - 'end' => $end, - 'length' => array( - 'raw' => $end - $last, //strlen($fullspread), - 'new' => 0 - )*/ ); - //$parsed["$depth"]["$last"]['length']['new'] = strlen($parsed["$depth"]["$last"]['parsed']); - - //$temp =& $parsed["$depth"]["$last"]; - - //$template = substr_replace($template, $temp['unique'], $temp['start'], $temp['end']); - - // replace the new unique tag into the mix - - //echo "<<<< " . $_isso->sanitize($parsed) . " >>>> "; - - // replace it back into the template - //$template = substr_replace($template, $parsed, $last, $last - $end + strlen($tag_end)); - - //echo ">>>>>>>>>>> $template <<<<<<<<<<"; - //exit; - //echo "<<<<<<<<<<<<<<<<< $conditional >>>>>>>>>>>"; } } - //print_r($parsed); - $offset = 0; ksort($parsed); foreach ($parsed AS $depth => $conditionals) { ksort($conditionals); - //print_r($conditionals); foreach ($conditionals AS $parsed) { $template = str_replace($parsed['raw'], $parsed['parsed'], $template); - //print_r($parsed); - //$template = substr_replace($template, $parsed['parsed'], $parsed['start'] - $offset, strlen($parsed['parsed']) + $offset); - //$offset += 2 * ($parsed['length']['raw'] - $parsed['length']['new']); - //$template = str_replace($conditional['unique'], $conditional['parsed'], $template); } } $template = str_replace('', '","', $template); return $template; - - return ''; - //return $template; - // ------------------------------ - // ------ END - //exit; - - while (1) - { - // Do we have an $tag_else - $location_else = strpos($parsed, $tag_else); - if ($location_else !== false) - { - $data = explode($tag_else, $parsed); - - // um... wtf? - if (count($data) > 2) - { - trigger_error('Multiple else statements encountered while parsing conditionals in template', ERR_ALERT); - } - - // Set the data - $iftrue = $data[0]; - $iffalse = $data[1]; - } - // Nope, reassign variables - else - { - $iftrue = $parsed; - $iffalse = null; - } - - // Parse the iff()'d expression back into the template data - $template = substr_replace($template, $parsed_expression, $location_start, $location_end + strlen($tag_end) - $location_start); - } - - // Repeat this process until it can't find any more - // expressions, then send back the parsed template data - // for final output - return $template; } } -- 2.43.5