]> git.wh0rd.org - tt-rss.git/blob - lib/htmlpurifier/library/HTMLPurifier/HTMLModule/Tables.php
Revert "remove htmlpurifier"
[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 // Apparently, as of HTML5 this attribute only applies
41 // to 'th' elements.
42 'scope' => 'Enum#row,col,rowgroup,colgroup',
43 ),
44 $cell_align
45 );
46 $this->addElement('td', false, 'Flow', 'Common', $cell_t);
47 $this->addElement('th', false, 'Flow', 'Common', $cell_t);
48
49 $this->addElement('tr', false, 'Required: td | th', 'Common', $cell_align);
50
51 $cell_col = array_merge(
52 array(
53 'span' => 'Number',
54 'width' => 'MultiLength',
55 ),
56 $cell_align
57 );
58 $this->addElement('col', false, 'Empty', 'Common', $cell_col);
59 $this->addElement('colgroup', false, 'Optional: col', 'Common', $cell_col);
60
61 $this->addElement('tbody', false, 'Required: tr', 'Common', $cell_align);
62 $this->addElement('thead', false, 'Required: tr', 'Common', $cell_align);
63 $this->addElement('tfoot', false, 'Required: tr', 'Common', $cell_align);
64
65 }
66
67 }
68
69 // vim: et sw=4 sts=4