diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-17 17:37:54 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-17 17:37:54 -0400 |
commit | c378e972a12ba41d252d74e509f88ea7bec2544d (patch) | |
tree | 22e05c91cc6409d803cdce5598fd227d76a8b904 /lib | |
parent | 4c8de80f564675f30687d21373ef3674a77a7926 (diff) |
adds favicon; needs css polishing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/feed.php | 10 | ||||
-rw-r--r-- | lib/feedmapper.php | 12 | ||||
-rw-r--r-- | lib/foldermapper.php | 2 | ||||
-rw-r--r-- | lib/utils.php | 8 |
4 files changed, 27 insertions, 5 deletions
diff --git a/lib/feed.php b/lib/feed.php index bbed8d598..59db6f7cc 100644 --- a/lib/feed.php +++ b/lib/feed.php @@ -18,6 +18,7 @@ class OC_News_Feed extends OC_News_Collection { private $url; private $spfeed; //encapsulate a SimplePie_Core object private $items; //array that contains all the items of the feed + private $favicon; public function __construct($url, $title, $items, $id = null){ $this->url = $url; @@ -36,6 +37,14 @@ class OC_News_Feed extends OC_News_Collection { return $this->title; } + public function getFavicon(){ + return $this->favicon; + } + + public function setFavicon($favicon){ + $this->favicon = $favicon; + } + public function setItems($items){ $this->items = $items; } @@ -43,4 +52,5 @@ class OC_News_Feed extends OC_News_Collection { public function getItems(){ return $this->items; } + } diff --git a/lib/feedmapper.php b/lib/feedmapper.php index 73afa0e86..c43ff47a5 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -46,6 +46,8 @@ class OC_News_FeedMapper { $title = $row['title']; $id = $row['id']; $feed = new OC_News_Feed($url, $title, null, $id); + $favicon = $row['favicon_link']; + $feed->setFavicon($favicon); $feeds[] = $feed; } return $feeds; @@ -64,7 +66,8 @@ class OC_News_FeedMapper { $url = $row['url']; $title = $row['title']; $feed = new OC_News_Feed($url, $title, null,$id); - + $favicon = $row['favicon_link']; + $feed->setFavicon($favicon); $itemMapper = new OC_News_ItemMapper(); $items = $itemMapper->findAll($id); $feed->setItems($items); @@ -118,16 +121,17 @@ class OC_News_FeedMapper { if ($feedid == null){ $query = OCP\DB::prepare(' INSERT INTO ' . self::tableName . - '(url, title, folder_id, added, lastmodified) - VALUES (?, ?, ?, ?, ?) + '(url, title, favicon_link, folder_id, added, lastmodified) + VALUES (?, ?, ?, ?, ?, ?) '); $params=array( $url, htmlspecialchars_decode($title), + $feed->getFavicon(), $folderid, $_ut, - $_ut + $_ut, ); $query->execute($params); diff --git a/lib/foldermapper.php b/lib/foldermapper.php index 45dc53c42..01dce13d7 100644 --- a/lib/foldermapper.php +++ b/lib/foldermapper.php @@ -40,7 +40,7 @@ class OC_News_FolderMapper { $result = $stmt->execute(array($this->userid, $id)); while( $row = $result->fetchRow()){ - $child = OC_News_FolderMapper::populate($row['name'], $row['id']); + $child = self::populate($row['name'], $row['id']); $root->addChild($child); } diff --git a/lib/utils.php b/lib/utils.php index 959a102ee..a9f1488b1 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -41,6 +41,14 @@ class OC_News_Utils { } $feed = new OC_News_Feed($url, $title, $items); + + $favicon = $spfeed->get_image_url(); + if ($favicon == null) { + $favicon = $url . "favicon.ico"; + //check if this file exists + } + $feed->setFavicon($favicon); + return $feed; } }
\ No newline at end of file |