2007-03-29 21:41:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/AttrTransform.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pre-transform that changes deprecated border attribute to CSS.
|
|
|
|
*/
|
2007-05-05 02:25:55 +00:00
|
|
|
class HTMLPurifier_AttrTransform_Border extends HTMLPurifier_AttrTransform {
|
2007-03-29 21:41:17 +00:00
|
|
|
|
2008-01-05 00:10:43 +00:00
|
|
|
public function transform($attr, $config, $context) {
|
2007-03-29 21:41:17 +00:00
|
|
|
if (!isset($attr['border'])) return $attr;
|
2007-05-05 02:25:55 +00:00
|
|
|
$border_width = $this->confiscateAttr($attr, 'border');
|
2007-03-29 21:41:17 +00:00
|
|
|
// some validation should happen here
|
2007-05-05 02:25:55 +00:00
|
|
|
$this->prependCSS($attr, "border:{$border_width}px solid;");
|
2007-03-29 21:41:17 +00:00
|
|
|
return $attr;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|