From a2f4efe6d2a90d8a2b84a275f48a07dc8aa0a84f Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 21 Jun 2019 12:46:53 +0200 Subject: Use Twig 2.0 `mnapoli/piwik-twig-extension` locked Twig to the 1.10 version. The new version is compatible with Twig 2.0 --- .../CoreBundle/Controller/FeedController.php | 2 +- src/Wallabag/CoreBundle/Twig/WallabagExtension.php | 23 +++++++++++++++------- src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | 15 +++++++------- 3 files changed, 25 insertions(+), 15 deletions(-) (limited to 'src') 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 $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); $entries = new Pagerfanta($pagerAdapter); - $perPage = $user->getConfig()->getFeedLimit() ?: $this->getParameter('wallabag_core.Feed_limit'); + $perPage = $user->getConfig()->getFeedLimit() ?: $this->getParameter('wallabag_core.feed_limit'); $entries->setMaxPerPage($perPage); $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; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Translation\TranslatorInterface; +use Twig\Extension\AbstractExtension; +use Twig\Extension\GlobalsInterface; +use Twig\TwigFilter; +use Twig\TwigFunction; use Wallabag\CoreBundle\Repository\EntryRepository; use Wallabag\CoreBundle\Repository\TagRepository; -class WallabagExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface +class WallabagExtension extends AbstractExtension implements GlobalsInterface { private $tokenStorage; private $entryRepository; @@ -24,21 +28,26 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa $this->translator = $translator; } + public function getGlobals() + { + return []; + } + public function getFilters() { return [ - new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']), - new \Twig_SimpleFilter('removeScheme', [$this, 'removeScheme']), - new \Twig_SimpleFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']), + new TwigFilter('removeWww', [$this, 'removeWww']), + new TwigFilter('removeScheme', [$this, 'removeScheme']), + new TwigFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']), ]; } public function getFunctions() { return [ - new \Twig_SimpleFunction('count_entries', [$this, 'countEntries']), - new \Twig_SimpleFunction('count_tags', [$this, 'countTags']), - new \Twig_SimpleFunction('display_stats', [$this, 'displayStats']), + new TwigFunction('count_entries', [$this, 'countEntries']), + new TwigFunction('count_tags', [$this, 'countTags']), + new TwigFunction('display_stats', [$this, 'displayStats']), ]; } 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; use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; +use Twig\Environment; /** * Custom mailer for TwoFactorBundle email. @@ -56,14 +57,14 @@ class AuthCodeMailer implements AuthCodeMailerInterface /** * Initialize the auth code mailer with the SwiftMailer object. * - * @param \Swift_Mailer $mailer - * @param \Twig_Environment $twig - * @param string $senderEmail - * @param string $senderName - * @param string $supportUrl wallabag support url - * @param string $wallabagUrl wallabag instance url + * @param \Swift_Mailer $mailer + * @param Environment $twig + * @param string $senderEmail + * @param string $senderName + * @param string $supportUrl wallabag support url + * @param string $wallabagUrl wallabag instance url */ - public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) + public function __construct(\Swift_Mailer $mailer, Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) { $this->mailer = $mailer; $this->twig = $twig; -- cgit v1.2.3 From ac5844a68e6384af447c67d9e5638795a02c9d99 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 21 Jun 2019 12:54:52 +0200 Subject: Typo --- src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index e131deb6..b25ba685 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php @@ -22,7 +22,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface /** * Twig to render the html's email. * - * @var \Twig_Environment + * @var Environment */ private $twig; -- cgit v1.2.3