4 * Pre-transform that changes deprecated bgcolor attribute to CSS.
6 class HTMLPurifier_AttrTransform_BgColor extends HTMLPurifier_AttrTransform {
8 public function transform($attr, $config, $context) {
10 if (!isset($attr['bgcolor'])) return $attr;
12 $bgcolor = $this->confiscateAttr($attr, 'bgcolor');
13 // some validation should happen here
15 $this->prependCSS($attr, "background-color:$bgcolor;");