sanitize_rss: only insert linebreak after first img
This commit is contained in:
parent
fbc95c5b70
commit
3f770c8778
|
@ -3748,6 +3748,7 @@
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
|
|
||||||
$entries = $xpath->query('(//a[@href]|//img[@src])');
|
$entries = $xpath->query('(//a[@href]|//img[@src])');
|
||||||
|
$br_inserted = 0;
|
||||||
|
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
|
|
||||||
|
@ -3768,11 +3769,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strtolower($entry->nodeName) == "img") {
|
if (strtolower($entry->nodeName) == "img" && !$br_inserted) {
|
||||||
$br = $doc->createElement("br");
|
$br = $doc->createElement("br");
|
||||||
|
|
||||||
if ($entry->parentNode->nextSibling)
|
if ($entry->parentNode->nextSibling) {
|
||||||
$entry->parentNode->insertBefore($br, $entry->nextSibling);
|
$entry->parentNode->insertBefore($br, $entry->nextSibling);
|
||||||
|
$br_inserted = 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue