128 'HTMLPurifier->addFilter() is deprecated, use configuration directives' .
129 ' in the Filter namespace or Filter.Custom',
132 $this->filters[] = $filter;
159 $context->register(
'Generator', $this->generator);
162 if (
$config->get(
'Core.CollectErrors')) {
166 $context->register(
'Locale', $language);
169 $context->register(
'ErrorCollector', $error_collector);
175 $context->register(
'IDAccumulator', $id_accumulator);
180 $filter_flags =
$config->getBatch(
'Filter');
181 $custom_filters = $filter_flags[
'Custom'];
182 unset($filter_flags[
'Custom']);
184 foreach ($filter_flags as $filter => $flag) {
188 if (strpos($filter,
'.') !==
false) {
191 $class =
"HTMLPurifier_Filter_$filter";
194 foreach ($custom_filters as $filter) {
201 for ($i = 0, $filter_size = count(
$filters); $i < $filter_size; $i++) {
207 $this->generator->generateFromTokens(
209 $this->strategy->execute(
211 $lexer->tokenizeHTML(
222 for ($i = $filter_size - 1; $i >= 0; $i--) {
242 $context_array =
array();
243 foreach ($array_of_html as $key =>
$html) {
247 $this->context = $context_array;
248 return $array_of_html;
263 if (!self::$instance || $prototype) {
265 self::$instance = $prototype;
266 } elseif ($prototype) {
272 return self::$instance;
$context
Resultant context of last run purification.
purifyArray($array_of_html, $config=null)
Filters an array of HTML snippets.
Generates HTML from tokens.
$generator
HTMLPurifier_Generator
Facade that coordinates HTML Purifier's subsystems in order to purify HTML.
static create($config)
Retrieves or sets the default Lexer as a Prototype Factory.
static convertFromUTF8($str, $config, $context)
Converts a string from UTF-8 based on configuration.
static build($config, $context)
Builds an IDAccumulator, also initializing the default blacklist.
static instance($prototype=null)
Singleton for enforcing just one HTML Purifier in your system.
static getInstance($prototype=null)
Singleton for enforcing just one HTML Purifier in your system.
static create($config, $schema=null)
Convenience constructor that creates a config object based on a mixed var.
static convertToUTF8($str, $config, $context)
Convert a string to UTF-8 based on configuration.
__construct($config=null)
Initializes the purifier.
static instance($prototype=null)
Retrieve sole instance of the factory.
Create styles array
The data for the language used.
Error collection class that enables HTML Purifier to report HTML problems back to the user...
$version
Version of HTML Purifier.
purify($html, $config=null)
Filters an HTML snippet/document to be XSS-free and standards-compliant.
$config
Global configuration object.
static $instance
Single instance of HTML Purifier.
Registry object that contains information about the current context.
HTMLPurifier($html, $config=null)
Purify HTML.
$strategy
HTMLPurifier_Strategy_Core
Core strategy composed of the big four strategies.
$filters
Array of extra filter objects to run on HTML, for backwards compatibility.
const VERSION
Constant with version of HTML Purifier.
addFilter($filter)
Adds a filter to process the output.