From 3f770c87782c0c5b06f3fff89653e951ff040c19 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 13 Nov 2010 00:24:15 +0300 Subject: [PATCH] sanitize_rss: only insert linebreak after first img --- functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; + } } } -- 2.39.5