diff options
Diffstat (limited to 'classes/feeditem')
| -rw-r--r-- | classes/feeditem/atom.php | 25 | ||||
| -rw-r--r-- | classes/feeditem/rss.php | 18 |
2 files changed, 35 insertions, 8 deletions
diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index 1cfa4bcc5..489c5b148 100644 --- a/classes/feeditem/atom.php +++ b/classes/feeditem/atom.php @@ -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"); } } @@ -41,9 +44,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 +55,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 ($summary) { - return $summary->nodeValue; + if ($content) { + if ($content->hasAttribute('type')) { + if ($content->getAttribute('type') == 'xhtml') { + return $this->doc->saveXML($content->firstChild->nextSibling); + } + } + + return $content->nodeValue; } + } function get_categories() { diff --git a/classes/feeditem/rss.php b/classes/feeditem/rss.php index 2f363b4f6..e09a1fbba 100644 --- a/classes/feeditem/rss.php +++ b/classes/feeditem/rss.php @@ -19,6 +19,24 @@ class FeedItem_RSS extends FeedItem_Common { } function get_link() { + $links = $this->xpath->query("atom:link", $this->elem); + + 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); + + if ($link && $link->hasAttributes() && $link->getAttribute("isPermaLink") == "true") { + return $link->nodeValue; + } + $link = $this->elem->getElementsByTagName("link")->item(0); if ($link) { |