Bug #22209 » typo3core_bugfix_13695_typo3_4-4_v2.patch
t3lib/class.t3lib_parsehtml.php (copie de travail) | ||
---|---|---|
class t3lib_parsehtml {
|
||
protected $caseShift_cache = array();
|
||
// Void elements that do not have closing tags, as defined by HTML5, except link element
|
||
const VOID_ELEMENTS = 'area|base|br|col|command|embed|hr|img|input|keygen|meta|param|source|track|wbr';
|
||
/**
|
||
* Returns the first subpart encapsulated in the marker, $marker
|
||
* (possibly present in $content as a HTML comment)
|
||
... | ... | |
$tagContent = substr($tok,$endTag,$tagEnd-$endTag);
|
||
$tagParts = preg_split('/\s+/s',$tagContent,2);
|
||
$tagName = strtolower($tagParts[0]);
|
||
if (isset($tags[$tagName])) {
|
||
if (is_array($tags[$tagName])) { // If there is processing to do for the tag:
|
||
if (!$endTag) { // If NOT an endtag, do attribute processing (added dec. 2003)
|
||
$emptyTag = 0;
|
||
if (isset($tags[$tagName])) {
|
||
if (is_array($tags[$tagName])) { // If there is processing to do for the tag:
|
||
if (preg_match('/^(' . self::VOID_ELEMENTS . ')$/i', $tagName)) {
|
||
$emptyTag = 1;
|
||
}
|
||
if (!$endTag) { // If NOT an endtag, do attribute processing (added dec. 2003)
|
||
// Override attributes
|
||
if (strcmp($tags[$tagName]['overrideAttribs'],'')) {
|
||
$tagParts[1]=$tags[$tagName]['overrideAttribs'];
|
||
... | ... | |
if ($tags[$tagName]['remap']) $tagParts[0] = $tags[$tagName]['remap'];
|
||
// rmTagIfNoAttrib
|
||
if ($endTag || trim($tagParts[1]) || !$tags[$tagName]['rmTagIfNoAttrib']) {
|
||
if ($endTag || trim($tagParts[1]) || !$tags[$tagName]['rmTagIfNoAttrib']) {
|
||
$setTag = 1;
|
||
// Remove this closing tag if $tagName was among $TSconfig['removeTags']
|
||
if ($endTag && $tags[$tagName]['allowedAttribs'] === 0 && $tags[$tagName]['rmTagIfNoAttrib'] === 1) {
|
||
... | ... | |
if ($setTag) {
|
||
// Setting the tag
|
||
$newContent[$c++]=$this->processTag($lt.($endTag?'/':'').trim($tagParts[0].' '.$tagParts[1]).$gt,$addConfig,$endTag,$lt=='<');
|
||
$newContent[$c++] = $this->processTag($lt . ($endTag ? '/' : '') . trim($tagParts[0] . ' ' . $tagParts[1]) . ($emptyTag ? ' /' : '' ) . $gt, $addConfig, $endTag, $lt == '<');
|
||
}
|
||
}
|
||
} else {
|