0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 08:21:52 +00:00
htmlpurifier/library/HTMLPurifier.php

28 lines
687 B
PHP
Raw Normal View History

<?php
require_once 'HTMLPurifier/Lexer.php';
require_once 'HTMLPurifier/Definition.php';
require_once 'HTMLPurifier/Generator.php';
class HTMLPurifier
{
var $lexer;
var $definition;
var $generator;
function HTMLPurifier() {
$this->lexer = new HTMLPurifier_Lexer();
$this->definition = new HTMLPurifier_Definition();
$this->generator = new HTMLPurifier_Generator();
}
function purify($html) {
$tokens = $this->lexer->tokenizeHTML($html);
$tokens = $this->definition->purifyTokens($tokens);
return $this->generator->generateFromTokens($tokens);
}
}
?>