Index: class.t3lib_parsehtml.php
===================================================================
RCS file: /cvsroot/typo3/TYPO3core/t3lib/class.t3lib_parsehtml.php,v
retrieving revision 1.24
diff -u -r1.24 class.t3lib_parsehtml.php
--- class.t3lib_parsehtml.php 19 Jun 2005 22:48:47 -0000 1.24
+++ class.t3lib_parsehtml.php 18 Oct 2005 07:39:14 -0000
@@ -599,6 +599,17 @@
*/
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);
@@ -782,8 +793,15 @@
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;
}
/**