Border.php 676 B

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