Exemple #1
0
});
// Delete all feeds
$server->register('feed.delete_all', function () {
    return Model\Feed\remove_all();
});
// Enable a feed
$server->register('feed.enable', function ($feed_id) {
    return Model\Feed\enable($feed_id);
});
// 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 () {
Exemple #2
0
    } else {
        Session\flash_error(t('Unable to remove this subscription.'));
    }
    Response\redirect('?action=feeds');
});
// Refresh one feed and redirect to unread items
Router\get_action('refresh-feed', function () {
    $feed_id = Request\int_param('feed_id');
    $redirect = Request\param('redirect', 'unread');
    Model\Feed\refresh($feed_id);
    Response\redirect('?action=' . $redirect . '&feed_id=' . $feed_id);
});
// Ajax call to refresh one feed
Router\post_action('refresh-feed', function () {
    $feed_id = Request\int_param('feed_id', 0);
    Response\json(array('feed_id' => $feed_id, 'result' => Model\Feed\refresh($feed_id), 'items_count' => Model\Feed\count_items($feed_id)));
});
// Display all feeds
Router\get_action('feeds', function () {
    $nothing_to_read = Request\int_param('nothing_to_read');
    $nb_unread_items = Model\Item\count_by_status('unread');
    // possible with remember me function
    if ($nothing_to_read === 1 && $nb_unread_items > 0) {
        Response\redirect('?action=unread');
    }
    Response\html(Template\layout('feeds', array('favicons' => Model\Feed\get_all_favicons(), 'feeds' => Model\Feed\get_all_item_counts(), 'nothing_to_read' => $nothing_to_read, 'nb_unread_items' => $nb_unread_items, 'nb_failed_feeds' => Model\Feed\count_failed_feeds(), 'menu' => 'feeds', 'title' => t('Subscriptions'))));
});
// Display form to add one feed
Router\get_action('add', function () {
    $values = array('download_content' => 0, 'rtl' => 0, 'cloak_referrer' => 0, 'create_group' => '', 'feed_group_ids' => array());
    Response\html(Template\layout('add', array('values' => $values + array('csrf' => Model\Config\generate_csrf()), 'errors' => array(), 'nb_unread_items' => Model\Item\count_by_status('unread'), 'groups' => Model\Group\get_all(), 'menu' => 'feeds', 'title' => t('New subscription'))));