mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-23 00:41:52 +00:00
2c955af135
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
18 lines
479 B
PHP
18 lines
479 B
PHP
<?php
|
|
|
|
/**
|
|
* Pre-transform that changes deprecated border attribute to CSS.
|
|
*/
|
|
class HTMLPurifier_AttrTransform_Border extends HTMLPurifier_AttrTransform {
|
|
|
|
public function transform($attr, $config, $context) {
|
|
if (!isset($attr['border'])) return $attr;
|
|
$border_width = $this->confiscateAttr($attr, 'border');
|
|
// some validation should happen here
|
|
$this->prependCSS($attr, "border:{$border_width}px solid;");
|
|
return $attr;
|
|
}
|
|
|
|
}
|
|
|