Skip to content
Permalink
Browse files

Simple HTML DOM: Fixed strip of new-line character

  • Loading branch information...
LotarProject committed Mar 8, 2019
1 parent 00380da commit 6ba4f221f9efaba756131079380ba7874e84f8c8
Showing with 9 additions and 2 deletions.
  1. +9 −2 inc/simple_html_dom.php
@@ -1835,6 +1835,8 @@ class simple_html_dom
'tr' => array('td' => 1, 'th' => 1, 'tr' => 1),
);
protected $strip_rn = true;
function __construct(
$str = null,
$lowercase = true,
@@ -1902,6 +1904,8 @@ function load(
$this->size = strlen($this->doc);
}
$this->strip_rn = $stripRN;
// strip out cdata
$this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true);
// strip out comments
@@ -2507,8 +2511,11 @@ protected function parse_attr($node, $name, &$space)
}
// PaperG: Attributes should not have \r or \n in them, that counts as
// html whitespace.
$node->attr[$name] = str_replace("\r", '', $node->attr[$name]);
$node->attr[$name] = str_replace("\n", '', $node->attr[$name]);
// LotarProject: FIX for DokuWiki, preserve \r and \n for editor
if ($this->strip_rn) {
$node->attr[$name] = str_replace("\r", '', $node->attr[$name]);
$node->attr[$name] = str_replace("\n", '', $node->attr[$name]);
}
// PaperG: If this is a "class" selector, lets get rid of the preceeding
// and trailing space since some people leave it in the multi class case.
if ($name === 'class') {

0 comments on commit 6ba4f22

Please sign in to comment.
You can’t perform that action at this time.