summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-11-13 00:24:15 +0300
committerAndrew Dolgov <[email protected]>2010-11-13 00:24:15 +0300
commit3f770c87782c0c5b06f3fff89653e951ff040c19 (patch)
treee285d25c7729dc9c179988299d2d535f58a140f7
parentfbc95c5b7055da76ae6f0ba373b686309859ddde (diff)
sanitize_rss: only insert linebreak after first img
-rw-r--r--functions.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/functions.php b/functions.php
index 479915700..1281d59fe 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;
+ }
}
}