HTMLPurifier 4.4.0
/home/ezyang/Dev/htmlpurifier/library/HTMLPurifier/HTMLModule/Tables.php
Go to the documentation of this file.
00001 <?php
00002 
00006 class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
00007 {
00008 
00009     public $name = 'Tables';
00010 
00011     public function setup($config) {
00012 
00013         $this->addElement('caption', false, 'Inline', 'Common');
00014 
00015         $this->addElement('table', 'Block',
00016             new HTMLPurifier_ChildDef_Table(),  'Common',
00017             array(
00018                 'border' => 'Pixels',
00019                 'cellpadding' => 'Length',
00020                 'cellspacing' => 'Length',
00021                 'frame' => 'Enum#void,above,below,hsides,lhs,rhs,vsides,box,border',
00022                 'rules' => 'Enum#none,groups,rows,cols,all',
00023                 'summary' => 'Text',
00024                 'width' => 'Length'
00025             )
00026         );
00027 
00028         // common attributes
00029         $cell_align = array(
00030             'align' => 'Enum#left,center,right,justify,char',
00031             'charoff' => 'Length',
00032             'valign' => 'Enum#top,middle,bottom,baseline',
00033         );
00034 
00035         $cell_t = array_merge(
00036             array(
00037                 'abbr'    => 'Text',
00038                 'colspan' => 'Number',
00039                 'rowspan' => 'Number',
00040                 // Apparently, as of HTML5 this attribute only applies
00041                 // to 'th' elements.
00042                 'scope'   => 'Enum#row,col,rowgroup,colgroup',
00043             ),
00044             $cell_align
00045         );
00046         $this->addElement('td', false, 'Flow', 'Common', $cell_t);
00047         $this->addElement('th', false, 'Flow', 'Common', $cell_t);
00048 
00049         $this->addElement('tr', false, 'Required: td | th', 'Common', $cell_align);
00050 
00051         $cell_col = array_merge(
00052             array(
00053                 'span'  => 'Number',
00054                 'width' => 'MultiLength',
00055             ),
00056             $cell_align
00057         );
00058         $this->addElement('col',      false, 'Empty',         'Common', $cell_col);
00059         $this->addElement('colgroup', false, 'Optional: col', 'Common', $cell_col);
00060 
00061         $this->addElement('tbody', false, 'Required: tr', 'Common', $cell_align);
00062         $this->addElement('thead', false, 'Required: tr', 'Common', $cell_align);
00063         $this->addElement('tfoot', false, 'Required: tr', 'Common', $cell_align);
00064 
00065     }
00066 
00067 }
00068 
00069 // vim: et sw=4 sts=4