Whoops, forgot to edit WHATSNEW
[htmlpurifier.git] / library / HTMLPurifier / HTMLModule / Tables.php
blob8a0b3b46162cf1f43bd1244826a4f69813c5897b
1 <?php
3 /**
4 * XHTML 1.1 Tables Module, fully defines accessible table elements.
5 */
6 class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
8 /**
9 * @type string
11 public $name = 'Tables';
13 /**
14 * @param HTMLPurifier_Config $config
16 public function setup($config)
18 $this->addElement('caption', false, 'Inline', 'Common');
20 $this->addElement(
21 'table',
22 'Block',
23 new HTMLPurifier_ChildDef_Table(),
24 'Common',
25 array(
26 'border' => 'Pixels',
27 'cellpadding' => 'Length',
28 'cellspacing' => 'Length',
29 'frame' => 'Enum#void,above,below,hsides,lhs,rhs,vsides,box,border',
30 'rules' => 'Enum#none,groups,rows,cols,all',
31 'summary' => 'Text',
32 'width' => 'Length'
36 // common attributes
37 $cell_align = array(
38 'align' => 'Enum#left,center,right,justify,char',
39 'charoff' => 'Length',
40 'valign' => 'Enum#top,middle,bottom,baseline',
43 $cell_t = array_merge(
44 array(
45 'abbr' => 'Text',
46 'colspan' => 'Number',
47 'rowspan' => 'Number',
48 // Apparently, as of HTML5 this attribute only applies
49 // to 'th' elements.
50 'scope' => 'Enum#row,col,rowgroup,colgroup',
52 $cell_align
54 $this->addElement('td', false, 'Flow', 'Common', $cell_t);
55 $this->addElement('th', false, 'Flow', 'Common', $cell_t);
57 $this->addElement('tr', false, 'Required: td | th', 'Common', $cell_align);
59 $cell_col = array_merge(
60 array(
61 'span' => 'Number',
62 'width' => 'MultiLength',
64 $cell_align
66 $this->addElement('col', false, 'Empty', 'Common', $cell_col);
67 $this->addElement('colgroup', false, 'Optional: col', 'Common', $cell_col);
69 $this->addElement('tbody', false, 'Required: tr', 'Common', $cell_align);
70 $this->addElement('thead', false, 'Required: tr', 'Common', $cell_align);
71 $this->addElement('tfoot', false, 'Required: tr', 'Common', $cell_align);
75 // vim: et sw=4 sts=4