2006-04-15 01:13:42 +00:00
|
|
|
<?php
|
|
|
|
|
2006-07-21 23:13:22 +00:00
|
|
|
class HTMLPurifier
|
2006-04-15 01:13:42 +00:00
|
|
|
{
|
|
|
|
|
2006-04-16 03:39:39 +00:00
|
|
|
var $lexer;
|
|
|
|
var $definition;
|
|
|
|
var $generator;
|
2006-04-15 01:13:42 +00:00
|
|
|
|
2006-07-21 23:13:22 +00:00
|
|
|
function HTMLPurifier() {
|
|
|
|
$this->lexer = new HTMLPurifier_Lexer();
|
2006-07-21 23:38:44 +00:00
|
|
|
$this->definition = new HTMLPurifier_Definition();
|
2006-07-21 23:13:22 +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
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|