2006-04-15 01:13:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTML_Purifier
|
|
|
|
{
|
|
|
|
|
2006-04-16 03:39:39 +00:00
|
|
|
var $lexer;
|
|
|
|
var $definition;
|
|
|
|
var $generator;
|
2006-04-15 01:13:42 +00:00
|
|
|
|
2006-04-16 03:39:39 +00:00
|
|
|
function HTML_Purifier() {
|
2006-07-21 23:07:47 +00:00
|
|
|
$this->lexer = new HTMLPurifier_Lexer();
|
2006-04-16 03:39:39 +00:00
|
|
|
$this->definition = new PureHTMLDefinition();
|
2006-07-21 23:10:30 +00:00
|
|
|
$this->generator = new HTMLPurifier_Generator();
|
2006-04-16 03:39:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function purify($html) {
|
|
|
|
|
|
|
|
$tokens = $this->lexer->tokenizeHTML($html);
|
|
|
|
$tokens = $this->definition->purifyTokens($tokens);
|
|
|
|
return $this->generator->generateFromTokens($tokens);
|
|
|
|
|
|
|
|
}
|
2006-04-15 01:13:42 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|