generator = new HTMLPurifier_Generator();
$this->definition = HTMLPurifier_Definition::instance();
}
function execute($tokens, $config) {
$result = array();
foreach($tokens as $token) {
if (!empty( $token->is_tag )) {
// DEFINITION CALL
if (isset($this->definition->info[$token->name])) {
// leave untouched
} elseif (
isset($this->definition->info_tag_transform[$token->name])
) {
// there is a transformation for this tag
// DEFINITION CALL
$token = $this->
definition->
info_tag_transform[$token->name]->
transform($token);
} else {
// invalid tag, generate HTML and insert in
$token = new HTMLPurifier_Token_Text(
$this->generator->generateFromToken($token)
);
}
} elseif ($token->type == 'comment') {
// strip comments
continue;
} elseif ($token->type == 'text') {
} else {
continue;
}
$result[] = $token;
}
return $result;
}
}
?>