Skip to content
Snippets Groups Projects
Commit 06276604 authored by Alex Barth's avatar Alex Barth
Browse files

#647128 bigkevmcd, Michelle: Fix broken author info in FeedsSyndicationParser.

parent 2b2aaeca
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
Feeds 6.x 1.0 XXXXXXX, 20XX-XX-XX 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: Add mapping API for FeedsDataProcessor.
- alex_b: Decode HTML entities for title and author name in - alex_b: Decode HTML entities for title and author name in
FeedsSimplePieParser. FeedsSimplePieParser.
......
...@@ -182,7 +182,7 @@ function _parser_common_syndication_atom10_parse($feed_XML) { ...@@ -182,7 +182,7 @@ function _parser_common_syndication_atom10_parse($feed_XML) {
$item = array(); $item = array();
$item['title'] = _parser_common_syndication_title($title, $body); $item['title'] = _parser_common_syndication_title($title, $body);
$item['description'] = $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['timestamp'] = _parser_common_syndication_parse_date(isset($news->published) ? "{$news->published}" : "{$news->issued}");
$item['url'] = trim($original_url); $item['url'] = trim($original_url);
if (valid_url($item['url']) && !valid_url($item['url'], TRUE) && !empty($base)) { if (valid_url($item['url']) && !valid_url($item['url'], TRUE) && !empty($base)) {
...@@ -280,7 +280,7 @@ function _parser_common_syndication_RDF10_parse($feed_XML) { ...@@ -280,7 +280,7 @@ function _parser_common_syndication_RDF10_parse($feed_XML) {
// If no author name found, use the feed title: // If no author name found, use the feed title:
if (empty($item['author'])) { 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. // If no GUID found, use the URL of the feed.
...@@ -330,6 +330,12 @@ function _parser_common_syndication_RDF10_item($rdf_data, $mappings) { ...@@ -330,6 +330,12 @@ function _parser_common_syndication_RDF10_item($rdf_data, $mappings) {
* Parse RSS2.0 feeds. * Parse RSS2.0 feeds.
*/ */
function _parser_common_syndication_RSS20_parse($feed_XML) { 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(); $parsed_source = array();
// Detect the title. // Detect the title.
$parsed_source['title'] = isset($feed_XML->channel->title) ? _parser_common_syndication_title("{$feed_XML->channel->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) { ...@@ -343,7 +349,8 @@ function _parser_common_syndication_RSS20_parse($feed_XML) {
$category = $news->xpath('category'); $category = $news->xpath('category');
// Get children for current namespace. // Get children for current namespace.
if (version_compare(phpversion(), '5.1.2', '>')) { 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 = (array) $news;
$news['category'] = $category; $news['category'] = $category;
...@@ -377,6 +384,9 @@ function _parser_common_syndication_RSS20_parse($feed_XML) { ...@@ -377,6 +384,9 @@ function _parser_common_syndication_RSS20_parse($feed_XML) {
if (!empty($news['author'])) { if (!empty($news['author'])) {
$original_author = "{$news['author']}"; $original_author = "{$news['author']}";
} }
else {
$original_author = (string)$dc["creator"];
}
if (!empty($news['link'])) { if (!empty($news['link'])) {
$original_url = "{$news['link']}"; $original_url = "{$news['link']}";
...@@ -414,7 +424,7 @@ function _parser_common_syndication_RSS20_parse($feed_XML) { ...@@ -414,7 +424,7 @@ function _parser_common_syndication_RSS20_parse($feed_XML) {
$item = array(); $item = array();
$item['title'] = _parser_common_syndication_title($title, $body); $item['title'] = _parser_common_syndication_title($title, $body);
$item['description'] = $body; $item['description'] = $body;
$item['author'] = $original_author; $item['author_name'] = $original_author;
if (isset($news['pubDate'])) { if (isset($news['pubDate'])) {
$item['timestamp'] = _parser_common_syndication_parse_date($news['pubDate']); $item['timestamp'] = _parser_common_syndication_parse_date($news['pubDate']);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment