diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-06-21 12:46:53 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-06-21 12:46:53 +0200 |
commit | a2f4efe6d2a90d8a2b84a275f48a07dc8aa0a84f (patch) | |
tree | 85c658988b4a769c535e8d3c7a34b573e40818c6 /src | |
parent | 0a01a5f195fa00be0290be1871b6f4798e55d0be (diff) | |
download | wallabag-a2f4efe6d2a90d8a2b84a275f48a07dc8aa0a84f.tar.gz wallabag-a2f4efe6d2a90d8a2b84a275f48a07dc8aa0a84f.tar.zst wallabag-a2f4efe6d2a90d8a2b84a275f48a07dc8aa0a84f.zip |
Use Twig 2.0
`mnapoli/piwik-twig-extension` locked Twig to the 1.10 version. The new version is compatible with Twig 2.0
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/FeedController.php | 2 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Twig/WallabagExtension.php | 23 | ||||
-rw-r--r-- | src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | 15 |
3 files changed, 25 insertions, 15 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/FeedController.php b/src/Wallabag/CoreBundle/Controller/FeedController.php index 8d422a90..9f671735 100644 --- a/src/Wallabag/CoreBundle/Controller/FeedController.php +++ b/src/Wallabag/CoreBundle/Controller/FeedController.php | |||
@@ -176,7 +176,7 @@ class FeedController extends Controller | |||
176 | $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); | 176 | $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); |
177 | $entries = new Pagerfanta($pagerAdapter); | 177 | $entries = new Pagerfanta($pagerAdapter); |
178 | 178 | ||
179 | $perPage = $user->getConfig()->getFeedLimit() ?: $this->getParameter('wallabag_core.Feed_limit'); | 179 | $perPage = $user->getConfig()->getFeedLimit() ?: $this->getParameter('wallabag_core.feed_limit'); |
180 | $entries->setMaxPerPage($perPage); | 180 | $entries->setMaxPerPage($perPage); |
181 | 181 | ||
182 | $url = $this->generateUrl( | 182 | $url = $this->generateUrl( |
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php index 536185d4..02f17f50 100644 --- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php +++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php | |||
@@ -4,10 +4,14 @@ namespace Wallabag\CoreBundle\Twig; | |||
4 | 4 | ||
5 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; | 5 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
6 | use Symfony\Component\Translation\TranslatorInterface; | 6 | use Symfony\Component\Translation\TranslatorInterface; |
7 | use Twig\Extension\AbstractExtension; | ||
8 | use Twig\Extension\GlobalsInterface; | ||
9 | use Twig\TwigFilter; | ||
10 | use Twig\TwigFunction; | ||
7 | use Wallabag\CoreBundle\Repository\EntryRepository; | 11 | use Wallabag\CoreBundle\Repository\EntryRepository; |
8 | use Wallabag\CoreBundle\Repository\TagRepository; | 12 | use Wallabag\CoreBundle\Repository\TagRepository; |
9 | 13 | ||
10 | class WallabagExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface | 14 | class WallabagExtension extends AbstractExtension implements GlobalsInterface |
11 | { | 15 | { |
12 | private $tokenStorage; | 16 | private $tokenStorage; |
13 | private $entryRepository; | 17 | private $entryRepository; |
@@ -24,21 +28,26 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa | |||
24 | $this->translator = $translator; | 28 | $this->translator = $translator; |
25 | } | 29 | } |
26 | 30 | ||
31 | public function getGlobals() | ||
32 | { | ||
33 | return []; | ||
34 | } | ||
35 | |||
27 | public function getFilters() | 36 | public function getFilters() |
28 | { | 37 | { |
29 | return [ | 38 | return [ |
30 | new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']), | 39 | new TwigFilter('removeWww', [$this, 'removeWww']), |
31 | new \Twig_SimpleFilter('removeScheme', [$this, 'removeScheme']), | 40 | new TwigFilter('removeScheme', [$this, 'removeScheme']), |
32 | new \Twig_SimpleFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']), | 41 | new TwigFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']), |
33 | ]; | 42 | ]; |
34 | } | 43 | } |
35 | 44 | ||
36 | public function getFunctions() | 45 | public function getFunctions() |
37 | { | 46 | { |
38 | return [ | 47 | return [ |
39 | new \Twig_SimpleFunction('count_entries', [$this, 'countEntries']), | 48 | new TwigFunction('count_entries', [$this, 'countEntries']), |
40 | new \Twig_SimpleFunction('count_tags', [$this, 'countTags']), | 49 | new TwigFunction('count_tags', [$this, 'countTags']), |
41 | new \Twig_SimpleFunction('display_stats', [$this, 'displayStats']), | 50 | new TwigFunction('display_stats', [$this, 'displayStats']), |
42 | ]; | 51 | ]; |
43 | } | 52 | } |
44 | 53 | ||
diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index 2797efde..e131deb6 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | |||
@@ -4,6 +4,7 @@ namespace Wallabag\UserBundle\Mailer; | |||
4 | 4 | ||
5 | use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; | 5 | use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; |
6 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; | 6 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; |
7 | use Twig\Environment; | ||
7 | 8 | ||
8 | /** | 9 | /** |
9 | * Custom mailer for TwoFactorBundle email. | 10 | * Custom mailer for TwoFactorBundle email. |
@@ -56,14 +57,14 @@ class AuthCodeMailer implements AuthCodeMailerInterface | |||
56 | /** | 57 | /** |
57 | * Initialize the auth code mailer with the SwiftMailer object. | 58 | * Initialize the auth code mailer with the SwiftMailer object. |
58 | * | 59 | * |
59 | * @param \Swift_Mailer $mailer | 60 | * @param \Swift_Mailer $mailer |
60 | * @param \Twig_Environment $twig | 61 | * @param Environment $twig |
61 | * @param string $senderEmail | 62 | * @param string $senderEmail |
62 | * @param string $senderName | 63 | * @param string $senderName |
63 | * @param string $supportUrl wallabag support url | 64 | * @param string $supportUrl wallabag support url |
64 | * @param string $wallabagUrl wallabag instance url | 65 | * @param string $wallabagUrl wallabag instance url |
65 | */ | 66 | */ |
66 | public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) | 67 | public function __construct(\Swift_Mailer $mailer, Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) |
67 | { | 68 | { |
68 | $this->mailer = $mailer; | 69 | $this->mailer = $mailer; |
69 | $this->twig = $twig; | 70 | $this->twig = $twig; |