]>
Commit | Line | Data |
---|---|---|
1f4408de NL |
1 | <?php |
2 | ||
3 | namespace Wallabag\ImportBundle\Controller; | |
4 | ||
5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
6 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | |
1f4408de NL |
7 | |
8 | class PocketController extends Controller | |
9 | { | |
10 | /** | |
d51b38ed | 11 | * @Route("/import/pocket", name="pocket") |
1f4408de | 12 | */ |
d51b38ed | 13 | public function indexAction() |
1f4408de NL |
14 | { |
15 | return $this->render('WallabagImportBundle:Pocket:index.html.twig', array()); | |
16 | } | |
17 | ||
1f4408de | 18 | /** |
d51b38ed | 19 | * @Route("/import/pocket/auth", name="authpocket") |
1f4408de NL |
20 | */ |
21 | public function authAction() | |
22 | { | |
557e549d | 23 | $pocket = $this->get('wallabag_import.import.pocket_import'); |
ff7b031d | 24 | $authUrl = $pocket->oAuthRequest($this->generateUrl('import', array(), true), $this->generateUrl('callbackpocket', array(), true)); |
1f4408de | 25 | |
ff7b031d | 26 | return $this->redirect($authUrl, 301); |
1f4408de NL |
27 | } |
28 | ||
29 | /** | |
d51b38ed | 30 | * @Route("/import/pocket/callback", name="callbackpocket") |
1f4408de NL |
31 | */ |
32 | public function callbackAction() | |
33 | { | |
557e549d | 34 | $pocket = $this->get('wallabag_import.import.pocket_import'); |
ff7b031d NL |
35 | $accessToken = $pocket->oAuthAuthorize(); |
36 | $pocket->import($accessToken); | |
1f4408de NL |
37 | |
38 | return $this->redirect($this->generateUrl('homepage')); | |
39 | } | |
1f4408de | 40 | } |