summaryrefslogtreecommitdiffstats
path: root/lib/utils.php
diff options
context:
space:
mode:
authorGregor Tätzner <gregor@freenet.de>2012-08-02 18:52:33 +0200
committerGregor Tätzner <gregor@freenet.de>2012-08-02 18:52:33 +0200
commitbdc51593245f6495bbd7e198c5dcda8072497e12 (patch)
treeb9fb41b454d647b49ff4af41294232c7152a4f8a /lib/utils.php
parent1cc2f0c7f0317fc5b1a0f19a147538f51927984e (diff)
Add feed to feed list instantly on feed adding
Reload is no longer necessary. There are still some issues - especially the order of the feeds: atm the feed is just inserted at the beginning
Diffstat (limited to 'lib/utils.php')
-rw-r--r--lib/utils.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/utils.php b/lib/utils.php
index ce7712e9a..b7750e71a 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -19,22 +19,22 @@ class OC_News_Utils {
/**
* @brief Fetch a feed from remote
* @param url remote url of the feed
- * @returns
+ * @returns an instance of OC_News_Feed
*/
public static function fetch($url){
$spfeed = new SimplePie_Core();
$spfeed->set_feed_url( $url );
$spfeed->enable_cache( false );
-
+
if (!$spfeed->init()) {
return null;
}
-
+
//I understand this try-catch sucks, but SimplePie gives weird errors sometimes
try {
$spfeed->handle_content_type();
$title = $spfeed->get_title();
-
+
$items = array();
if ($spitems = $spfeed->get_items()) {
foreach($spitems as $spitem) { //FIXME: maybe we can avoid this loop
@@ -45,7 +45,7 @@ class OC_News_Utils {
$items[] = new OC_News_Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
}
}
-
+
$feed = new OC_News_Feed($url, $title, $items);
$favicon = $spfeed->get_image_url();