From 3f972dafc2c227f63522d3bc4aac983af2fac513 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 11 Jan 2016 19:53:18 -0500 Subject: [PATCH] Fix some issues in PR --- controllers/item.php | 2 +- models/favicon.php | 21 ++++----------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/controllers/item.php b/controllers/item.php index e37f2b8..e69e2c3 100644 --- a/controllers/item.php +++ b/controllers/item.php @@ -110,7 +110,7 @@ Router\get_action('feed-items', function() { $items = Model\Item\get_all_by_feed($feed_id, $offset, Model\Config\get('items_per_page'), $order, $direction); Response\html(Template\layout('feed_items', array( - 'favicons' => Model\Feed\get_favicons(array($feed['id'])), + 'favicons' => Model\Favicon\get_favicons(array($feed['id'])), 'original_marks_read' => Model\Config\get('original_marks_read'), 'order' => $order, 'direction' => $direction, diff --git a/models/favicon.php b/models/favicon.php index bf87fa0..e21eac3 100644 --- a/models/favicon.php +++ b/models/favicon.php @@ -2,22 +2,11 @@ namespace Model\Favicon; -use UnexpectedValueException; use Model\Config; -use Model\Item; use Model\Group; use Helper; -use SimpleValidator\Validator; -use SimpleValidator\Validators; use PicoDb\Database; -use PicoFeed\Serialization\Export; -use PicoFeed\Serialization\Import; -use PicoFeed\Reader\Reader; use PicoFeed\Reader\Favicon; -use PicoFeed\PicoFeedException; -use PicoFeed\Client\InvalidUrlException; - -const LIMIT_ALL = -1; // Create a favicons function create_feed_favicon($feed_id, $site_url, $icon_link) { @@ -60,7 +49,7 @@ function fetch($feed_id, $site_url, $icon_link) // Store the favicon (only if it does not exist yet) function store($type, $icon) { - if ($icon == "") { + if ($icon === '') { return false; } @@ -120,7 +109,7 @@ function purge_favicons() 'favicons_feeds.feed_id' ) ->join('favicons_feeds', 'favicon_id', 'id') - ->isnull('favicons_feeds.feed_id') + ->isNull('favicons_feeds.feed_id') ->findAll(); foreach ($favicons as $favicon) { @@ -186,11 +175,11 @@ function get_all_favicons() ) ->join('favicons_feeds', 'favicon_id', 'id') ->findAll(); - + $map = array(); foreach ($result as $row) { - $map[$row['feed_id']] = array ( + $map[$row['feed_id']] = array( "type" => $row['type'], "hash" => $row['hash'] ); @@ -198,5 +187,3 @@ function get_all_favicons() return $map; } - -