]> git.wh0rd.org - tt-rss.git/blob - lib/htmlpurifier/library/HTMLPurifier/HTMLModule/Tables.php
f314ced3f82ea6e36346d057f6404252b78c74f1
[tt-rss.git] / lib / htmlpurifier / library / HTMLPurifier / HTMLModule / Tables.php
1 <?php
2
3 /**
4 * XHTML 1.1 Tables Module, fully defines accessible table elements.
5 */
6 class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
7 {
8
9 public $name = 'Tables';
10
11 public function setup($config) {
12
13 $this->addElement('caption', false, 'Inline', 'Common');
14
15 $this->addElement('table', 'Block',
16 new HTMLPurifier_ChildDef_Table(), 'Common',
17 array(
18 'border' => 'Pixels',
19 'cellpadding' => 'Length',
20 'cellspacing' => 'Length',
21 'frame' => 'Enum#void,above,below,hsides,lhs,rhs,vsides,box,border',
22 'rules' => 'Enum#none,groups,rows,cols,all',
23 'summary' => 'Text',
24 'width' => 'Length'
25 )
26 );
27
28 // common attributes
29 $cell_align = array(
30 'align' => 'Enum#left,center,right,justify,char',
31 'charoff' => 'Length',
32 'valign' => 'Enum#top,middle,bottom,baseline',
33 );
34
35 $cell_t = array_merge(
36 array(
37 'abbr' => 'Text',
38 'colspan' => 'Number',
39 'rowspan' => 'Number',
40 ),
41 $cell_align
42 );
43 $this->addElement('td', false, 'Flow', 'Common', $cell_t);
44 $this->addElement('th', false, 'Flow', 'Common', $cell_t);
45
46 $this->addElement('tr', false, 'Required: td | th', 'Common', $cell_align);
47
48 $cell_col = array_merge(
49 array(
50 'span' => 'Number',
51 'width' => 'MultiLength',
52 ),
53 $cell_align
54 );
55 $this->addElement('col', false, 'Empty', 'Common', $cell_col);
56 $this->addElement('colgroup', false, 'Optional: col', 'Common', $cell_col);
57
58 $this->addElement('tbody', false, 'Required: tr', 'Common', $cell_align);
59 $this->addElement('thead', false, 'Required: tr', 'Common', $cell_align);
60 $this->addElement('tfoot', false, 'Required: tr', 'Common', $cell_align);
61
62 }
63
64 }
65
66 // vim: et sw=4 sts=4