ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 Class Reference
+ Inheritance diagram for HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4:
+ Collaboration diagram for HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4:

Public Member Functions

 makeFixes ()
 
- Public Member Functions inherited from HTMLPurifier_HTMLModule_Tidy
 setup ($config)
 Lazy load constructs the module by determining the necessary fixes to create and then delegating to the populate() function. More...
 
 getFixesForLevel ($level)
 Retrieves all fixes per a level, returning fixes for that specific level as well as all levels below it. More...
 
 makeFixesForLevel ($fixes)
 Dynamically populates the $fixesForLevel member variable using the fixes array. More...
 
 populate ($fixes)
 Populates the module with transforms and other special-case code based on a list of fixes passed to it. More...
 
 getFixType ($name)
 Parses a fix name and determines what kind of fix it is, as well as other information defined by the fix. More...
 
 makeFixes ()
 Defines all fixes the module will perform in a compact associative array of fix name to fix implementation. More...
 
- 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...
 

Additional Inherited Members

- Data Fields inherited from HTMLPurifier_HTMLModule_Tidy
 $levels = array(0 => 'none', 'light', 'medium', 'heavy')
 List of supported levels. More...
 
 $defaultLevel = null
 Default level to place all fixes in. More...
 
 $fixesForLevel
 Lists of fixes used by getFixesForLevel(). 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

Definition at line 3 of file XHTMLAndHTML4.php.

Member Function Documentation

◆ makeFixes()

HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4::makeFixes ( )
Returns
array

Reimplemented from HTMLPurifier_HTMLModule_Tidy.

Reimplemented in HTMLPurifier_HTMLModule_Tidy_Strict.

Definition at line 9 of file XHTMLAndHTML4.php.

10 {
11 $r = array();
12
13 // == deprecated tag transforms ===================================
14
15 $r['font'] = new HTMLPurifier_TagTransform_Font();
16 $r['menu'] = new HTMLPurifier_TagTransform_Simple('ul');
17 $r['dir'] = new HTMLPurifier_TagTransform_Simple('ul');
18 $r['center'] = new HTMLPurifier_TagTransform_Simple('div', 'text-align:center;');
19 $r['u'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:underline;');
20 $r['s'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:line-through;');
21 $r['strike'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:line-through;');
22
23 // == deprecated attribute transforms =============================
24
25 $r['caption@align'] =
27 'align',
28 array(
29 // we're following IE's behavior, not Firefox's, due
30 // to the fact that no one supports caption-side:right,
31 // W3C included (with CSS 2.1). This is a slightly
32 // unreasonable attribute!
33 'left' => 'text-align:left;',
34 'right' => 'text-align:right;',
35 'top' => 'caption-side:top;',
36 'bottom' => 'caption-side:bottom;' // not supported by IE
37 )
38 );
39
40 // @align for img -------------------------------------------------
41 $r['img@align'] =
43 'align',
44 array(
45 'left' => 'float:left;',
46 'right' => 'float:right;',
47 'top' => 'vertical-align:top;',
48 'middle' => 'vertical-align:middle;',
49 'bottom' => 'vertical-align:baseline;',
50 )
51 );
52
53 // @align for table -----------------------------------------------
54 $r['table@align'] =
56 'align',
57 array(
58 'left' => 'float:left;',
59 'center' => 'margin-left:auto;margin-right:auto;',
60 'right' => 'float:right;'
61 )
62 );
63
64 // @align for hr -----------------------------------------------
65 $r['hr@align'] =
67 'align',
68 array(
69 // we use both text-align and margin because these work
70 // for different browsers (IE and Firefox, respectively)
71 // and the melange makes for a pretty cross-compatible
72 // solution
73 'left' => 'margin-left:0;margin-right:auto;text-align:left;',
74 'center' => 'margin-left:auto;margin-right:auto;text-align:center;',
75 'right' => 'margin-left:auto;margin-right:0;text-align:right;'
76 )
77 );
78
79 // @align for h1, h2, h3, h4, h5, h6, p, div ----------------------
80 // {{{
81 $align_lookup = array();
82 $align_values = array('left', 'right', 'center', 'justify');
83 foreach ($align_values as $v) {
84 $align_lookup[$v] = "text-align:$v;";
85 }
86 // }}}
87 $r['h1@align'] =
88 $r['h2@align'] =
89 $r['h3@align'] =
90 $r['h4@align'] =
91 $r['h5@align'] =
92 $r['h6@align'] =
93 $r['p@align'] =
94 $r['div@align'] =
95 new HTMLPurifier_AttrTransform_EnumToCSS('align', $align_lookup);
96
97 // @bgcolor for table, tr, td, th ---------------------------------
98 $r['table@bgcolor'] =
99 $r['td@bgcolor'] =
100 $r['th@bgcolor'] =
102
103 // @border for img ------------------------------------------------
104 $r['img@border'] = new HTMLPurifier_AttrTransform_Border();
105
106 // @clear for br --------------------------------------------------
107 $r['br@clear'] =
109 'clear',
110 array(
111 'left' => 'clear:left;',
112 'right' => 'clear:right;',
113 'all' => 'clear:both;',
114 'none' => 'clear:none;',
115 )
116 );
117
118 // @height for td, th ---------------------------------------------
119 $r['td@height'] =
120 $r['th@height'] =
122
123 // @hspace for img ------------------------------------------------
124 $r['img@hspace'] = new HTMLPurifier_AttrTransform_ImgSpace('hspace');
125
126 // @noshade for hr ------------------------------------------------
127 // this transformation is not precise but often good enough.
128 // different browsers use different styles to designate noshade
129 $r['hr@noshade'] =
131 'noshade',
132 'color:#808080;background-color:#808080;border:0;'
133 );
134
135 // @nowrap for td, th ---------------------------------------------
136 $r['td@nowrap'] =
137 $r['th@nowrap'] =
139 'nowrap',
140 'white-space:nowrap;'
141 );
142
143 // @size for hr --------------------------------------------------
144 $r['hr@size'] = new HTMLPurifier_AttrTransform_Length('size', 'height');
145
146 // @type for li, ol, ul -------------------------------------------
147 // {{{
148 $ul_types = array(
149 'disc' => 'list-style-type:disc;',
150 'square' => 'list-style-type:square;',
151 'circle' => 'list-style-type:circle;'
152 );
153 $ol_types = array(
154 '1' => 'list-style-type:decimal;',
155 'i' => 'list-style-type:lower-roman;',
156 'I' => 'list-style-type:upper-roman;',
157 'a' => 'list-style-type:lower-alpha;',
158 'A' => 'list-style-type:upper-alpha;'
159 );
160 $li_types = $ul_types + $ol_types;
161 // }}}
162
163 $r['ul@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ul_types);
164 $r['ol@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ol_types, true);
165 $r['li@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $li_types, true);
166
167 // @vspace for img ------------------------------------------------
168 $r['img@vspace'] = new HTMLPurifier_AttrTransform_ImgSpace('vspace');
169
170 // @width for hr, td, th ------------------------------------------
171 $r['td@width'] =
172 $r['th@width'] =
173 $r['hr@width'] = new HTMLPurifier_AttrTransform_Length('width');
174
175 return $r;
176 }
Pre-transform that changes deprecated bgcolor attribute to CSS.
Definition: BgColor.php:7
Pre-transform that changes converts a boolean attribute to fixed CSS.
Definition: BoolToCSS.php:7
Pre-transform that changes deprecated border attribute to CSS.
Definition: Border.php:7
Generic pre-transform that converts an attribute with a fixed number of values (enumerated) to CSS.
Definition: EnumToCSS.php:8
Pre-transform that changes deprecated hspace and vspace attributes to CSS.
Definition: ImgSpace.php:7
Class for handling width/height length attribute transformations to CSS.
Definition: Length.php:7
Transforms FONT tags to the proper form (SPAN with CSS styling)
Definition: Font.php:19
Simple transformation, just change tag name to something else, and possibly add some styling.
Definition: Simple.php:9
$r
Definition: example_031.php:79

References $r.


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