4 * This handles 'td' tags (and puts nice borders on them.)
8 require_once 'Block.php';
9 class HTML_Clean_BlockTd extends HTML_Clean_Block
11 var $width = ''; // should be a percent.!
12 var $textAlign = 'left';
20 function __construct($cfg) {
23 $this->readElement($cfg['node']);
24 $this->updateElement($cfg['node']);
26 parent::__construct();
35 'valign' => $this->valign,
37 'text-align' => $this->textAlign,
38 'border' => 'solid 1px rgb(0, 0, 0)', // ??? hard coded?
39 'border-collapse' => 'collapse',
40 'padding' => '6px', // 8 for desktop / 4 for mobile
41 'vertical-align'=> $this->valign
45 if ($this->width != '') {
46 $ret->width = $this->width;
47 $ret['style']['width'] = $this->width;
51 if ($this->colspan > 1) {
52 $ret['colspan'] = $this->colspan ;
54 if ($this->rowspan > 1) {
55 $ret['rowspan'] = $this->rowspan ;
65 function readElement ($node)
67 $node = $node ? $node : $this->node ;
70 $this->width = $node->getAttribute('width');
71 $this->colspan = max(1,1*$node->getAttribute('colspan'));
72 $this->rowspan = max(1,1*$node->getAttribute('rowspan'));
73 $this->html = $this->innerHTML($node);
74 $styles = $this->styleToObject($node,true);
76 if (!empty($styles['text-align'])) {
77 $this->textAlign = $styles['text-align'];
79 if ($node->hasAttribute('valign')) {
80 $this->valign = $node->getAttribute('valign');