diff options
Diffstat (limited to 'classes/feeditem/atom.php')
-rw-r--r-- | classes/feeditem/atom.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index 77cd448b8..8c3e0f8a7 100644 --- a/classes/feeditem/atom.php +++ b/classes/feeditem/atom.php @@ -1,5 +1,6 @@ <?php class FeedItem_Atom extends FeedItem_Common { + const NS_XML = "http://www.w3.org/XML/1998/namespace"; function get_id() { $id = $this->elem->getElementsByTagName("id")->item(0); @@ -197,4 +198,18 @@ class FeedItem_Atom extends FeedItem_Common { return $encs; } + function get_language() { + $lang = $this->elem->getAttributeNS(self::NS_XML, "lang"); + + if (!empty($lang)) { + return $lang; + } else { + // Fall back to the language declared on the feed, if any. + foreach ($this->doc->childNodes as $child) { + if (method_exists($child, "getAttributeNS")) { + return $child->getAttributeNS(self::NS_XML, "lang"); + } + } + } + } } |