mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-23 16:10:28 +00:00
0aa344dc24
Prefix ur with service namel: [service]_[route name] Add comment in Interface
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Wallabag\ImportBundle\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
|
|
class PocketController extends Controller
|
|
{
|
|
/**
|
|
* @Route("/import/pocket", name="pocket_import")
|
|
*/
|
|
public function indexAction()
|
|
{
|
|
return $this->render('WallabagImportBundle:Pocket:index.html.twig', array());
|
|
}
|
|
|
|
/**
|
|
* @Route("/import/pocket/auth", name="pocket_auth")
|
|
*/
|
|
public function authAction()
|
|
{
|
|
$pocket = $this->get('wallabag_import.pocket.import');
|
|
$authUrl = $pocket->oAuthRequest(
|
|
$this->generateUrl('import', array(), true),
|
|
$this->generateUrl('pocket_callback', array(), true)
|
|
);
|
|
|
|
return $this->redirect($authUrl, 301);
|
|
}
|
|
|
|
/**
|
|
* @Route("/import/pocket/callback", name="pocket_callback")
|
|
*/
|
|
public function callbackAction()
|
|
{
|
|
$pocket = $this->get('wallabag_import.pocket.import');
|
|
$accessToken = $pocket->oAuthAuthorize();
|
|
$pocket->import($accessToken);
|
|
|
|
return $this->redirect($this->generateUrl('homepage'));
|
|
}
|
|
}
|