Commit aecbadde authored by Melissa Draper's avatar Melissa Draper
Browse files

Add fallback for missing rss titles (bug #897457)

http://www.sophos.com/en-us/rss/sophos-security-news.xml

 for example
is rather poorly constructed and just has closing title tags rather
than an actual title. This patch adds some fallback so that links
are actually clickable and not lost to the UI.

Change-Id: Ida3b61f3cf60ddaa5f4b96795cd43ee443c111e4
Signed-off-by: default avatarMelissa Draper <melissa@catalyst.net.nz>
parent c02de1f4
......@@ -395,6 +395,17 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
break;
}
$description = $item->content ? $item->content : ($item->description ? $item->description : ($item->summary ? $item->summary : null));
if (!$item->title) {
if (!empty($description)) {
$item->title = substr($description, 0, 60);
}
else if ($item->link) {
$item->title = $item->link;
}
else {
$item->title = get_string('notitle', 'view');
}
}
$data->content[] = (object)array('title' => $item->title, 'link' => $item->link, 'description' => $description);
}
$cache[$source] = $data;
......
Markdown is supported
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