Project

General

Profile

Bug #17750 ยป 6642_4.1.3.patch

Administrator Admin, 2007-11-03 15:00

View differences:

class.t3lib_parsehtml_proc.php 2007-11-03 14:15:00.000000000 +0100
if (count($newAttribs) && strcmp($remapParagraphTag,'1')) {
if ($remapParagraphTag=='P') $tagName='p';
if ($remapParagraphTag=='DIV') $tagName='div';
$subLines[$sk]='<'.trim($tagName.' '.$this->compileTagAttribs($newAttribs)).'>'.$subLines[$sk].'</'.$tagName.'>';
// If a paragraph tag is to be set (i.e. newAttribs are there), but its children contain no text nodes at all (the following else switch),
// then add a &nbsp; after the subLines part within the paragraph tag (that is: create a text node containing just a &nbsp;).
// Reason: RTE htmlarea (maybe others?) are not able to show empty <p $newAttribs></p> sections,
// so better avoid non rte-editable parts by adding a &nbsp; and have <p $newAttribs>&nbsp;</p> instead.
// This should better be done within the corresponding RTE's code...
// Doing this when tables or images are in the line might render to unexpected results; they are skipped here.
if (trim(strip_tags($subLines[$sk],'<img><table><tr><td>'))) {
$subLines[$sk]='<'.trim($tagName.' '.$this->compileTagAttribs($newAttribs)).'>'.$subLines[$sk].'</'.$tagName.'>';
} else {
$subLines[$sk]='<'.trim($tagName.' '.$this->compileTagAttribs($newAttribs)).'>'.$subLines[$sk].'&nbsp;</'.$tagName.'>';
}
}
}
}
......
// If it turns out the line is just blank (containing a &nbsp; possibly) then just make it pure blank:
if (trim(strip_tags($divSplit[$k]))=='&nbsp;' && !preg_match('/\<(img)(\s[^>]*)?\/?>/si', $divSplit[$k])) {
$divSplit[$k]='';
// Prevent filtering of lines that are blank in sense above, but whose tags contain attributes.
// Those attributes should have been filtered before; if they are still there they must be considered as possible content.
if (!preg_match('/\<([^>]*)?( align| class| style)([^>]*)?>/si', trim($divSplit[$k]))) {
$divSplit[$k]='';
}
}
} else { // outside div:
// Remove positions which are outside div/p tags and without content
    (1-1/1)