]> git.wh0rd.org Git - tt-rss.git/commitdiff
better support for atom:link elements in rss feeds, support rel=standout (fuck you...
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 26 May 2013 06:21:54 +0000 (10:21 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 26 May 2013 06:21:54 +0000 (10:21 +0400)
classes/feeditem/atom.php
classes/feeditem/rss.php

index 73a586d5b32cc8f117cf5c675f22762ecba7386d..489c5b148e62f14f00de571492f93e5425f54acd 100644 (file)
@@ -22,8 +22,11 @@ class FeedItem_Atom extends FeedItem_Common {
                $links = $this->elem->getElementsByTagName("link");
 
                foreach ($links as $link) {
-                       if ($link && $link->hasAttribute("href") && (!$link->hasAttribute("rel")
-                                       || $link->getAttribute("rel") == "alternate")) {
+                       if ($link && $link->hasAttribute("href") &&
+                               (!$link->hasAttribute("rel")
+                                       || $link->getAttribute("rel") == "alternate"
+                                       || $link->getAttribute("rel") == "standout")) {
+
                                return $link->getAttribute("href");
                        }
                }
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);