diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-05-17 22:59:49 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-05-17 22:59:49 -0400 |
commit | 4d612fa6f06d9d1c1e68806aef607a36a04f4f38 (patch) | |
tree | 1d528ad67f0a69e72512d9bb50cf627ccfa6fd33 /lib/feed.php | |
parent | 482377467900901cee323c7b6375f57f22fd1458 (diff) |
new classes for the data mapping
Diffstat (limited to 'lib/feed.php')
-rw-r--r-- | lib/feed.php | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/feed.php b/lib/feed.php index bd2e3b1e4..215ac7c1f 100644 --- a/lib/feed.php +++ b/lib/feed.php @@ -26,18 +26,35 @@ class OC_News_Feed { private $url; - private $spfeed; //we encapsulate a SimplePie_Core object + 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 $fetched; public function __construct($url){ $this->url = $url; $this->spfeed = new SimplePie_Core(); - $this->spfeed->set_item_class('OC_News_Item'); $this->spfeed->set_feed_url( $url ); $this->spfeed->enable_cache( false ); + $this->fetched = false; + } - //FIXME: figure out if constructor is the right place for these + public function fetch(){ $this->spfeed->init(); $this->spfeed->handle_content_type(); + $this->fetched = true; + } + + public function isFetched(){ + return $this->fetched; + } + + public function getId(){ + return $this->feedid; + } + + public function setId($id){ + $this->feedid = $id; } public function getUrl(){ @@ -45,6 +62,13 @@ class OC_News_Feed { } public function getTitle(){ + if (!$this->isFetched()) { + $this->fetch(); + } return $this->spfeed->get_title(); } + + public function getItems(){ + return $this->items; + } } |