Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / CSSDefinition.php
blob23a66ab76af98392f855ac6b57fc24ba40b77dd9
1 <?php
3 require_once 'HTMLPurifier/AttrDef/CSS/Background.php';
4 require_once 'HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
5 require_once 'HTMLPurifier/AttrDef/CSS/Border.php';
6 require_once 'HTMLPurifier/AttrDef/CSS/Color.php';
7 require_once 'HTMLPurifier/AttrDef/CSS/Composite.php';
8 require_once 'HTMLPurifier/AttrDef/CSS/Font.php';
9 require_once 'HTMLPurifier/AttrDef/CSS/FontFamily.php';
10 require_once 'HTMLPurifier/AttrDef/CSS/Length.php';
11 require_once 'HTMLPurifier/AttrDef/CSS/ListStyle.php';
12 require_once 'HTMLPurifier/AttrDef/CSS/Multiple.php';
13 require_once 'HTMLPurifier/AttrDef/CSS/Percentage.php';
14 require_once 'HTMLPurifier/AttrDef/CSS/TextDecoration.php';
15 require_once 'HTMLPurifier/AttrDef/CSS/URI.php';
16 require_once 'HTMLPurifier/AttrDef/Enum.php';
18 /**
19 * Defines allowed CSS attributes and what their values are.
20 * @see HTMLPurifier_HTMLDefinition
22 class HTMLPurifier_CSSDefinition
25 /**
26 * Assoc array of attribute name to definition object.
28 var $info = array();
30 /**
31 * Constructs the info array. The meat of this class.
33 function setup($config) {
35 $this->info['text-align'] = new HTMLPurifier_AttrDef_Enum(
36 array('left', 'right', 'center', 'justify'), false);
38 $border_style =
39 $this->info['border-bottom-style'] =
40 $this->info['border-right-style'] =
41 $this->info['border-left-style'] =
42 $this->info['border-top-style'] = new HTMLPurifier_AttrDef_Enum(
43 array('none', 'hidden', 'dotted', 'dashed', 'solid', 'double',
44 'groove', 'ridge', 'inset', 'outset'), false);
46 $this->info['border-style'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_style);
48 $this->info['clear'] = new HTMLPurifier_AttrDef_Enum(
49 array('none', 'left', 'right', 'both'), false);
50 $this->info['float'] = new HTMLPurifier_AttrDef_Enum(
51 array('none', 'left', 'right'), false);
52 $this->info['font-style'] = new HTMLPurifier_AttrDef_Enum(
53 array('normal', 'italic', 'oblique'), false);
54 $this->info['font-variant'] = new HTMLPurifier_AttrDef_Enum(
55 array('normal', 'small-caps'), false);
57 $uri_or_none = new HTMLPurifier_AttrDef_CSS_Composite(
58 array(
59 new HTMLPurifier_AttrDef_Enum(array('none')),
60 new HTMLPurifier_AttrDef_CSS_URI()
64 $this->info['list-style-position'] = new HTMLPurifier_AttrDef_Enum(
65 array('inside', 'outside'), false);
66 $this->info['list-style-type'] = new HTMLPurifier_AttrDef_Enum(
67 array('disc', 'circle', 'square', 'decimal', 'lower-roman',
68 'upper-roman', 'lower-alpha', 'upper-alpha', 'none'), false);
69 $this->info['list-style-image'] = $uri_or_none;
71 $this->info['list-style'] = new HTMLPurifier_AttrDef_CSS_ListStyle($config);
73 $this->info['text-transform'] = new HTMLPurifier_AttrDef_Enum(
74 array('capitalize', 'uppercase', 'lowercase', 'none'), false);
75 $this->info['color'] = new HTMLPurifier_AttrDef_CSS_Color();
77 $this->info['background-image'] = $uri_or_none;
78 $this->info['background-repeat'] = new HTMLPurifier_AttrDef_Enum(
79 array('repeat', 'repeat-x', 'repeat-y', 'no-repeat')
81 $this->info['background-attachment'] = new HTMLPurifier_AttrDef_Enum(
82 array('scroll', 'fixed')
84 $this->info['background-position'] = new HTMLPurifier_AttrDef_CSS_BackgroundPosition();
86 $border_color =
87 $this->info['border-top-color'] =
88 $this->info['border-bottom-color'] =
89 $this->info['border-left-color'] =
90 $this->info['border-right-color'] =
91 $this->info['background-color'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
92 new HTMLPurifier_AttrDef_Enum(array('transparent')),
93 new HTMLPurifier_AttrDef_CSS_Color()
94 ));
96 $this->info['background'] = new HTMLPurifier_AttrDef_CSS_Background($config);
98 $this->info['border-color'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_color);
100 $border_width =
101 $this->info['border-top-width'] =
102 $this->info['border-bottom-width'] =
103 $this->info['border-left-width'] =
104 $this->info['border-right-width'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
105 new HTMLPurifier_AttrDef_Enum(array('thin', 'medium', 'thick')),
106 new HTMLPurifier_AttrDef_CSS_Length(true) //disallow negative
109 $this->info['border-width'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_width);
111 $this->info['letter-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
112 new HTMLPurifier_AttrDef_Enum(array('normal')),
113 new HTMLPurifier_AttrDef_CSS_Length()
116 $this->info['word-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
117 new HTMLPurifier_AttrDef_Enum(array('normal')),
118 new HTMLPurifier_AttrDef_CSS_Length()
121 $this->info['font-size'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
122 new HTMLPurifier_AttrDef_Enum(array('xx-small', 'x-small',
123 'small', 'medium', 'large', 'x-large', 'xx-large',
124 'larger', 'smaller')),
125 new HTMLPurifier_AttrDef_CSS_Percentage(),
126 new HTMLPurifier_AttrDef_CSS_Length()
129 $this->info['line-height'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
130 new HTMLPurifier_AttrDef_Enum(array('normal')),
131 new HTMLPurifier_AttrDef_CSS_Number(true), // no negatives
132 new HTMLPurifier_AttrDef_CSS_Length(true),
133 new HTMLPurifier_AttrDef_CSS_Percentage(true)
136 $margin =
137 $this->info['margin-top'] =
138 $this->info['margin-bottom'] =
139 $this->info['margin-left'] =
140 $this->info['margin-right'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
141 new HTMLPurifier_AttrDef_CSS_Length(),
142 new HTMLPurifier_AttrDef_CSS_Percentage(),
143 new HTMLPurifier_AttrDef_Enum(array('auto'))
146 $this->info['margin'] = new HTMLPurifier_AttrDef_CSS_Multiple($margin);
148 // non-negative
149 $padding =
150 $this->info['padding-top'] =
151 $this->info['padding-bottom'] =
152 $this->info['padding-left'] =
153 $this->info['padding-right'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
154 new HTMLPurifier_AttrDef_CSS_Length(true),
155 new HTMLPurifier_AttrDef_CSS_Percentage(true)
158 $this->info['padding'] = new HTMLPurifier_AttrDef_CSS_Multiple($padding);
160 $this->info['text-indent'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
161 new HTMLPurifier_AttrDef_CSS_Length(),
162 new HTMLPurifier_AttrDef_CSS_Percentage()
165 $this->info['width'] =
166 $this->info['height'] =
167 new HTMLPurifier_AttrDef_CSS_Composite(array(
168 new HTMLPurifier_AttrDef_CSS_Length(true),
169 new HTMLPurifier_AttrDef_CSS_Percentage(true),
170 new HTMLPurifier_AttrDef_Enum(array('auto'))
173 $this->info['text-decoration'] = new HTMLPurifier_AttrDef_CSS_TextDecoration();
175 $this->info['font-family'] = new HTMLPurifier_AttrDef_CSS_FontFamily();
177 // this could use specialized code
178 $this->info['font-weight'] = new HTMLPurifier_AttrDef_Enum(
179 array('normal', 'bold', 'bolder', 'lighter', '100', '200', '300',
180 '400', '500', '600', '700', '800', '900'), false);
182 // MUST be called after other font properties, as it references
183 // a CSSDefinition object
184 $this->info['font'] = new HTMLPurifier_AttrDef_CSS_Font($config);
186 // same here
187 $this->info['border'] =
188 $this->info['border-bottom'] =
189 $this->info['border-top'] =
190 $this->info['border-left'] =
191 $this->info['border-right'] = new HTMLPurifier_AttrDef_CSS_Border($config);
193 $this->info['border-collapse'] = new HTMLPurifier_AttrDef_Enum(array(
194 'collapse', 'seperate'));
196 $this->info['caption-side'] = new HTMLPurifier_AttrDef_Enum(array(
197 'top', 'bottom'));
199 $this->info['table-layout'] = new HTMLPurifier_AttrDef_Enum(array(
200 'auto', 'fixed'));
202 $this->info['vertical-align'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
203 new HTMLPurifier_AttrDef_Enum(array('baseline', 'sub', 'super',
204 'top', 'text-top', 'middle', 'bottom', 'text-bottom')),
205 new HTMLPurifier_AttrDef_CSS_Length(),
206 new HTMLPurifier_AttrDef_CSS_Percentage()
209 // partial support
210 $this->info['white-space'] = new HTMLPurifier_AttrDef_Enum(array('nowrap'));