mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-12 16:58:37 +00:00
parent
f98a2a0fc3
commit
0c83fd5994
13 changed files with 510 additions and 61 deletions
84
src/Wallabag/CoreBundle/Controller/RssController.php
Normal file
84
src/Wallabag/CoreBundle/Controller/RssController.php
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Wallabag\CoreBundle\Entity\User;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
||||
class RssController extends Controller
|
||||
{
|
||||
/**
|
||||
* Shows unread entries for current user
|
||||
*
|
||||
* @Route("/{username}/{token}/unread.xml", name="unread_rss", defaults={"_format"="xml"})
|
||||
* @ParamConverter("user", class="WallabagCoreBundle:User", converter="username_rsstoken_converter")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function showUnreadAction(User $user)
|
||||
{
|
||||
$entries = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findUnreadByUser(
|
||||
$user->getId(),
|
||||
0,
|
||||
$user->getConfig()->getRssLimit() ?: $this->getContainer()->getParameter('rss_limit')
|
||||
);
|
||||
|
||||
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
|
||||
'type' => 'unread',
|
||||
'entries' => $entries,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows read entries for current user
|
||||
*
|
||||
* @Route("/{username}/{token}/archive.xml", name="archive_rss")
|
||||
* @ParamConverter("user", class="WallabagCoreBundle:User", converter="username_rsstoken_converter")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function showArchiveAction(User $user)
|
||||
{
|
||||
$entries = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findArchiveByUser(
|
||||
$user->getId(),
|
||||
0,
|
||||
$user->getConfig()->getRssLimit() ?: $this->getContainer()->getParameter('rss_limit')
|
||||
);
|
||||
|
||||
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
|
||||
'type' => 'archive',
|
||||
'entries' => $entries,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows starred entries for current user
|
||||
*
|
||||
* @Route("/{username}/{token}/starred.xml", name="starred_rss")
|
||||
* @ParamConverter("user", class="WallabagCoreBundle:User", converter="username_rsstoken_converter")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function showStarredAction(User $user)
|
||||
{
|
||||
$entries = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findStarredByUser(
|
||||
$user->getId(),
|
||||
0,
|
||||
$user->getConfig()->getRssLimit() ?: $this->getContainer()->getParameter('rss_limit')
|
||||
);
|
||||
|
||||
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
|
||||
'type' => 'starred',
|
||||
'entries' => $entries,
|
||||
));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue