]> git.wh0rd.org - tt-rss.git/blobdiff - classes/feeditem/rss.php
remove some redundant php closing tags
[tt-rss.git] / classes / feeditem / rss.php
index c9a7467cda6581b6d00ec788c08a64d5c7d6345e..a3fa7e636578bfd9ed6c3270d2baac310f226b06 100644 (file)
@@ -51,6 +51,14 @@ class FeedItem_RSS extends FeedItem_Common {
        }
 
        function get_title() {
+               $title = $this->xpath->query("title", $this->elem)->item(0);
+
+               if ($title) {
+                       return trim($title->nodeValue);
+               }
+
+               // if the document has a default namespace then querying for
+               // title would fail because of reasons so let's try the old way
                $title = $this->elem->getElementsByTagName("title")->item(0);
 
                if ($title) {
@@ -63,17 +71,19 @@ class FeedItem_RSS extends FeedItem_Common {
                $contentB = $this->elem->getElementsByTagName("description")->item(0);
 
                if ($contentA && !$contentB) {
-                       return $contentA->nodeValue;
+                       return $this->subtree_or_text($contentA);
                }
 
 
                if ($contentB && !$contentA) {
-                       return $contentB->nodeValue;
+                       return $this->subtree_or_text($contentB);
                }
 
                if ($contentA && $contentB) {
-                       return mb_strlen($contentA->nodeValue) > mb_strlen($contentB->nodeValue) ?
-                               $contentA->nodeValue : $contentB->nodeValue;
+                       $resultA = $this->subtree_or_text($contentA);
+                       $resultB = $this->subtree_or_text($contentB);
+
+                       return mb_strlen($resultA) > mb_strlen($resultB) ? $resultA : $resultB;
                }
        }
 
@@ -179,5 +189,4 @@ class FeedItem_RSS extends FeedItem_Common {
                return $encs;
        }
 
-}
-?>
+}
\ No newline at end of file