2006-07-23 00:11:03 +00:00
|
|
|
<?php
|
|
|
|
|
2006-07-23 03:43:53 +00:00
|
|
|
/*!
|
|
|
|
* @mainpage
|
|
|
|
*
|
|
|
|
* HTMLPurifier is a purification class that will take an arbitrary snippet of
|
|
|
|
* HTML and rigorously test, validate and filter it into a version that
|
|
|
|
* is safe for output onto webpages. It achieves this by:
|
|
|
|
*
|
|
|
|
* -# Lexing (parsing into tokens) the document,
|
2006-07-24 02:49:37 +00:00
|
|
|
* -# Executing various strategies on the tokens:
|
|
|
|
* -# Removing all elements not in the whitelist,
|
|
|
|
* -# Making the tokens well-formed,
|
|
|
|
* -# Fixing the nesting of the nodes, and
|
|
|
|
* -# Validating attributes of the nodes; and
|
2006-07-23 03:43:53 +00:00
|
|
|
* -# Generating HTML from the purified tokens.
|
|
|
|
*
|
|
|
|
* See /docs/spec.txt for more details.
|
|
|
|
*/
|
|
|
|
|
2006-07-23 00:11:03 +00:00
|
|
|
require_once 'HTMLPurifier/Lexer.php';
|
|
|
|
require_once 'HTMLPurifier/Definition.php';
|
|
|
|
require_once 'HTMLPurifier/Generator.php';
|
|
|
|
|
2006-07-23 03:43:53 +00:00
|
|
|
/**
|
|
|
|
* Main library execution class.
|
|
|
|
*
|
|
|
|
* Facade that performs calls to the HTMLPurifier_Lexer,
|
|
|
|
* HTMLPurifier_Definition and HTMLPurifier_Generator subsystems in order to
|
|
|
|
* purify HTML.
|
|
|
|
*/
|
2006-07-23 00:11:03 +00:00
|
|
|
class HTMLPurifier
|
|
|
|
{
|
|
|
|
|
2006-07-23 03:43:53 +00:00
|
|
|
/**
|
|
|
|
* Initializes the purifier.
|
|
|
|
*
|
|
|
|
* The constructor instantiates all necessary sub-objects to do the job,
|
|
|
|
* because creating some of them (esp. HTMLPurifier_Definition) can be
|
|
|
|
* expensive.
|
|
|
|
*/
|
2006-07-23 00:11:03 +00:00
|
|
|
function HTMLPurifier() {
|
2006-07-24 02:49:37 +00:00
|
|
|
// unimplemented
|
2006-07-23 00:11:03 +00:00
|
|
|
}
|
|
|
|
|
2006-07-23 03:43:53 +00:00
|
|
|
/**
|
|
|
|
* Purifies HTML.
|
|
|
|
*
|
|
|
|
* @param $html String of HTML to purify
|
|
|
|
* @return Purified HTML
|
|
|
|
*/
|
2006-07-23 00:11:03 +00:00
|
|
|
function purify($html) {
|
2006-07-24 02:49:37 +00:00
|
|
|
// unimplemented
|
2006-07-23 00:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-04-15 01:13:42 +00:00
|
|
|
?>
|