From cae1efd552ed0618b13120e07c346cbe28cbd00a Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 2 Mar 2013 00:36:12 +0100 Subject: Corrections quelques bugs + modif fichier config BDD + ajout fichier build.sh pour générer la lib Minz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/Feed.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'app/models/Feed.php') diff --git a/app/models/Feed.php b/app/models/Feed.php index 2db9af40d..67874925f 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -84,16 +84,23 @@ class Feed extends Model { public function load () { if (!is_null ($this->url)) { - $feed = new SimplePie (); - $feed->set_feed_url ($this->url); - $feed->set_cache_location (CACHE_PATH); - $feed->init (); - - $title = $feed->get_title (); - $this->_name (!is_null ($title) ? $title : $this->url); - $this->_website ($feed->get_link ()); - $this->_description ($feed->get_description ()); - $this->loadEntries ($feed); + if (CACHE_PATH === false) { + throw new FileNotExistException ( + 'CACHE_PATH', + MinzException::ERROR + ); + } else { + $feed = new SimplePie (); + $feed->set_feed_url ($this->url); + $feed->set_cache_location (CACHE_PATH); + $feed->init (); + + $title = $feed->get_title (); + $this->_name (!is_null ($title) ? $title : $this->url); + $this->_website ($feed->get_link ()); + $this->_description ($feed->get_description ()); + $this->loadEntries ($feed); + } } } private function loadEntries ($feed) { -- cgit v1.2.3