Bug #14988 » parsehtml.diff
class.t3lib_parsehtml.php 2006-08-22 09:01:12.000000000 +0200 | ||
---|---|---|
* @return string Processed HTML content
|
||
*/
|
||
function HTMLcleaner($content, $tags=array(),$keepAll=0,$hSC=0,$addConfig=array()) {
|
||
$bCdataFound = false;
|
||
$newContent = array();
|
||
$tokArr = explode('<',$content);
|
||
$newContent[] = $this->processContent(current($tokArr),$hSC,$addConfig);
|
||
... | ... | |
$c = 1;
|
||
$tagRegister = array();
|
||
$tagStack = array();
|
||
while(list(,$tok)=each($tokArr)) {
|
||
while(list(,$tok)=each($tokArr)) {
|
||
$bIsTag = false;
|
||
$firstChar = substr($tok,0,1);
|
||
# if (strcmp(trim($firstChar),'')) { // It is a tag...
|
||
if (preg_match('/[[:alnum:]\/]/',$firstChar)==1) { // It is a tag... (first char is a-z0-9 or /) (fixed 19/01 2004). This also avoids triggering on <?xml..> and <!DOCTYPE..>
|
||
if ($bCdataFound) {
|
||
$cdataEnd = (strrpos($tok,'/*]]>*/') !== FALSE);
|
||
if ($cdataEnd) {
|
||
$bCdataFound = false;
|
||
}
|
||
} else {
|
||
if ($tok == '![CDATA[*/') {
|
||
$bCdataFound = true;
|
||
} else {
|
||
$bIsTag = preg_match('/[[:alnum:]\/]/',$firstChar)==1; // It is a tag... (first char is a-z0-9 or /) (fixed 19/01 2004). This also avoids triggering on <?xml..> and <!DOCTYPE..>
|
||
}
|
||
}
|
||
if ($bIsTag) {
|
||
$tagEnd = strpos($tok,'>');
|
||
if ($tagEnd) { // If there is and end-bracket... tagEnd can't be 0 as the first character can't be a >
|
||
$endTag = $firstChar=='/' ? 1 : 0;
|
||
... | ... | |
}
|
||
}
|
||
return implode('',$newContent);
|
||
$rc = implode('',$newContent);
|
||
return $rc;
|
||
}
|
||
/**
|