summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.php23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/utils.php b/lib/utils.php
index 12a9506ec..cc3b6aa09 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -30,21 +30,20 @@ class OC_News_Utils {
return null;
}
- if (!$spfeed->handle_content_type()) {
- return null;
- }
+ $spfeed->handle_content_type();
$title = $spfeed->get_title();
-
- $spitems = $spfeed->get_items();
+
$items = array();
- foreach($spitems as $spitem) { //FIXME: maybe we can avoid this loop
- $itemUrl = $spitem->get_permalink();
- $itemTitle = $spitem->get_title();
- $itemGUID = $spitem->get_id();
- $itemBody = $spitem->get_content();
- $items[] = new OC_News_Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
+ if ($spitems = $spfeed->get_items()) {
+ foreach($spitems as $spitem) { //FIXME: maybe we can avoid this loop
+ $itemUrl = $spitem->get_permalink();
+ $itemTitle = $spitem->get_title();
+ $itemGUID = $spitem->get_id();
+ $itemBody = $spitem->get_content();
+ $items[] = new OC_News_Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
+ }
}
-
+
$feed = new OC_News_Feed($url, $title, $items);
$favicon = $spfeed->get_image_url();