ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
HTMLPurifier_HTMLModule_Forms Class Reference

XHTML 1.1 Forms module, defines all form-related elements found in HTML 4. More...

+ Inheritance diagram for HTMLPurifier_HTMLModule_Forms:
+ Collaboration diagram for HTMLPurifier_HTMLModule_Forms:

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 = 'Forms'
 @type string More...
 
 $safe = false
 @type bool More...
 
 $content_sets
 @type array 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 Forms module, defines all form-related elements found in HTML 4.

Definition at line 6 of file Forms.php.

Member Function Documentation

◆ setup()

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

Reimplemented from HTMLPurifier_HTMLModule.

Definition at line 29 of file Forms.php.

30 {
31 $form = $this->addElement(
32 'form',
33 'Form',
34 'Required: Heading | List | Block | fieldset',
35 'Common',
36 array(
37 'accept' => 'ContentTypes',
38 'accept-charset' => 'Charsets',
39 'action*' => 'URI',
40 'method' => 'Enum#get,post',
41 // really ContentType, but these two are the only ones used today
42 'enctype' => 'Enum#application/x-www-form-urlencoded,multipart/form-data',
43 )
44 );
45 $form->excludes = array('form' => true);
46
47 $input = $this->addElement(
48 'input',
49 'Formctrl',
50 'Empty',
51 'Common',
52 array(
53 'accept' => 'ContentTypes',
54 'accesskey' => 'Character',
55 'alt' => 'Text',
56 'checked' => 'Bool#checked',
57 'disabled' => 'Bool#disabled',
58 'maxlength' => 'Number',
59 'name' => 'CDATA',
60 'readonly' => 'Bool#readonly',
61 'size' => 'Number',
62 'src' => 'URI#embedded',
63 'tabindex' => 'Number',
64 'type' => 'Enum#text,password,checkbox,button,radio,submit,reset,file,hidden,image',
65 'value' => 'CDATA',
66 )
67 );
68 $input->attr_transform_post[] = new HTMLPurifier_AttrTransform_Input();
69
70 $this->addElement(
71 'select',
72 'Formctrl',
73 'Required: optgroup | option',
74 'Common',
75 array(
76 'disabled' => 'Bool#disabled',
77 'multiple' => 'Bool#multiple',
78 'name' => 'CDATA',
79 'size' => 'Number',
80 'tabindex' => 'Number',
81 )
82 );
83
84 $this->addElement(
85 'option',
86 false,
87 'Optional: #PCDATA',
88 'Common',
89 array(
90 'disabled' => 'Bool#disabled',
91 'label' => 'Text',
92 'selected' => 'Bool#selected',
93 'value' => 'CDATA',
94 )
95 );
96 // It's illegal for there to be more than one selected, but not
97 // be multiple. Also, no selected means undefined behavior. This might
98 // be difficult to implement; perhaps an injector, or a context variable.
99
100 $textarea = $this->addElement(
101 'textarea',
102 'Formctrl',
103 'Optional: #PCDATA',
104 'Common',
105 array(
106 'accesskey' => 'Character',
107 'cols*' => 'Number',
108 'disabled' => 'Bool#disabled',
109 'name' => 'CDATA',
110 'readonly' => 'Bool#readonly',
111 'rows*' => 'Number',
112 'tabindex' => 'Number',
113 )
114 );
115 $textarea->attr_transform_pre[] = new HTMLPurifier_AttrTransform_Textarea();
116
117 $button = $this->addElement(
118 'button',
119 'Formctrl',
120 'Optional: #PCDATA | Heading | List | Block | Inline',
121 'Common',
122 array(
123 'accesskey' => 'Character',
124 'disabled' => 'Bool#disabled',
125 'name' => 'CDATA',
126 'tabindex' => 'Number',
127 'type' => 'Enum#button,submit,reset',
128 'value' => 'CDATA',
129 )
130 );
131
132 // For exclusions, ideally we'd specify content sets, not literal elements
133 $button->excludes = $this->makeLookup(
134 'form',
135 'fieldset', // Form
136 'input',
137 'select',
138 'textarea',
139 'label',
140 'button', // Formctrl
141 'a', // as per HTML 4.01 spec, this is omitted by modularization
142 'isindex',
143 'iframe' // legacy items
144 );
145
146 // Extra exclusion: img usemap="" is not permitted within this element.
147 // We'll omit this for now, since we don't have any good way of
148 // indicating it yet.
149
150 // This is HIGHLY user-unfriendly; we need a custom child-def for this
151 $this->addElement('fieldset', 'Form', 'Custom: (#WS?,legend,(Flow|#PCDATA)*)', 'Common');
152
153 $label = $this->addElement(
154 'label',
155 'Formctrl',
156 'Optional: #PCDATA | Inline',
157 'Common',
158 array(
159 'accesskey' => 'Character',
160 // 'for' => 'IDREF', // IDREF not implemented, cannot allow
161 )
162 );
163 $label->excludes = array('label' => true);
164
165 $this->addElement(
166 'legend',
167 false,
168 'Optional: #PCDATA | Inline',
169 'Common',
170 array(
171 'accesskey' => 'Character',
172 )
173 );
174
175 $this->addElement(
176 'optgroup',
177 false,
178 'Required: option',
179 'Common',
180 array(
181 'disabled' => 'Bool#disabled',
182 'label*' => 'Text',
183 )
184 );
185 // Don't forget an injector for <isindex>. This one's a little complex
186 // because it maps to multiple elements.
187 }
Performs miscellaneous cross attribute validation and filtering for input elements.
Definition: Input.php:8
Sets height/width defaults for <textarea>
Definition: Textarea.php:7
makeLookup($list)
Convenience function that generates a lookup table with boolean true as value.
Definition: HTMLModule.php:258
addElement($element, $type, $contents, $attr_includes=array(), $attr=array())
Convenience function that sets up a new element.
Definition: HTMLModule.php:144

References HTMLPurifier_HTMLModule\addElement(), and HTMLPurifier_HTMLModule\makeLookup().

+ Here is the call graph for this function:

Field Documentation

◆ $content_sets

HTMLPurifier_HTMLModule_Forms::$content_sets
Initial value:
= array(
'Block' => 'Form',
'Inline' => 'Formctrl',
)

@type array

Definition at line 21 of file Forms.php.

◆ $name

HTMLPurifier_HTMLModule_Forms::$name = 'Forms'

@type string

Definition at line 11 of file Forms.php.

◆ $safe

HTMLPurifier_HTMLModule_Forms::$safe = false

@type bool

Definition at line 16 of file Forms.php.


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