1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-11 09:46:20 +02:00
Files
php-htmlpurifier/library/HTMLPurifier/AttrTransform/Background.php
2008-09-27 21:19:35 -04:00

23 lines
546 B
PHP

<?php
/**
* Pre-transform that changes proprietary background attribute to CSS.
*/
class HTMLPurifier_AttrTransform_Background extends HTMLPurifier_AttrTransform {
public function transform($attr, $config, $context) {
if (!isset($attr['background'])) return $attr;
$background = $this->confiscateAttr($attr, 'background');
// some validation should happen here
$this->prependCSS($attr, "background-image:url($background);");
return $attr;
}
}