]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/ImportBundle/Controller/PocketController.php
create ImportController to list importers
[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")
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="authpocket")
20 */
21 public function authAction()
22 {
23 $pocket = $this->get('wallabag_import.import.pocket_import');
24 $authUrl = $pocket->oAuthRequest($this->generateUrl('import', array(), true), $this->generateUrl('callbackpocket', array(), true));
25
26 return $this->redirect($authUrl, 301);
27 }
28
29 /**
30 * @Route("/import/pocket/callback", name="callbackpocket")
31 */
32 public function callbackAction()
33 {
34 $pocket = $this->get('wallabag_import.import.pocket_import');
35 $accessToken = $pocket->oAuthAuthorize();
36 $pocket->import($accessToken);
37
38 return $this->redirect($this->generateUrl('homepage'));
39 }
40 }