Changeset 503e019 in github


Ignore:
Timestamp:
Jul 17, 2009 3:32:59 AM (4 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
77edef7
Parents:
881217a
Message:
  • Fix HTML messages output with empty block elements (#1485974)
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r19862b55 r503e019  
    22=========================== 
    33 
     4- Fix HTML messages output with empty block elements (#1485974) 
    45- Added hook when killing a session 
    56- Added hook to write_log function (#1485971) 
  • program/lib/washtml.php

    rf7fff8f r503e019  
    8282  /* Allowed HTML attributes */ 
    8383  static $html_attribs = array('name', 'class', 'title', 'alt', 'width', 'height', 'align', 'nowrap', 'col', 'row', 'id', 'rowspan', 'colspan', 'cellspacing', 'cellpadding', 'valign', 'bgcolor', 'color', 'border', 'bordercolorlight', 'bordercolordark', 'face', 'marginwidth', 'marginheight', 'axis', 'border', 'abbr', 'char', 'charoff', 'clear', 'compact', 'coords', 'vspace', 'hspace', 'cellborder', 'size', 'lang', 'dir');   
     84 
     85  /* Block elements which could be empty but cannot be returned in short form (<tag />) */ 
     86  static $block_elements = array('div', 'p', 'pre', 'blockquote'); 
    8487   
    8588  /* State for linked objects in HTML */ 
     
    97100  /* Ignore these HTML tags but process their content */ 
    98101  private $_ignore_elements = array(); 
     102 
     103  /* Block elements which could be empty but cannot be returned in short form (<tag />) */ 
     104  private $_block_elements = array(); 
    99105 
    100106  /* Allowed HTML attributes */ 
     
    107113    $this->_html_attribs = array_flip((array)$p['html_attribs']) + array_flip(self::$html_attribs); 
    108114    $this->_ignore_elements = array_flip((array)$p['ignore_elements']) + array_flip(self::$ignore_elements); 
    109     unset($p['html_elements'], $p['html_attribs'], $p['ignore_elements']); 
     115    $this->_block_elements = array_flip((array)$p['block_elements']) + array_flip(self::$block_elements); 
     116    unset($p['html_elements'], $p['html_attribs'], $p['ignore_elements'], $p['block_elements']); 
    110117    $this->config = $p + array('show_washed'=>true, 'allow_remote'=>false, 'cid_map'=>array()); 
    111118  } 
     
    203210          $content = $this->dumpHtml($node); 
    204211          $dump .= '<' . $tagName . $this->wash_attribs($node) . 
    205             ($content?">$content</$tagName>":' />'); 
     212//            ($content?">$content</$tagName>":' />'); 
     213// Roundcube Trac: #1485974 
     214            ($content || isset($this->_block_elements[$tagName]) ? ">$content</$tagName>" : ' />'); 
    206215        } else if(isset($this->_ignore_elements[$tagName])) { 
    207216          $dump .= '<!-- ' . htmlspecialchars($tagName, ENT_QUOTES) . ' ignored -->'; 
Note: See TracChangeset for help on using the changeset viewer.