ScriptRequired.php 516 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * Implements required attribute stipulation for <script>
  4. */
  5. class HTMLPurifier_AttrTransform_ScriptRequired 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['type'])) {
  16. $attr['type'] = 'text/javascript';
  17. }
  18. return $attr;
  19. }
  20. }
  21. // vim: et sw=4 sts=4