From 149b64879e78165e6b79882c04aad2c599a69a1b Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 4 Sep 2016 13:05:17 +0200 Subject: [PATCH] [Bridge] Support 'dc' namespace for RSS 1.0 --- lib/Bridge.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/Bridge.php b/lib/Bridge.php index b96d33b..29683cf 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -705,7 +705,16 @@ abstract class RssExpander extends HttpCachingBridgeAbstract { protected function parseRSS_1_0_Item($feedItem){ // 1.0 adds optional elements around the 0.91 standard - return $this->parseRSS_0_9_1_Item($feedItem); + $item = $this->parseRSS_0_9_1_Item($feedItem); + + $namespaces = $feedItem->getNamespaces(true); + if(isset($namespaces['dc'])){ + $dc = $feedItem->children($namespaces['dc']); + if(isset($dc->date)) $item['timestamp'] = strtotime($dc->date); + if(isset($dc->creator)) $item['author'] = $dc->creator; + } + + return $item; } protected function parseRSS_2_0_Item($feedItem){ @@ -719,8 +728,7 @@ abstract class RssExpander extends HttpCachingBridgeAbstract { $namespaces = $feedItem->getNamespaces(true); if(isset($namespaces['dc'])){ $dc = $feedItem->children($namespaces['dc']); - if(isset($dc->creator)) - $item['author'] = $dc->creator; + if(isset($dc->creator)) $item['author'] = $dc->creator; } } return $item;