friendica/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tables.php

76 lines
2.3 KiB
PHP
Raw Normal View History

2010-09-08 23:14:17 -04:00
<?php
/**
* XHTML 1.1 Tables Module, fully defines accessible table elements.
*/
class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
{
2016-02-09 05:06:17 -05:00
/**
* @type string
*/
2010-09-08 23:14:17 -04:00
public $name = 'Tables';
2016-02-09 05:06:17 -05:00
/**
* @param HTMLPurifier_Config $config
*/
public function setup($config)
{
2010-09-08 23:14:17 -04:00
$this->addElement('caption', false, 'Inline', 'Common');
2016-02-09 05:06:17 -05:00
$this->addElement(
'table',
'Block',
new HTMLPurifier_ChildDef_Table(),
'Common',
2010-09-08 23:14:17 -04:00
array(
'border' => 'Pixels',
'cellpadding' => 'Length',
'cellspacing' => 'Length',
'frame' => 'Enum#void,above,below,hsides,lhs,rhs,vsides,box,border',
'rules' => 'Enum#none,groups,rows,cols,all',
'summary' => 'Text',
'width' => 'Length'
)
);
// common attributes
$cell_align = array(
'align' => 'Enum#left,center,right,justify,char',
'charoff' => 'Length',
'valign' => 'Enum#top,middle,bottom,baseline',
);
$cell_t = array_merge(
array(
2016-02-09 05:06:17 -05:00
'abbr' => 'Text',
2010-09-08 23:14:17 -04:00
'colspan' => 'Number',
'rowspan' => 'Number',
2016-02-09 05:06:17 -05:00
// Apparently, as of HTML5 this attribute only applies
// to 'th' elements.
'scope' => 'Enum#row,col,rowgroup,colgroup',
2010-09-08 23:14:17 -04:00
),
$cell_align
);
$this->addElement('td', false, 'Flow', 'Common', $cell_t);
$this->addElement('th', false, 'Flow', 'Common', $cell_t);
$this->addElement('tr', false, 'Required: td | th', 'Common', $cell_align);
$cell_col = array_merge(
array(
2016-02-09 05:06:17 -05:00
'span' => 'Number',
2010-09-08 23:14:17 -04:00
'width' => 'MultiLength',
),
$cell_align
);
2016-02-09 05:06:17 -05:00
$this->addElement('col', false, 'Empty', 'Common', $cell_col);
2010-09-08 23:14:17 -04:00
$this->addElement('colgroup', false, 'Optional: col', 'Common', $cell_col);
$this->addElement('tbody', false, 'Required: tr', 'Common', $cell_align);
$this->addElement('thead', false, 'Required: tr', 'Common', $cell_align);
$this->addElement('tfoot', false, 'Required: tr', 'Common', $cell_align);
}
}
// vim: et sw=4 sts=4