Changeset 9082bf1 in github for program/lib/washtml.php
- Timestamp:
- May 12, 2012 5:27:59 AM (13 months ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo
- Children:
- 1c9e571
- Parents:
- 4abcbd4
- File:
-
- 1 edited
-
program/lib/washtml.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/lib/washtml.php
rf38dfc29 r9082bf1 109 109 /* Block elements which could be empty but cannot be returned in short form (<tag />) */ 110 110 static $block_elements = array('div', 'p', 'pre', 'blockquote', 'a', 'font', 'center', 111 'table', 'ul', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'dl', 'strong', 'i', 'b', 'u' );111 'table', 'ul', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'dl', 'strong', 'i', 'b', 'u', 'span'); 112 112 113 113 /* State for linked objects in HTML */ … … 134 134 135 135 /* Constructor */ 136 public function __construct($p = array()) { 136 public function __construct($p = array()) 137 { 137 138 $this->_html_elements = array_flip((array)$p['html_elements']) + array_flip(self::$html_elements) ; 138 139 $this->_html_attribs = array_flip((array)$p['html_attribs']) + array_flip(self::$html_attribs); … … 150 151 151 152 /* Check CSS style */ 152 private function wash_style($style) { 153 private function wash_style($style) 154 { 153 155 $s = ''; 154 156 … … 192 194 193 195 /* Take a node and return allowed attributes and check values */ 194 private function wash_attribs($node) { 196 private function wash_attribs($node) 197 { 195 198 $t = ''; 196 199 $washed; … … 232 235 * It output only allowed tags with allowed attributes 233 236 * and allowed inline styles */ 234 private function dumpHtml($node) { 237 private function dumpHtml($node) 238 { 235 239 if(!$node->hasChildNodes()) 236 240 return ''; … … 249 253 $content = $this->dumpHtml($node); 250 254 $dump .= '<' . $tagName . $this->wash_attribs($node) . 251 // create closing tag for block elements, but also for elements 252 // with content or with some attributes (eg. style, class) (#1486812) 253 ($content != '' || $node->hasAttributes() || isset($this->_block_elements[$tagName]) ? ">$content</$tagName>" : ' />'); 255 ($content != '' || isset($this->_block_elements[$tagName]) ? ">$content</$tagName>" : ' />'); 254 256 } 255 257 else if (isset($this->_ignore_elements[$tagName])) { … … 311 313 312 314 } 313 314 ?>
Note: See TracChangeset
for help on using the changeset viewer.
