$nav = Model\Item\get_nav($item, array('unread', 'read'), array(1)); break; } $image_proxy = Model\Config\get('image_proxy'); // add the image proxy if requested and required $item['content'] = Model\Proxy\addProxyToTags($item['content'], $item['url'], $image_proxy, $feed['cloak_referrer']); if ($image_proxy && strpos($item['enclosure_type'], 'image') === 0) { $item['enclosure'] = Model\Proxy\addProxyToLink($item['enclosure']); } Response\html(Template\layout('show_item', array('nb_unread_items' => $nb_unread_items = Model\Item\count_by_status('unread'), 'item' => $item, 'feed' => $feed, 'item_nav' => isset($nav) ? $nav : null, 'menu' => $menu, 'title' => $item['title']))); }); // Display feed items page Router\get_action('feed-items', function () { $feed_id = Request\int_param('feed_id', 0); $offset = Request\int_param('offset', 0); $nb_items = Model\Item\count_by_feed($feed_id); $feed = Model\Feed\get($feed_id); $order = Request\param('order', 'updated'); $direction = Request\param('direction', Model\Config\get('items_sorting_direction')); $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'])), 'original_marks_read' => Model\Config\get('original_marks_read'), 'order' => $order, 'direction' => $direction, 'display_mode' => Model\Config\get('items_display_mode'), 'feed' => $feed, 'items' => $items, 'nb_items' => $nb_items, 'nb_unread_items' => Model\Item\count_by_status('unread'), 'offset' => $offset, 'items_per_page' => Model\Config\get('items_per_page'), 'menu' => 'feed-items', 'title' => '(' . $nb_items . ') ' . $feed['title']))); }); // Ajax call to download an item (fetch the full content from the original website) Router\post_action('download-item', function () { $id = Request\param('id'); $item = Model\Item\get($id); $feed = Model\Feed\get($item['feed_id']); $download = Model\Item\download_content_id($id); $download['content'] = Model\Proxy\addProxyToTags($download['content'], $item['url'], Model\Config\get('image_proxy'), $feed['cloak_referrer']); Response\json($download); });
}); // Disable a feed $server->register('feed.disable', function ($feed_id) { return Model\Feed\disable($feed_id); }); // Update a feed $server->register('feed.update', function ($feed_id) { return Model\Feed\refresh($feed_id); }); // Get all items for a specific feed $server->register('item.feed.list', function ($feed_id, $offset = null, $limit = null) { return Model\Item\get_all_by_feed($feed_id, $offset, $limit); }); // Count all feed items $server->register('item.feed.count', function ($feed_id) { return Model\Item\count_by_feed($feed_id); }); // Get all bookmark items $server->register('item.bookmark.list', function ($offset = null, $limit = null) { return Model\Item\get_bookmarks($offset, $limit); }); // Count bookmarks $server->register('item.bookmark.count', function () { return Model\Item\count_bookmarks(); }); // Add a bookmark $server->register('item.bookmark.create', function ($item_id) { return Model\Item\set_bookmark_value($item_id, 1); }); // Remove a bookmark $server->register('item.bookmark.delete', function ($item_id) {