Bug #15396
closedclass.indexer.php - problem with removing the scripting and style stuff in function embracingTags
0%
Description
Hi,
I had 2 script sections in my template file and the function embracingTags() called from splitHTMLContent() removed all the content between the start of the first javascript and the end of the second one:
$tagList = explode(',',$this->excludeSections);
reset($tagList);
while(list(,$tag)=each($tagList)) {
while($this->embracingTags($contentArr['body'],$tag,$dummy,$contentArr['body'],$dummy2));
}
In my case the removed content was all the content parts :(
I replaced the above code with a regexp:
$tagList = explode(',',$this->excludeSections);
reset($tagList);
$i = 0;
while(list(,$tag)=each($tagList)) {
$search[$i] = "'<" . $tag . "[^>]*?>.*?" . $tag . ">'si";
$replace[$i] = "";
$i++;
}
$search[$i] = "'<[\/\!]*?[^<>]*?>'si"; // Strip out html tags
$replace[$i] = "";
$i++;
$search[$i] = "'<[\!]*?[^<>]*?>'si"; // Strip out html comments
$replace[$i] = "";
$i++;
$search[$i] = "'&#(\d+);'e"; // evaluate as php
$replace[$i] = "chr(\\1)";
$i++;
$contentArr['body'] = preg_replace ($search, $replace, $contentArr['body']);
(issue imported from #M2240)
Files