ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
HTMLPurifier_HTMLModule_Legacy Class Reference

XHTML 1.1 Legacy module defines elements that were previously deprecated. More...

+ Inheritance diagram for HTMLPurifier_HTMLModule_Legacy:
+ Collaboration diagram for HTMLPurifier_HTMLModule_Legacy:

Public Member Functions

 setup ($config)
 
- Public Member Functions inherited from HTMLPurifier_HTMLModule
 getChildDef ($def)
 Retrieves a proper HTMLPurifier_ChildDef subclass based on content_model and content_model_type member variables of the HTMLPurifier_ElementDef class. More...
 
 addElement ($element, $type, $contents, $attr_includes=array(), $attr=array())
 Convenience function that sets up a new element. More...
 
 addBlankElement ($element)
 Convenience function that creates a totally blank, non-standalone element. More...
 
 addElementToContentSet ($element, $type)
 Convenience function that registers an element to a content set. More...
 
 parseContents ($contents)
 Convenience function that transforms single-string contents into separate content model and content model type. More...
 
 mergeInAttrIncludes (&$attr, $attr_includes)
 Convenience function that merges a list of attribute includes into an attribute array. More...
 
 makeLookup ($list)
 Convenience function that generates a lookup table with boolean true as value. More...
 
 setup ($config)
 Lazy load construction of the module after determining whether or not it's needed, and also when a finalized configuration object is available. More...
 

Data Fields

 $name = 'Legacy'
 string More...
 
- Data Fields inherited from HTMLPurifier_HTMLModule
 $name
 Short unique string identifier of the module. More...
 
 $elements = array()
 Informally, a list of elements this module changes. More...
 
 $info = array()
 Associative array of element names to element definitions. More...
 
 $content_sets = array()
 Associative array of content set names to content set additions. More...
 
 $attr_collections = array()
 Associative array of attribute collection names to attribute collection additions. More...
 
 $info_tag_transform = array()
 Associative array of deprecated tag name to HTMLPurifier_TagTransform. More...
 
 $info_attr_transform_pre = array()
 List of HTMLPurifier_AttrTransform to be performed before validation. More...
 
 $info_attr_transform_post = array()
 List of HTMLPurifier_AttrTransform to be performed after validation. More...
 
 $info_injector = array()
 List of HTMLPurifier_Injector to be performed during well-formedness fixing. More...
 
 $defines_child_def = false
 Boolean flag that indicates whether or not getChildDef is implemented. More...
 
 $safe = true
 Boolean flag whether or not this module is safe. More...
 

Detailed Description

XHTML 1.1 Legacy module defines elements that were previously deprecated.

Note
Not all legacy elements have been implemented yet, which is a bit of a reverse problem as compared to browsers! In addition, this legacy module may implement a bit more than mandated by XHTML 1.1.

This module can be used in combination with TransformToStrict in order to transform as many deprecated elements as possible, but retain questionably deprecated elements that do not have good alternatives as well as transform elements that don't have an implementation. See docs/ref-strictness.txt for more details.

Definition at line 19 of file Legacy.php.

Member Function Documentation

◆ setup()

HTMLPurifier_HTMLModule_Legacy::setup (   $config)
Parameters
HTMLPurifier_Config$config

Definition at line 29 of file Legacy.php.

References $img, HTMLPurifier_HTMLModule\addBlankElement(), and HTMLPurifier_HTMLModule\addElement().

30  {
31  $this->addElement(
32  'basefont',
33  'Inline',
34  'Empty',
35  null,
36  array(
37  'color' => 'Color',
38  'face' => 'Text', // extremely broad, we should
39  'size' => 'Text', // tighten it
40  'id' => 'ID'
41  )
42  );
43  $this->addElement('center', 'Block', 'Flow', 'Common');
44  $this->addElement(
45  'dir',
46  'Block',
47  'Required: li',
48  'Common',
49  array(
50  'compact' => 'Bool#compact'
51  )
52  );
53  $this->addElement(
54  'font',
55  'Inline',
56  'Inline',
57  array('Core', 'I18N'),
58  array(
59  'color' => 'Color',
60  'face' => 'Text', // extremely broad, we should
61  'size' => 'Text', // tighten it
62  )
63  );
64  $this->addElement(
65  'menu',
66  'Block',
67  'Required: li',
68  'Common',
69  array(
70  'compact' => 'Bool#compact'
71  )
72  );
73 
74  $s = $this->addElement('s', 'Inline', 'Inline', 'Common');
75  $s->formatting = true;
76 
77  $strike = $this->addElement('strike', 'Inline', 'Inline', 'Common');
78  $strike->formatting = true;
79 
80  $u = $this->addElement('u', 'Inline', 'Inline', 'Common');
81  $u->formatting = true;
82 
83  // setup modifications to old elements
84 
85  $align = 'Enum#left,right,center,justify';
86 
87  $address = $this->addBlankElement('address');
88  $address->content_model = 'Inline | #PCDATA | p';
89  $address->content_model_type = 'optional';
90  $address->child = false;
91 
92  $blockquote = $this->addBlankElement('blockquote');
93  $blockquote->content_model = 'Flow | #PCDATA';
94  $blockquote->content_model_type = 'optional';
95  $blockquote->child = false;
96 
97  $br = $this->addBlankElement('br');
98  $br->attr['clear'] = 'Enum#left,all,right,none';
99 
100  $caption = $this->addBlankElement('caption');
101  $caption->attr['align'] = 'Enum#top,bottom,left,right';
102 
103  $div = $this->addBlankElement('div');
104  $div->attr['align'] = $align;
105 
106  $dl = $this->addBlankElement('dl');
107  $dl->attr['compact'] = 'Bool#compact';
108 
109  for ($i = 1; $i <= 6; $i++) {
110  $h = $this->addBlankElement("h$i");
111  $h->attr['align'] = $align;
112  }
113 
114  $hr = $this->addBlankElement('hr');
115  $hr->attr['align'] = $align;
116  $hr->attr['noshade'] = 'Bool#noshade';
117  $hr->attr['size'] = 'Pixels';
118  $hr->attr['width'] = 'Length';
119 
120  $img = $this->addBlankElement('img');
121  $img->attr['align'] = 'IAlign';
122  $img->attr['border'] = 'Pixels';
123  $img->attr['hspace'] = 'Pixels';
124  $img->attr['vspace'] = 'Pixels';
125 
126  // figure out this integer business
127 
128  $li = $this->addBlankElement('li');
129  $li->attr['value'] = new HTMLPurifier_AttrDef_Integer();
130  $li->attr['type'] = 'Enum#s:1,i,I,a,A,disc,square,circle';
131 
132  $ol = $this->addBlankElement('ol');
133  $ol->attr['compact'] = 'Bool#compact';
134  $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer();
135  $ol->attr['type'] = 'Enum#s:1,i,I,a,A';
136 
137  $p = $this->addBlankElement('p');
138  $p->attr['align'] = $align;
139 
140  $pre = $this->addBlankElement('pre');
141  $pre->attr['width'] = 'Number';
142 
143  // script omitted
144 
145  $table = $this->addBlankElement('table');
146  $table->attr['align'] = 'Enum#left,center,right';
147  $table->attr['bgcolor'] = 'Color';
148 
149  $tr = $this->addBlankElement('tr');
150  $tr->attr['bgcolor'] = 'Color';
151 
152  $th = $this->addBlankElement('th');
153  $th->attr['bgcolor'] = 'Color';
154  $th->attr['height'] = 'Length';
155  $th->attr['nowrap'] = 'Bool#nowrap';
156  $th->attr['width'] = 'Length';
157 
158  $td = $this->addBlankElement('td');
159  $td->attr['bgcolor'] = 'Color';
160  $td->attr['height'] = 'Length';
161  $td->attr['nowrap'] = 'Bool#nowrap';
162  $td->attr['width'] = 'Length';
163 
164  $ul = $this->addBlankElement('ul');
165  $ul->attr['compact'] = 'Bool#compact';
166  $ul->attr['type'] = 'Enum#square,disc,circle';
167 
168  // "safe" modifications to "unsafe" elements
169  // WARNING: If you want to add support for an unsafe, legacy
170  // attribute, make a new TrustedLegacy module with the trusted
171  // bit set appropriately
172 
173  $form = $this->addBlankElement('form');
174  $form->content_model = 'Flow | #PCDATA';
175  $form->content_model_type = 'optional';
176  $form->attr['target'] = 'FrameTarget';
177 
178  $input = $this->addBlankElement('input');
179  $input->attr['align'] = 'IAlign';
180 
181  $legend = $this->addBlankElement('legend');
182  $legend->attr['align'] = 'LAlign';
183  }
addBlankElement($element)
Convenience function that creates a totally blank, non-standalone element.
Definition: HTMLModule.php:174
addElement($element, $type, $contents, $attr_includes=array(), $attr=array())
Convenience function that sets up a new element.
Definition: HTMLModule.php:144
Validates an integer.
Definition: Integer.php:10
+ Here is the call graph for this function:

Field Documentation

◆ $name

HTMLPurifier_HTMLModule_Legacy::$name = 'Legacy'

string

Definition at line 24 of file Legacy.php.


The documentation for this class was generated from the following file: