From 77f57aa2645b01720c3e8c3f15bf98f25758a42b Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sat, 7 Feb 2009 02:57:36 -0500 Subject: [PATCH] Fix CSSDefinition Printer problems with important decorator. Signed-off-by: Edward Z. Yang --- NEWS | 1 + library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php | 2 +- library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php | 2 +- library/HTMLPurifier/Printer.php | 8 ++++++++ smoketests/printDefinition.php | 3 +-- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 104e8397..c06f1531 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier - Fix degenerate case with YouTube filter involving double hyphens. Thanks Pierre Attar for reporting. - Fix YouTube rendering problem on certain versions of Firefox. +- Fix CSSDefinition Printer problems with decorators . Add verbose mode to command line test runner, use (--verbose) . Turn on unit tests for UnitConverter . Fix missing version number in configuration %Attr.DefaultImageAlt (added 3.2.0) diff --git a/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php b/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php index a00586b9..6599c5b2 100644 --- a/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php +++ b/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php @@ -5,7 +5,7 @@ */ class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef { - protected $def, $element; + public $def, $element; /** * @param $def Definition to wrap diff --git a/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php b/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php index 2990cff7..4e6b35e5 100644 --- a/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php +++ b/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php @@ -5,7 +5,7 @@ */ class HTMLPurifier_AttrDef_CSS_ImportantDecorator extends HTMLPurifier_AttrDef { - protected $def, $allow; + public $def, $allow; /** * @param $def Definition to wrap diff --git a/library/HTMLPurifier/Printer.php b/library/HTMLPurifier/Printer.php index ee5b33e7..e7eb82e8 100644 --- a/library/HTMLPurifier/Printer.php +++ b/library/HTMLPurifier/Printer.php @@ -158,6 +158,14 @@ class HTMLPurifier_Printer $class .= $this->getClass($obj->single, $sec_prefix) . ', '; $class .= $obj->max; break; + case 'css_denyelementdecorator': + $class .= $this->getClass($obj->def, $sec_prefix) . ', '; + $class .= $obj->element; + break; + case 'css_importantdecorator': + $class .= $this->getClass($obj->def, $sec_prefix); + if ($obj->allow) $class .= ', !important'; + break; } $class .= ')'; return $class; diff --git a/smoketests/printDefinition.php b/smoketests/printDefinition.php index 59beeaba..201a07a1 100644 --- a/smoketests/printDefinition.php +++ b/smoketests/printDefinition.php @@ -41,8 +41,7 @@ echo ''; .HTMLPurifier_Printer td, .HTMLPurifier_Printer th {padding:3px; border:1px solid #000;background:#CCC; vertical-align: baseline;} .HTMLPurifier_Printer th {text-align:left;background:#CCF;width:20%;} - .HTMLPurifier_Printer caption {font-size:1.5em; font-weight:bold; - width:100%;} + .HTMLPurifier_Printer caption {font-size:1.5em; font-weight:bold;} .HTMLPurifier_Printer .heavy {background:#99C;text-align:center;} .HTMLPurifier_Printer .unsafe {background:#C99;} dt {font-weight:bold;}