mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-27 17:28:39 +00:00
Use Twig 2.0
`mnapoli/piwik-twig-extension` locked Twig to the 1.10 version. The new version is compatible with Twig 2.0
This commit is contained in:
parent
0a01a5f195
commit
a2f4efe6d2
6 changed files with 56 additions and 39 deletions
|
@ -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(
|
||||
|
|
|
@ -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']),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue