SafeEmbed.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * A "safe" embed module. See SafeObject. This is a proprietary element.
  4. */
  5. class HTMLPurifier_HTMLModule_SafeEmbed extends HTMLPurifier_HTMLModule
  6. {
  7. /**
  8. * @type string
  9. */
  10. public $name = 'SafeEmbed';
  11. /**
  12. * @param HTMLPurifier_Config $config
  13. */
  14. public function setup($config)
  15. {
  16. $max = $config->get('HTML.MaxImgLength');
  17. $embed = $this->addElement(
  18. 'embed',
  19. 'Inline',
  20. 'Empty',
  21. 'Common',
  22. array(
  23. 'src*' => 'URI#embedded',
  24. 'type' => 'Enum#application/x-shockwave-flash',
  25. 'width' => 'Pixels#' . $max,
  26. 'height' => 'Pixels#' . $max,
  27. 'allowscriptaccess' => 'Enum#never',
  28. 'allownetworking' => 'Enum#internal',
  29. 'flashvars' => 'Text',
  30. 'wmode' => 'Enum#window,transparent,opaque',
  31. 'name' => 'ID',
  32. )
  33. );
  34. $embed->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeEmbed();
  35. }
  36. }
  37. // vim: et sw=4 sts=4