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
12 public $name = 'SafeObject';
14 public function setup($config) {
16 // These definitions are not intrinsically safe: the attribute transforms
17 // are a vital part of ensuring safety.
19 $max = $config->get('HTML', 'MaxImgLength');
20 $object = $this->addElement(
23 'Optional: param | Flow | #PCDATA',
26 // While technically not required by the spec, we're forcing
28 'type' => 'Enum#application/x-shockwave-flash',
29 'width' => 'Pixels#' . $max,
30 'height' => 'Pixels#' . $max,
34 $object->attr_transform_post
[] = new HTMLPurifier_AttrTransform_SafeObject();
36 $param = $this->addElement('param', false, 'Empty', false,
43 $param->attr_transform_post
[] = new HTMLPurifier_AttrTransform_SafeParam();
44 $this->info_injector
[] = 'SafeObject';