diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-05-20 19:14:34 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-05-20 19:14:34 -0400 |
commit | 2a15c85cd9c08af627798c61eced0511b05a1ac3 (patch) | |
tree | 96824baa8d9748669851fd95714448d2bcd880fd /lib/feed.php | |
parent | 4cb80788b059506fa30c8aeae3da87dec931332b (diff) |
fetching items from remote feed working now
Diffstat (limited to 'lib/feed.php')
-rw-r--r-- | lib/feed.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/feed.php b/lib/feed.php index 215ac7c1f..ce1cc956a 100644 --- a/lib/feed.php +++ b/lib/feed.php @@ -28,7 +28,7 @@ class OC_News_Feed { private $url; private $feedid; //id of the feed in the database private $spfeed; //encapsulate a SimplePie_Core object - private $items; //array that contains all the items of the feed + private $items; //array that contains all the items of the feed private $fetched; public function __construct($url){ @@ -69,6 +69,16 @@ class OC_News_Feed { } public function getItems(){ + if (!isset($this->items)){ + if (!$this->isFetched()) { + $this->fetch(); + } + $spitems = $this->spfeed->get_items(); + $this->items = array(); + foreach($spitems as $spitem) { //FIXME: maybe we can avoid this loop + $this->items[] = new OC_News_Item($spitem); + } + } return $this->items; } } |