]> git.wh0rd.org - tt-rss.git/blobdiff - classes/feeditem/rss.php
better support for atom:link elements in rss feeds, support rel=standout (fuck you...
[tt-rss.git] / classes / feeditem / rss.php
index 34dfee1f14924dd6feed798f68ef705f53e3f6fc..e09a1fbba245e08d155e20994da4772d4453d7cd 100644 (file)
@@ -19,10 +19,16 @@ class FeedItem_RSS extends FeedItem_Common {
        }
 
        function get_link() {
-               $link = $this->xpath->query("atom:link", $this->elem)->item(0);
+               $links = $this->xpath->query("atom:link", $this->elem);
 
-               if ($link) {
-                       return $link->getAttribute("href");
+               foreach ($links as $link) {
+                       if ($link && $link->hasAttribute("href") &&
+                               (!$link->hasAttribute("rel")
+                                       || $link->getAttribute("rel") == "alternate"
+                                       || $link->getAttribute("rel") == "standout")) {
+
+                               return $link->getAttribute("href");
+                       }
                }
 
                $link = $this->elem->getElementsByTagName("guid")->item(0);