| | |
| | | $value .= ' ' . $val; |
| | | |
| | | // #1488535: Fix size units, so width:800 would be changed to width:800px |
| | | if (preg_match('/(left|right|top|bottom|width|height)/i', $cssid) |
| | | if (preg_match('/^(left|right|top|bottom|width|height)/i', $cssid) |
| | | && preg_match('/^[0-9]+$/', $val) |
| | | ) { |
| | | $value .= 'px'; |
| | |
| | | $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; |
| | | } |
| | | else if ($key == 'style' && ($style = $this->wash_style($value))) { |
| | | $quot = strpos($style, '"') !== false ? "'" : '"'; |
| | | $t .= ' style=' . $quot . $style . $quot; |
| | | // replace double quotes to prevent syntax error and XSS issues (#1490227) |
| | | $t .= ' style="' . str_replace('"', '"', $style) . '"'; |
| | | } |
| | | else if ($key == 'background' || ($key == 'src' && strtolower($node->tagName) == 'img')) { //check tagName anyway |
| | | if (($src = $this->config['cid_map'][$value]) |
| | |
| | | $dump = ''; |
| | | |
| | | do { |
| | | switch($node->nodeType) { |
| | | switch ($node->nodeType) { |
| | | case XML_ELEMENT_NODE: //Check element |
| | | $tagName = strtolower($node->tagName); |
| | | if ($callback = $this->handlers[$tagName]) { |
| | |
| | | case XML_HTML_DOCUMENT_NODE: |
| | | $dump .= $this->dumpHtml($node, $level); |
| | | break; |
| | | |
| | | case XML_DOCUMENT_TYPE_NODE: |
| | | break; |
| | | |
| | | default: |
| | | $dump .= '<!-- node type ' . $node->nodeType . ' -->'; |
| | | } |
| | | } while($node = $node->nextSibling); |
| | | } |
| | | while($node = $node->nextSibling); |
| | | |
| | | return $dump; |
| | | } |
| | |
| | | // Remove invalid HTML comments (#1487759) |
| | | // Don't remove valid conditional comments |
| | | // Don't remove MSOutlook (<!-->) conditional comments (#1489004) |
| | | $html = preg_replace('/<!--[^->\[\n]+>/', '', $html); |
| | | $html = preg_replace('/<!--[^-<>\[\n]+>/', '', $html); |
| | | |
| | | // fix broken nested lists |
| | | self::fix_broken_lists($html); |