4 * A "safe" object module. In theory, objects permitted by this module will
5 * be safe, and untrusted users can be allowed to embed arbitrary flash objects
6 * (maybe other types too, but only Flash is supported as of right now).
9 class HTMLPurifier_HTMLModule_SafeObject
extends HTMLPurifier_HTMLModule
14 public $name = 'SafeObject';
17 * @param HTMLPurifier_Config $config
19 public function setup($config)
21 // These definitions are not intrinsically safe: the attribute transforms
22 // are a vital part of ensuring safety.
24 $max = $config->get('HTML.MaxImgLength');
25 $object = $this->addElement(
28 'Optional: param | Flow | #PCDATA',
31 // While technically not required by the spec, we're forcing
33 'type' => 'Enum#application/x-shockwave-flash',
34 'width' => 'Pixels#' . $max,
35 'height' => 'Pixels#' . $max,
36 'data' => 'URI#embedded',
37 'codebase' => new HTMLPurifier_AttrDef_Enum(
39 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'
44 $object->attr_transform_post
[] = new HTMLPurifier_AttrTransform_SafeObject();
46 $param = $this->addElement(
57 $param->attr_transform_post
[] = new HTMLPurifier_AttrTransform_SafeParam();
58 $this->info_injector
[] = 'SafeObject';