diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 527e107b72e8cf1866ce94b5f76212a6be8169db..ffb9a84cd4368053aa03801db055684dcb9198c3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ Feeds 6.x 1.0 XXXXXXX, 20XX-XX-XX --------------------------------- +- #647128 bigkevmcd, Michelle: Fix broken author info in FeedsSyndicationParser. - alex_b: Add mapping API for FeedsDataProcessor. - alex_b: Decode HTML entities for title and author name in FeedsSimplePieParser. diff --git a/libraries/common_syndication_parser.inc b/libraries/common_syndication_parser.inc index 680d05891b788aab8b1e560005a24a7d632b1d99..afaeb6b0198fdc4a2f31f1dde5569f966d7e471f 100644 --- a/libraries/common_syndication_parser.inc +++ b/libraries/common_syndication_parser.inc @@ -182,7 +182,7 @@ function _parser_common_syndication_atom10_parse($feed_XML) { $item = array(); $item['title'] = _parser_common_syndication_title($title, $body); $item['description'] = $body; - $item['author'] = $original_author; + $item['author_name'] = $original_author; $item['timestamp'] = _parser_common_syndication_parse_date(isset($news->published) ? "{$news->published}" : "{$news->issued}"); $item['url'] = trim($original_url); if (valid_url($item['url']) && !valid_url($item['url'], TRUE) && !empty($base)) { @@ -280,7 +280,7 @@ function _parser_common_syndication_RDF10_parse($feed_XML) { // If no author name found, use the feed title: if (empty($item['author'])) { - $item['author'] = $parsed_source['title']; + $item['author_name'] = $parsed_source['title']; } // If no GUID found, use the URL of the feed. @@ -330,6 +330,12 @@ function _parser_common_syndication_RDF10_item($rdf_data, $mappings) { * Parse RSS2.0 feeds. */ function _parser_common_syndication_RSS20_parse($feed_XML) { + + $ns = array ( + "content" => "http://purl.org/rss/1.0/modules/content/", + "dc" => "http://purl.org/dc/elements/1.1/", + ); + $parsed_source = array(); // Detect the title. $parsed_source['title'] = isset($feed_XML->channel->title) ? _parser_common_syndication_title("{$feed_XML->channel->title}") : ""; @@ -343,7 +349,8 @@ function _parser_common_syndication_RSS20_parse($feed_XML) { $category = $news->xpath('category'); // Get children for current namespace. if (version_compare(phpversion(), '5.1.2', '>')) { - $content = (array)$news->children('http://purl.org/rss/1.0/modules/content/'); + $content = (array)$news->children($ns["content"]); + $dc = (array)$news->children($ns["dc"]); } $news = (array) $news; $news['category'] = $category; @@ -377,6 +384,9 @@ function _parser_common_syndication_RSS20_parse($feed_XML) { if (!empty($news['author'])) { $original_author = "{$news['author']}"; } + else { + $original_author = (string)$dc["creator"]; + } if (!empty($news['link'])) { $original_url = "{$news['link']}"; @@ -414,7 +424,7 @@ function _parser_common_syndication_RSS20_parse($feed_XML) { $item = array(); $item['title'] = _parser_common_syndication_title($title, $body); $item['description'] = $body; - $item['author'] = $original_author; + $item['author_name'] = $original_author; if (isset($news['pubDate'])) { $item['timestamp'] = _parser_common_syndication_parse_date($news['pubDate']); }