]> git.wh0rd.org Git - tt-rss.git/commitdiff
sanitize_rss: only insert linebreak after first img
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 12 Nov 2010 21:24:15 +0000 (00:24 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 12 Nov 2010 21:24:15 +0000 (00:24 +0300)
functions.php

index 479915700ad7f14139fb91b3c07c4266f9586fa2..1281d59fe0634579ebc30eae8d91abbf8748b484 100644 (file)
                $xpath = new DOMXPath($doc);
        
                $entries = $xpath->query('(//a[@href]|//img[@src])');
+               $br_inserted = 0;
 
                foreach ($entries as $entry) {
 
                                }
                        }
 
-                       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;
+                               }
 
                        }
                }