File indexing completed on 2025-01-26 05:29:07
0001 <?php 0002 0003 /** 0004 * XHTML 1.1 Tables Module, fully defines accessible table elements. 0005 */ 0006 class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule 0007 { 0008 /** 0009 * @type string 0010 */ 0011 public $name = 'Tables'; 0012 0013 /** 0014 * @param HTMLPurifier_Config $config 0015 */ 0016 public function setup($config) 0017 { 0018 $this->addElement('caption', false, 'Inline', 'Common'); 0019 0020 $this->addElement( 0021 'table', 0022 'Block', 0023 new HTMLPurifier_ChildDef_Table(), 0024 'Common', 0025 array( 0026 'border' => 'Pixels', 0027 'cellpadding' => 'Length', 0028 'cellspacing' => 'Length', 0029 'frame' => 'Enum#void,above,below,hsides,lhs,rhs,vsides,box,border', 0030 'rules' => 'Enum#none,groups,rows,cols,all', 0031 'summary' => 'Text', 0032 'width' => 'Length' 0033 ) 0034 ); 0035 0036 // common attributes 0037 $cell_align = array( 0038 'align' => 'Enum#left,center,right,justify,char', 0039 'charoff' => 'Length', 0040 'valign' => 'Enum#top,middle,bottom,baseline', 0041 ); 0042 0043 $cell_t = array_merge( 0044 array( 0045 'abbr' => 'Text', 0046 'colspan' => 'Number', 0047 'rowspan' => 'Number', 0048 // Apparently, as of HTML5 this attribute only applies 0049 // to 'th' elements. 0050 'scope' => 'Enum#row,col,rowgroup,colgroup', 0051 ), 0052 $cell_align 0053 ); 0054 $this->addElement('td', false, 'Flow', 'Common', $cell_t); 0055 $this->addElement('th', false, 'Flow', 'Common', $cell_t); 0056 0057 $this->addElement('tr', false, 'Required: td | th', 'Common', $cell_align); 0058 0059 $cell_col = array_merge( 0060 array( 0061 'span' => 'Number', 0062 'width' => 'MultiLength', 0063 ), 0064 $cell_align 0065 ); 0066 $this->addElement('col', false, 'Empty', 'Common', $cell_col); 0067 $this->addElement('colgroup', false, 'Optional: col', 'Common', $cell_col); 0068 0069 $this->addElement('tbody', false, 'Required: tr', 'Common', $cell_align); 0070 $this->addElement('thead', false, 'Required: tr', 'Common', $cell_align); 0071 $this->addElement('tfoot', false, 'Required: tr', 'Common', $cell_align); 0072 } 0073 } 0074 0075 // vim: et sw=4 sts=4