cvs: pear /HTML_Template_Flexy/Flexy Token.php
| From: | Alan Knowles | Date: | Tue, 16 Nov 2004 08:51:39 +0000 |
| Subject: | cvs: pear /HTML_Template_Flexy/Flexy Token.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-26007@lists.php.net to get a copy of this message | ||
alan_k Tue Nov 16 03:51:39 2004 EDT
Modified files:
/pear/HTML_Template_Flexy/Flexy Token.php
Log:
simplified tree building process, more tolerant of missing closers now.
http://cvs.php.net/diff.php/pear/HTML_Template_Flexy/Flexy/Token.php?r1=1.42&r2=1.43&ty=u
Index: pear/HTML_Template_Flexy/Flexy/Token.php
diff -u pear/HTML_Template_Flexy/Flexy/Token.php:1.42 pear/HTML_Template_Flexy/Flexy/Token.php:1.43
--- pear/HTML_Template_Flexy/Flexy/Token.php:1.42 Mon Oct 25 21:43:19 2004
+++ pear/HTML_Template_Flexy/Flexy/Token.php Tue Nov 16 03:51:38 2004
@@ -16,7 +16,7 @@
// | Authors: Alan Knowles <alan@akbkhome> |
// +----------------------------------------------------------------------+
//
-// $Id: Token.php,v 1.42 2004/10/26 01:43:19 alan_k Exp $
+// $Id: Token.php,v 1.43 2004/11/16 08:51:38 alan_k Exp $
//
// This is the master Token file for The New Token driver Engine.
// All the Token output, and building routines are in here.
@@ -313,6 +313,51 @@
//
//
+
+
+
+ for($i=1;$i<$total;$i++) {
+ //echo "Checking TAG $i\n";
+ if (empty($res[$i]->tag)) {
+ continue;
+ }
+ if ($res[$i]->tag{0} == '/') { // it's a close tag..
+ //echo "GOT END TAG: {$res[$i]->tag}\n";
+ $tag = strtoupper(substr($res[$i]->tag,1));
+ if (!count($stack)) {
+ continue;
+ }
+ $ssc = count($stack) - 1;
+ for($s = $ssc; $s > -1; $s--) {
+ if (!isset($stack[$s])) {
+ echo "MISSED STACK?
$s<BR><PRE>";print_r($stack);exit;
+ }
+ if (!isset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$stack[$s]])) {
+ echo "STACKED BAD OFFSET :
{$stack[$s]}<BR><PRE>";print_r($stack);exit;
+ }
+ $tok = &$_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$stack[$s]];
+ if (strtoupper($tok->tag) == $tag) {
+ // got the matching closer..
+ //echo "MATCH: {$i}:{$tok->tag} to
{$stack[$s]}:$tag<BR>";
+ $tok->close = &$_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i];
+ $sc = count($stack);
+ for ($ss = $ssc;$ss!=$s;$ss--) {
+ array_pop($stack);
+
+ }
+
+ continue 2;
+ }
+ }
+ continue;
+ }
+ $stack[] = $i;
+ // tag with no closer (or unmatched in stack..)
+ }
+ //print_R($stack);
+ //exit;
+ /*
+
for($i=1;$i<$total;$i++) {
//echo "Checking TAG $i\n";
@@ -340,6 +385,7 @@
// too many closes - just ignore it..
$stack[$tag]['pos'] = 0;
}
+
continue;
}
// new entry on stack..
@@ -352,7 +398,10 @@
}
$stack[$tag][$npos] = $i;
+
+
}
+ */
// create a dummy close for the end
$i = $total;