Example #1
0
// Mark item as read and redirect to the listing page
Router\get_action('mark-item-read', function () {
    $id = Request\param('id');
    $redirect = Request\param('redirect', 'unread');
    $offset = Request\int_param('offset', 0);
    $feed_id = Request\int_param('feed_id', 0);
    Model\Item\set_read($id);
    Response\Redirect('?action=' . $redirect . '&offset=' . $offset . '&feed_id=' . $feed_id . '#item-' . $id);
});
// Mark item as unread and redirect to the listing page
Router\get_action('mark-item-unread', function () {
    $id = Request\param('id');
    $redirect = Request\param('redirect', 'history');
    $offset = Request\int_param('offset', 0);
    $feed_id = Request\int_param('feed_id', 0);
    Model\Item\set_unread($id);
    Response\Redirect('?action=' . $redirect . '&offset=' . $offset . '&feed_id=' . $feed_id . '#item-' . $id);
});
// Mark item as removed and redirect to the listing page
Router\get_action('mark-item-removed', function () {
    $id = Request\param('id');
    $redirect = Request\param('redirect', 'history');
    $offset = Request\int_param('offset', 0);
    $feed_id = Request\int_param('feed_id', 0);
    Model\Item\set_removed($id);
    Response\Redirect('?action=' . $redirect . '&offset=' . $offset . '&feed_id=' . $feed_id);
});
Router\post_action('latest-feeds-items', function () {
    $items = Model\Item\get_latest_feeds_items();
    $nb_unread_items = Model\Item\count_by_status('unread');
    $feeds = array_reduce($items, function ($result, $item) {
Example #2
0
});
// Get one item
$server->register('item.info', function ($item_id) {
    return Model\Item\get($item_id);
});
// Delete an item
$server->register('item.delete', function ($item_id) {
    return Model\Item\set_removed($item_id);
});
// Mark item as read
$server->register('item.mark_as_read', function ($item_id) {
    return Model\Item\set_read($item_id);
});
// Mark item as unread
$server->register('item.mark_as_unread', function ($item_id) {
    return Model\Item\set_unread($item_id);
});
// Change the status of list of items
$server->register('item.set_list_status', function ($status, array $items) {
    return Model\Item\set_status($status, $items);
});
// Flush all read items
$server->register('item.flush', function () {
    return Model\Item\mark_all_as_removed();
});
// Mark all unread items as read
$server->register('item.mark_all_as_read', function () {
    return Model\Item\mark_all_as_read();
});
// Get all items with the content
$server->register('item.get_all', function () {