]>
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 | /** | |
0aa344dc | 11 | * @Route("/import/pocket", name="pocket_import") |
1f4408de | 12 | */ |
d51b38ed | 13 | public function indexAction() |
1f4408de NL |
14 | { |
15 | return $this->render('WallabagImportBundle:Pocket:index.html.twig', array()); | |
16 | } | |
17 | ||
1f4408de | 18 | /** |
0aa344dc | 19 | * @Route("/import/pocket/auth", name="pocket_auth") |
1f4408de NL |
20 | */ |
21 | public function authAction() | |
22 | { | |
0aa344dc JB |
23 | $pocket = $this->get('wallabag_import.pocket.import'); |
24 | $authUrl = $pocket->oAuthRequest( | |
25 | $this->generateUrl('import', array(), true), | |
26 | $this->generateUrl('pocket_callback', array(), true) | |
27 | ); | |
1f4408de | 28 | |
ff7b031d | 29 | return $this->redirect($authUrl, 301); |
1f4408de NL |
30 | } |
31 | ||
32 | /** | |
0aa344dc | 33 | * @Route("/import/pocket/callback", name="pocket_callback") |
1f4408de NL |
34 | */ |
35 | public function callbackAction() | |
36 | { | |
0aa344dc | 37 | $pocket = $this->get('wallabag_import.pocket.import'); |
ff7b031d NL |
38 | $accessToken = $pocket->oAuthAuthorize(); |
39 | $pocket->import($accessToken); | |
1f4408de NL |
40 | |
41 | return $this->redirect($this->generateUrl('homepage')); | |
42 | } | |
1f4408de | 43 | } |