Project

General

Profile

Bug #14868 » 2005-10-18_bugfix_1292.patch

Administrator Admin, 2005-10-18 09:40

View differences:

class.t3lib_parsehtml.php 18 Oct 2005 07:39:14 -0000
*/
function HTMLcleaner($content, $tags=array(),$keepAll=0,$hSC=0,$addConfig=array()) {
$newContent = array();
//protect HTML comments from getting cleaned
$commentsFound = array();
$comments = array();
preg_match_all('/<!--.*?-->/s', $content, $commentsFound);
$i = 0;
foreach($commentsFound[0] as $comment) {
$comments[$i] = $comment;
$content = str_replace($comment, '###'.$i.'###', $content);
$i++;
}
$tokArr = explode('<',$content);
$newContent[] = $this->processContent(current($tokArr),$hSC,$addConfig);
next($tokArr);
......
unset($newContent[$pKey]);
}
}
return implode('',$newContent);
//replace markers with the according comments to preserve HTML comments (see the beginning of this function for the corresponding code)
$newContent = implode('',$newContent);
if(!empty($comments)) {
foreach($comments as $k => $comment) {
$newContent = str_replace('###'.$k.'###', $comment, $newContent);
}
}
return $newContent;
}
/**
(3-3/4)