0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-23 00:41:52 +00:00

Fix inability to totally override content model.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang 2009-06-10 18:24:52 -04:00
parent 733a5ce5c3
commit c7594487a2
3 changed files with 7 additions and 2 deletions

4
NEWS
View File

@ -23,6 +23,9 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
# The allowed values for class have been relaxed to allow all of CDATA for # The allowed values for class have been relaxed to allow all of CDATA for
doctypes that are not XHTML 1.1 or XHTML 2.0. For old behavior, set doctypes that are not XHTML 1.1 or XHTML 2.0. For old behavior, set
%Attr.ClassUseCDATA to false. %Attr.ClassUseCDATA to false.
# Instead of appending the content model to an old content model, a blank
element will replace the old content model. You can use #SUPER to get
the old content model.
! More robust support for name="" and id="" ! More robust support for name="" and id=""
! HTMLPurifier_Config::inherit($config) allows you to inherit one ! HTMLPurifier_Config::inherit($config) allows you to inherit one
configuration, and have changes to that configuration be propagated configuration, and have changes to that configuration be propagated
@ -46,6 +49,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
- Fix bug where URIDefinition would not get cleared if it's directives got - Fix bug where URIDefinition would not get cleared if it's directives got
changed. changed.
- Fix fatal error in HTMLPurifier_Encoder on certain platforms (probably NetBSD 5.0) - Fix fatal error in HTMLPurifier_Encoder on certain platforms (probably NetBSD 5.0)
- Fix bug in Linkify autoformatter involving <a><span>http://foo</span></a>
. Created script maintenance/rename-config.php for renaming a configuration . Created script maintenance/rename-config.php for renaming a configuration
directive while maintaining its alias. This script does not change source code. directive while maintaining its alias. This script does not change source code.
. Implement namespace locking for definition construction, to prevent . Implement namespace locking for definition construction, to prevent

View File

@ -142,7 +142,8 @@ class HTMLPurifier_ElementDef
$this->_mergeAssocArray($this->excludes, $def->excludes); $this->_mergeAssocArray($this->excludes, $def->excludes);
if(!empty($def->content_model)) { if(!empty($def->content_model)) {
$this->content_model .= ' | ' . $def->content_model; $this->content_model =
str_replace("#SUPER", $this->content_model, $def->content_model);
$this->child = false; $this->child = false;
} }
if(!empty($def->content_model_type)) { if(!empty($def->content_model_type)) {

View File

@ -51,7 +51,7 @@ class HTMLPurifier_ElementDefTest extends HTMLPurifier_Harness
'removed-transform' => false, 'removed-transform' => false,
); );
$def2->child = $new; $def2->child = $new;
$def2->content_model = 'new'; $def2->content_model = '#SUPER | new';
$def2->content_model_type = $overloaded_new; $def2->content_model_type = $overloaded_new;
$def2->descendants_are_inline = true; $def2->descendants_are_inline = true;
$def2->excludes = array( $def2->excludes = array(