Border.php 501 B

123456789101112131415161718
  1. <?php
  2. /**
  3. * Pre-transform that changes deprecated border attribute to CSS.
  4. */
  5. class HTMLPurifier_AttrTransform_Border extends HTMLPurifier_AttrTransform {
  6. public function transform($attr, $config, $context) {
  7. if (!isset($attr['border'])) return $attr;
  8. $border_width = $this->confiscateAttr($attr, 'border');
  9. // some validation should happen here
  10. $this->prependCSS($attr, "border:{$border_width}px solid;");
  11. return $attr;
  12. }
  13. }
  14. // vim: et sw=4 sts=4