Commit b823c64b authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Display the published day for RSS feeds (Bug #661602)"

parents 3a190471 ec625ec9
......@@ -29,5 +29,6 @@ $string['showfeeditemsinfulldesc'] = 'Whether to show a summary of the feed item
$string['invalidurl'] = 'That URL is invalid. You can only view feeds for http and https URLs.';
$string['invalidfeed'] = 'The feed appears to be invalid. The error reported was: %s';
$string['lastupdatedon'] = 'Last updated on %s';
$string['publishedon'] = 'Published on %s';
$string['defaulttitledescription'] = 'If you leave this blank, the title of the feed will be used.';
$string['reenterpassword'] = 'Because you have changed the URL of the feed, please re-enter (or delete) the password.';
......@@ -63,8 +63,9 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
$chunks = array_chunk($data->content, isset($configdata['count']) ? $configdata['count'] : 10);
$data->content = $chunks[0];
foreach ($data->content as $k => $c) {
$data->content[$k]->link = sanitize_url($c->link);
foreach ($data->content as &$c) {
$c->link = sanitize_url($c->link);
$c->pubdate = !empty($c->pubdate) ? format_date($c->pubdate) : null;
}
}
......@@ -434,7 +435,20 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
$item->title = get_string('notitle', 'view');
}
}
$data->content[] = (object)array('title' => $item->title, 'link' => $item->link, 'description' => $description);
if (!$pubdate = $item->pubDate) {
if (!$pubdate = $item->date) {
if (!$pubdate = $item->published) {
$pubdate = $item->updated;
};
}
}
$data->content[] = (object)array(
'title' => $item->title,
'link' => $item->link,
'description' => $description,
'pubdate' => $pubdate,
);
}
$cache[$source] = $data;
return $data;
......
......@@ -15,6 +15,9 @@
{$entry->title}
{if $entry->link}</a>{/if}
</h3>
<span class="postdetails">
{if $entry->pubdate}{str tag=publishedon section=blocktype.externalfeed arg1=$entry->pubdate}{/if}
</span>
<div class="feedcontent">{$entry->description|clean_html|safe}</div>
{/foreach}
{else}
......@@ -23,7 +26,10 @@
<li>
{if $entry->link}<a href="{$entry->link}">{/if}
{$entry->title}
{if $entry->link}</a>{/if}
{if $entry->link}</a>{/if}<br />
<span class="postdetails">
{if $entry->pubdate}{str tag=publishedon section=blocktype.externalfeed arg1=$entry->pubdate}{/if}
</span>
</li>
{/foreach}
</ol>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment