]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/ImportBundle/Controller/PocketController.php
Update url & service name
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Controller / PocketController.php
1 <?php
2
3 namespace Wallabag\ImportBundle\Controller;
4
5 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7
8 class PocketController extends Controller
9 {
10 /**
11 * @Route("/import/pocket", name="pocket_import")
12 */
13 public function indexAction()
14 {
15 return $this->render('WallabagImportBundle:Pocket:index.html.twig', array());
16 }
17
18 /**
19 * @Route("/import/pocket/auth", name="pocket_auth")
20 */
21 public function authAction()
22 {
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 );
28
29 return $this->redirect($authUrl, 301);
30 }
31
32 /**
33 * @Route("/import/pocket/callback", name="pocket_callback")
34 */
35 public function callbackAction()
36 {
37 $pocket = $this->get('wallabag_import.pocket.import');
38 $accessToken = $pocket->oAuthAuthorize();
39 $pocket->import($accessToken);
40
41 return $this->redirect($this->generateUrl('homepage'));
42 }
43 }