diff options
author | fox <[email protected]> | 2018-08-12 15:45:11 +0000 |
---|---|---|
committer | Gogs <[email protected]> | 2018-08-12 15:45:11 +0000 |
commit | 7418323f530f8364cb5f67e0528f75bad3491743 (patch) | |
tree | a5ca48e001cd9d64cea99182aa11ed53d7c6c68f /classes/feeditem/atom.php | |
parent | 83da40251fbf3409a3b89a107fdf63eed805c28b (diff) | |
parent | a377d5c981471f86c0d0c121be799aa0868e220e (diff) |
Merge branch 'pullreq-store-language' of tkappe/tt-rss into master
Diffstat (limited to 'classes/feeditem/atom.php')
-rw-r--r-- | classes/feeditem/atom.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index 77cd448b8..ee5591757 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,14 @@ 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. + return $this->doc->firstChild->getAttributeNS(self::NS_XML, "lang"); + } + } } |