my HTML parser class uses this class to check the validity of nested tags. Parser.php needs this class to work.
Download
View Source (print view)
Rating : 4.7
Views : 450
<?
$tag_stack = array();
class TagTrack
{
var $label;
var $top_level;
var $follower;
function TagTrack ($label, $top_level = 1, $followers = 0)
{
$this->label = $label;
$this->top_level = $top_level;
$this->followers = $followers;
}
function VerifyTag ($closing)
{
global $tag_stack;
$prev=end($tag_stack);
if ($closing)
{
if ($this->label = $prev->label)
{
array_pop ($tag_stack);
return ($this->label);
}
else return (0);
}
if ($prev && $pf = $prev->followers)
{
if (is_array ($pf) && !in_array ($this->label, $pf))
return (0);
elseif ($pf == "*" && !$this->top_level)
return (0);
}
if ($this->followers)
array_push ($tag_stack, $this);
return ($this->label);
}
}
?>
guest, enfactuation, rent a car, download, regirstration form, php_snips, fedex, call php', userstatusinonline, php_script"_class="neww"_target="_blank"_title="im_neuen, best ide, php script" class="neww" target="_b..., forum, p t test paired, php_tools, href php function, utfraw, php jobs, php script and char(124) (select cast(count(1) as varchar(8000)) char(124) from [sysobjects] where 1=1)>0 and =, commit