2006-04-15 01:13:42 +00:00
|
|
|
<?php
|
|
|
|
|
2006-07-22 00:13:08 +00:00
|
|
|
require_once 'HTMLPurifier/Lexer.php';
|
|
|
|
require_once 'HTMLPurifier/Definition.php';
|
|
|
|
require_once 'HTMLPurifier/Generator.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
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|