]> git.wh0rd.org - tt-rss.git/commitdiff
better support for atom content type xhtml
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 16 May 2013 05:19:56 +0000 (09:19 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 16 May 2013 05:19:56 +0000 (09:19 +0400)
classes/feeditem/atom.php

index 1cfa4bcc5829718a644078170d32608f8e4152f9..73a586d5b32cc8f117cf5c675f22762ecba7386d 100644 (file)
@@ -41,9 +41,8 @@ class FeedItem_Atom extends FeedItem_Common {
                $content = $this->elem->getElementsByTagName("content")->item(0);
 
                if ($content) {
-                       if ($content->hasChildNodes()) {
-
-                               if ($content->getElementsByTagName("*")->length > 1) {
+                       if ($content->hasAttribute('type')) {
+                               if ($content->getAttribute('type') == 'xhtml') {
                                        return $this->doc->saveXML($content->firstChild->nextSibling);
                                }
                        }
@@ -53,11 +52,18 @@ class FeedItem_Atom extends FeedItem_Common {
        }
 
        function get_description() {
-               $summary = $this->elem->getElementsByTagName("summary")->item(0);
+               $content = $this->elem->getElementsByTagName("summary")->item(0);
+
+               if ($content) {
+                       if ($content->hasAttribute('type')) {
+                               if ($content->getAttribute('type') == 'xhtml') {
+                                       return $this->doc->saveXML($content->firstChild->nextSibling);
+                               }
+                       }
 
-               if ($summary) {
-                       return $summary->nodeValue;
+                       return $content->nodeValue;
                }
+
        }
 
        function get_categories() {