TagTransform.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Defines a mutation of an obsolete tag into a valid tag.
  4. */
  5. abstract class HTMLPurifier_TagTransform
  6. {
  7. /**
  8. * Tag name to transform the tag to.
  9. * @type string
  10. */
  11. public $transform_to;
  12. /**
  13. * Transforms the obsolete tag into the valid tag.
  14. * @param HTMLPurifier_Token_Tag $tag Tag to be transformed.
  15. * @param HTMLPurifier_Config $config Mandatory HTMLPurifier_Config object
  16. * @param HTMLPurifier_Context $context Mandatory HTMLPurifier_Context object
  17. */
  18. abstract public function transform($tag, $config, $context);
  19. /**
  20. * Prepends CSS properties to the style attribute, creating the
  21. * attribute if it doesn't exist.
  22. * @warning Copied over from AttrTransform, be sure to keep in sync
  23. * @param array $attr Attribute array to process (passed by reference)
  24. * @param string $css CSS to prepend
  25. */
  26. protected function prependCSS(&$attr, $css)
  27. {
  28. $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
  29. $attr['style'] = $css . $attr['style'];
  30. }
  31. }
  32. // vim: et sw=4 sts=4