}
- function tidyTree($node) {
+ function tidyTree($node)
+ {
// print_r($node);
-
+ $onode = $node;
switch ($node->type) {
case TIDY_NODETYPE_TEXT:
if (strlen(trim($node->value))) {
case TIDY_NODETYPE_STARTEND:
case TIDY_NODETYPE_START:
if (!empty($this->filter)) {
+ $node = (object) (array) $node; // we can't work with the
+
$this->filter->apply($node);
}
break;
}
// include children...
- if(!$node->hasChildren()){
+ if(!$onode->hasChildren()){
return $begin . $end;
}
- foreach($node->child as $child){
+ foreach($onode->child as $child){
// echo "child of ". $node->name . ':' . $child->type . "\n";
$begin .= $this->tidyTree($child);
}