ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
SafeObject.php
Go to the documentation of this file.
1<?php
2
10{
14 public $name = 'SafeObject';
15
19 public function setup($config)
20 {
21 // These definitions are not intrinsically safe: the attribute transforms
22 // are a vital part of ensuring safety.
23
24 $max = $config->get('HTML.MaxImgLength');
25 $object = $this->addElement(
26 'object',
27 'Inline',
28 'Optional: param | Flow | #PCDATA',
29 'Common',
30 array(
31 // While technically not required by the spec, we're forcing
32 // it to this value.
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(
38 array(
39 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'
40 )
41 ),
42 )
43 );
44 $object->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeObject();
45
46 $param = $this->addElement(
47 'param',
48 false,
49 'Empty',
50 false,
51 array(
52 'id' => 'ID',
53 'name*' => 'Text',
54 'value' => 'Text'
55 )
56 );
57 $param->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeParam();
58 $this->info_injector[] = 'SafeObject';
59 }
60}
61
62// vim: et sw=4 sts=4
Validates a keyword against a list of valid values.
Definition: Enum.php:11
Writes default type for all objects.
Definition: SafeObject.php:7
Validates name/value pairs in param tags to be used in safe objects.
Definition: SafeParam.php:16
A "safe" object module.
Definition: SafeObject.php:10
Represents an XHTML 1.1 module, with information on elements, tags and attributes.
Definition: HTMLModule.php:19
addElement($element, $type, $contents, $attr_includes=array(), $attr=array())
Convenience function that sets up a new element.
Definition: HTMLModule.php:144