mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-06 06:07:26 +02:00
[3.1.0] Deprecate addFilter; set up Filter namespace
- Added EXTERNAL dependency config-schema value - Fix safe bug in Printer_HTMLDefinition - Fixed broken smoketests git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1669 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -80,6 +80,11 @@ class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
|
||||
}
|
||||
$this->writeElement('default', $this->export($directive->default));
|
||||
$this->writeAttribute('xml:space', 'preserve');
|
||||
if ($directive->external) {
|
||||
$this->startElement('external');
|
||||
foreach ($directive->external as $project) $this->writeElement('project', $project);
|
||||
$this->endElement();
|
||||
}
|
||||
$this->endElement(); // constraints
|
||||
|
||||
if ($directive->deprecatedVersion) {
|
||||
|
@@ -67,5 +67,9 @@ class HTMLPurifier_ConfigSchema_Interchange_Directive
|
||||
*/
|
||||
public $deprecatedVersion;
|
||||
|
||||
/**
|
||||
* List of external projects this directive depends on, e.g. array('CSSTidy').
|
||||
*/
|
||||
public $external = array();
|
||||
|
||||
}
|
||||
|
@@ -120,6 +120,10 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
|
||||
$directive->deprecatedVersion = $hash->offsetGet('DEPRECATED-VERSION');
|
||||
}
|
||||
|
||||
if (isset($hash['EXTERNAL'])) {
|
||||
$directive->external = preg_split('/\s*,\s*/', trim($hash->offsetGet('EXTERNAL')));
|
||||
}
|
||||
|
||||
$interchange->addDirective($directive);
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
10
library/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt
Normal file
10
library/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Filter.Custom
|
||||
TYPE: list
|
||||
VERSION: 3.1.0
|
||||
DEFAULT: array()
|
||||
--DESCRIPTION--
|
||||
<p>
|
||||
This directive can be used to add custom filters; it is nearly the
|
||||
equivalent of the now deprecated <code>HTMLPurifier->addFilter()</code>
|
||||
method. Specify an array of concrete implementations.
|
||||
</p>
|
@@ -0,0 +1,23 @@
|
||||
Filter.ExtractStyleBlocks
|
||||
TYPE: bool
|
||||
VERSION: 3.1.0
|
||||
DEFAULT: false
|
||||
EXTERNAL: CSSTidy
|
||||
--DESCRIPTION--
|
||||
<p>
|
||||
This directive turns on the style block extraction filter, which removes
|
||||
<code>style</code> blocks from input HTML, cleans them up with CSSTidy,
|
||||
and places them in the <code>StyleBlocks</code> context variable, for further
|
||||
use by you, usually to be placed in an external stylesheet, or a
|
||||
<code>style</code> block in the <code>head</code> of your document.
|
||||
</p>
|
||||
<p>
|
||||
Sample usage:
|
||||
</p>
|
||||
<pre><![CDATA[$config = HTMLPurifier_Config::createDefault();
|
||||
$config->set('Filter', 'ExtractStyleBlocks', true);
|
||||
$purifier = new HTMLPurifier($config);
|
||||
$styles = $purifier->context->get('StyleBlocks');
|
||||
foreach ($styles as $style) {
|
||||
echo '<style type="text/css">' . $style . "</style>\n";
|
||||
}]]></pre>
|
10
library/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt
Normal file
10
library/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Filter.YouTube
|
||||
TYPE: bool
|
||||
VERSION: 3.1.0
|
||||
DEFAULT: false
|
||||
--DESCRIPTION--
|
||||
<p>
|
||||
This directive enables YouTube video embedding in HTML Purifier. Check
|
||||
<a href="http://htmlpurifier.org/docs/enduser-youtube.html">this document
|
||||
on embedding videos</a> for more information on what this filter does.
|
||||
</p>
|
@@ -1,2 +1,2 @@
|
||||
Filter
|
||||
DESCRIPTION: Configuration for filters
|
||||
DESCRIPTION: Directives for turning filters on and off, or specifying custom filters.
|
||||
|
@@ -1,7 +1,8 @@
|
||||
Filter.ExtractStyleBlocksEscaping
|
||||
FilterParam.ExtractStyleBlocksEscaping
|
||||
TYPE: bool
|
||||
VERSION: 3.0.0
|
||||
DEFAULT: true
|
||||
ALIASES: Filter.ExtractStyleBlocksEscaping
|
||||
--DESCRIPTION--
|
||||
|
||||
<p>
|
@@ -1,7 +1,8 @@
|
||||
Filter.ExtractStyleBlocksScope
|
||||
FilterParam.ExtractStyleBlocksScope
|
||||
TYPE: string/null
|
||||
VERSION: 3.0.0
|
||||
DEFAULT: NULL
|
||||
ALIASES: Filter.ExtractStyleBlocksScope
|
||||
--DESCRIPTION--
|
||||
|
||||
<p>
|
@@ -0,0 +1,14 @@
|
||||
FilterParam.ExtractStyleBlocksTidyImpl
|
||||
TYPE: mixed/null
|
||||
VERSION: 3.1.0
|
||||
DEFAULT: NULL
|
||||
--DESCRIPTION--
|
||||
<p>
|
||||
If left NULL, HTML Purifier will attempt to instantiate a <code>csstidy</code>
|
||||
class to use for internal cleaning. This will usually be good enough.
|
||||
</p>
|
||||
<p>
|
||||
However, for trusted user input, you can set this to <code>false</code> to
|
||||
disable cleaning. In addition, you can supply your own concrete implementation
|
||||
of Tidy's interface to use, although I don't know why you'd want to do that.
|
||||
</p>
|
2
library/HTMLPurifier/ConfigSchema/schema/FilterParam.txt
Normal file
2
library/HTMLPurifier/ConfigSchema/schema/FilterParam.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
FilterParam
|
||||
DESCRIPTION: Configuration for filters.
|
Reference in New Issue
Block a user