Release 2.0.1, merged in 1181 to HEAD.
[htmlpurifier.git] / library / HTMLPurifier / HTMLModule / Tables.php
blob2b2d41ce28324006043e85aa6fe7e2ad166238aa
1 <?php
3 require_once 'HTMLPurifier/HTMLModule.php';
4 require_once 'HTMLPurifier/ChildDef/Table.php';
6 /**
7 * XHTML 1.1 Tables Module, fully defines accessible table elements.
8 */
9 class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
12 var $name = 'Tables';
14 function HTMLPurifier_HTMLModule_Tables() {
16 $this->addElement('caption', true, false, 'Inline', 'Common');
18 $this->addElement('table', true, 'Block',
19 new HTMLPurifier_ChildDef_Table(), 'Common',
20 array(
21 'border' => 'Pixels',
22 'cellpadding' => 'Length',
23 'cellspacing' => 'Length',
24 'frame' => 'Enum#void,above,below,hsides,lhs,rhs,vsides,box,border',
25 'rules' => 'Enum#none,groups,rows,cols,all',
26 'summary' => 'Text',
27 'width' => 'Length'
31 // common attributes
32 $cell_align = array(
33 'align' => 'Enum#left,center,right,justify,char',
34 'charoff' => 'Length',
35 'valign' => 'Enum#top,middle,bottom,baseline',
38 $cell_t = array_merge(
39 array(
40 'abbr' => 'Text',
41 'colspan' => 'Number',
42 'rowspan' => 'Number',
44 $cell_align
46 $this->addElement('td', true, false, 'Flow', 'Common', $cell_t);
47 $this->addElement('th', true, false, 'Flow', 'Common', $cell_t);
49 $this->addElement('tr', true, false, 'Required: td | th', 'Common', $cell_align);
51 $cell_col = array_merge(
52 array(
53 'span' => 'Number',
54 'width' => 'MultiLength',
56 $cell_align
58 $this->addElement('col', true, false, 'Empty', 'Common', $cell_col);
59 $this->addElement('colgroup', true, false, 'Optional: col', 'Common', $cell_col);
61 $this->addElement('tbody', true, false, 'Required: tr', 'Common', $cell_align);
62 $this->addElement('thead', true, false, 'Required: tr', 'Common', $cell_align);
63 $this->addElement('tfoot', true, false, 'Required: tr', 'Common', $cell_align);