mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 05:11:52 +00:00
Added %Core.RemoveProcessingInstructions.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
parent
33afd7d9e0
commit
1bed8b6d5f
2
NEWS
2
NEWS
@ -10,6 +10,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
==========================
|
==========================
|
||||||
|
|
||||||
4.1.2, unknown release date
|
4.1.2, unknown release date
|
||||||
|
! Added %Core.RemoveProcessingInstructions, which lets you remove
|
||||||
|
<? ... ?> statements.
|
||||||
- Fix improper handling of Internet Explorer conditional comments
|
- Fix improper handling of Internet Explorer conditional comments
|
||||||
by parser. Thanks zmonteca for reporting.
|
by parser. Thanks zmonteca for reporting.
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</file>
|
</file>
|
||||||
<file name="HTMLPurifier/Lexer.php">
|
<file name="HTMLPurifier/Lexer.php">
|
||||||
<line>81</line>
|
<line>81</line>
|
||||||
<line>269</line>
|
<line>282</line>
|
||||||
</file>
|
</file>
|
||||||
<file name="HTMLPurifier/Lexer/DirectLex.php">
|
<file name="HTMLPurifier/Lexer/DirectLex.php">
|
||||||
<line>53</line>
|
<line>53</line>
|
||||||
@ -149,7 +149,7 @@
|
|||||||
<line>202</line>
|
<line>202</line>
|
||||||
</file>
|
</file>
|
||||||
<file name="HTMLPurifier/Lexer.php">
|
<file name="HTMLPurifier/Lexer.php">
|
||||||
<line>258</line>
|
<line>269</line>
|
||||||
</file>
|
</file>
|
||||||
<file name="HTMLPurifier/HTMLModule/Image.php">
|
<file name="HTMLPurifier/HTMLModule/Image.php">
|
||||||
<line>27</line>
|
<line>27</line>
|
||||||
@ -211,7 +211,12 @@
|
|||||||
</directive>
|
</directive>
|
||||||
<directive id="Core.ConvertDocumentToFragment">
|
<directive id="Core.ConvertDocumentToFragment">
|
||||||
<file name="HTMLPurifier/Lexer.php">
|
<file name="HTMLPurifier/Lexer.php">
|
||||||
<line>267</line>
|
<line>280</line>
|
||||||
|
</file>
|
||||||
|
</directive>
|
||||||
|
<directive id="Core.RemoveProcessingInstructions">
|
||||||
|
<file name="HTMLPurifier/Lexer.php">
|
||||||
|
<line>301</line>
|
||||||
</file>
|
</file>
|
||||||
</directive>
|
</directive>
|
||||||
<directive id="URI.">
|
<directive id="URI.">
|
||||||
|
Binary file not shown.
@ -0,0 +1,11 @@
|
|||||||
|
Core.RemoveProcessingInstructions
|
||||||
|
TYPE: bool
|
||||||
|
VERSION: 4.1.2
|
||||||
|
DEFAULT: false
|
||||||
|
--DESCRIPTION--
|
||||||
|
Instead of escaping processing instructions in the form <code><? ...
|
||||||
|
?></code>, remove it out-right. This may be useful if the HTML
|
||||||
|
you are validating contains XML processing instruction gunk, however,
|
||||||
|
it can also be user-unfriendly for people attempting to post PHP
|
||||||
|
snippets.
|
||||||
|
--# vim: et sw=4 sts=4
|
@ -297,6 +297,11 @@ class HTMLPurifier_Lexer
|
|||||||
// represent non-SGML characters (horror, horror!)
|
// represent non-SGML characters (horror, horror!)
|
||||||
$html = HTMLPurifier_Encoder::cleanUTF8($html);
|
$html = HTMLPurifier_Encoder::cleanUTF8($html);
|
||||||
|
|
||||||
|
// if processing instructions are to removed, remove them now
|
||||||
|
if ($config->get('Core.RemoveProcessingInstructions')) {
|
||||||
|
$html = preg_replace('#<\?.+?\?>#s', '', $html);
|
||||||
|
}
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,6 +717,14 @@ div {}
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_tokenizeHTML_removeProcessingInstruction() {
|
||||||
|
$this->config->set('Core.RemoveProcessingInstructions', true);
|
||||||
|
$this->assertTokenization(
|
||||||
|
'<?xml blah blah ?>',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
function test_tokenizeHTML_() {
|
function test_tokenizeHTML_() {
|
||||||
|
Loading…
Reference in New Issue
Block a user