BdoDir.php 639 B

123456789101112131415161718192021222324252627
  1. <?php
  2. // this MUST be placed in post, as it assumes that any value in dir is valid
  3. /**
  4. * Post-trasnform that ensures that bdo tags have the dir attribute set.
  5. */
  6. class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
  7. {
  8. /**
  9. * @param array $attr
  10. * @param HTMLPurifier_Config $config
  11. * @param HTMLPurifier_Context $context
  12. * @return array
  13. */
  14. public function transform($attr, $config, $context)
  15. {
  16. if (isset($attr['dir'])) {
  17. return $attr;
  18. }
  19. $attr['dir'] = $config->get('Attr.DefaultTextDir');
  20. return $attr;
  21. }
  22. }
  23. // vim: et sw=4 sts=4