From: Andrew Dolgov Date: Fri, 12 Nov 2010 21:24:15 +0000 (+0300) Subject: sanitize_rss: only insert linebreak after first img X-Git-Tag: 1.5.0~250 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=3f770c87782c0c5b06f3fff89653e951ff040c19;p=tt-rss.git sanitize_rss: only insert linebreak after first img --- diff --git a/functions.php b/functions.php index 47991570..1281d59f 100644 --- a/functions.php +++ b/functions.php @@ -3748,6 +3748,7 @@ $xpath = new DOMXPath($doc); $entries = $xpath->query('(//a[@href]|//img[@src])'); + $br_inserted = 0; foreach ($entries as $entry) { @@ -3768,11 +3769,13 @@ } } - if (strtolower($entry->nodeName) == "img") { + if (strtolower($entry->nodeName) == "img" && !$br_inserted) { $br = $doc->createElement("br"); - if ($entry->parentNode->nextSibling) + if ($entry->parentNode->nextSibling) { $entry->parentNode->insertBefore($br, $entry->nextSibling); + $br_inserted = 1; + } } }