Skip to content

Commit

Permalink
Twig 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Aug 5, 2020
1 parent b14ecbd commit cae1295
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 83 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<a name="1.1.1"></a>
# [1.1.1](https://github.com/flextype-plugins/twig/compare/v1.1.0...v1.1.1) (2020-08-05)

### Bug Fixes

* **core** fixes for new Twig 3

<a name="1.1.0"></a>
# [1.1.0](https://github.com/flextype-plugins/twig/compare/v1.0.7...v1.1.0) (2020-08-05)

Expand Down
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Twig
version: 1.2.0
version: 1.1.1
description: Twig plugin to present Twig template engine for Flextype.
icon: fas fa-palette
author:
Expand Down
8 changes: 4 additions & 4 deletions twig/ArraysTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;
use Flextype\Component\Arrays\Arrays;

class ArraysTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
class ArraysTwigExtension extends AbstractExtension implements GlobalsInterface
{
/**
* Flextype Dependency Container
Expand All @@ -31,7 +31,7 @@ public function __construct($flextype)
/**
* Register Global variables in an extension
*/
public function getGlobals()
public function getGlobals() : array
{
return [
'arrays' => new ArraysTwig($this->flextype),
Expand Down
8 changes: 4 additions & 4 deletions twig/CacheTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class CacheTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
class CacheTwigExtension extends AbstractExtension implements GlobalsInterface
{
/**
* Flextype Dependency Container
Expand All @@ -30,7 +30,7 @@ public function __construct($flextype)
/**
* Register Global variables in an extension
*/
public function getGlobals()
public function getGlobals() : array
{
return [
'cache' => $this->flextype['cache'],
Expand Down
8 changes: 3 additions & 5 deletions twig/CollectionTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_SimpleFunction;
use Twig_Extension_GlobalsInterface;
use Twig\Extension\AbstractExtension;

class CollectionTwigExtension extends Twig_Extension
class CollectionTwigExtension extends AbstractExtension
{
/**
* Flextype Dependency Container
Expand All @@ -36,7 +34,7 @@ public function __construct($flextype)
public function getFunctions() : array
{
return [
new Twig_SimpleFunction('collect', [$this, 'collect']),
new \Twig\TwigFunction('collect', [$this, 'collect']),
];
}

Expand Down
11 changes: 5 additions & 6 deletions twig/CsrfTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use Twig_SimpleFunction;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class CsrfTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
class CsrfTwigExtension extends AbstractExtension implements GlobalsInterface
{
/**
* Flextype Dependency Container
Expand All @@ -31,7 +30,7 @@ public function __construct($flextype)
/**
* Register Global variables in an extension
*/
public function getGlobals()
public function getGlobals() : array
{
// CSRF token name and value
$csrfNameKey = $this->flextype->csrf->getTokenNameKey();
Expand Down Expand Up @@ -64,7 +63,7 @@ public function getName()
public function getFunctions() : array
{
return [
new Twig_SimpleFunction('csrf', [$this, 'csrf'], ['is_safe' => ['html']]),
new \Twig\TwigFunction('csrf', [$this, 'csrf'], ['is_safe' => ['html']]),
];
}

Expand Down
8 changes: 4 additions & 4 deletions twig/EmitterTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class EmitterTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
class EmitterTwigExtension extends AbstractExtension implements GlobalsInterface
{
/**
* Flextype Dependency Container
Expand All @@ -30,7 +30,7 @@ public function __construct($flextype)
/**
* Register Global variables in an extension
*/
public function getGlobals()
public function getGlobals() : array
{
return [
'emitter' => new EmitterTwig($this->flextype),
Expand Down
8 changes: 4 additions & 4 deletions twig/EntriesTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class EntriesTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
class EntriesTwigExtension extends AbstractExtension implements GlobalsInterface
{
/**
* Flextype Dependency Container
Expand All @@ -30,7 +30,7 @@ public function __construct($flextype)
/**
* Register Global variables in an extension
*/
public function getGlobals()
public function getGlobals() : array
{
return [
'entries' => new EntriesTwig($this->flextype),
Expand Down
15 changes: 7 additions & 8 deletions twig/FilesystemTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
namespace Flextype\Plugin\Twig\Twig;

use Flextype\Component\Filesystem\Filesystem;
use Twig_Extension;
use Twig_SimpleFunction;
use Twig\Extension\AbstractExtension;
use function basename;
use function strrchr;
use function substr;

class FilesystemTwigExtension extends Twig_Extension
class FilesystemTwigExtension extends AbstractExtension
{
/**
* Callback for twig.
Expand All @@ -26,11 +25,11 @@ class FilesystemTwigExtension extends Twig_Extension
public function getFunctions() : array
{
return [
new Twig_SimpleFunction('filesystem_list_contents', [$this, 'list_contents']),
new Twig_SimpleFunction('filesystem_has', [$this, 'has']),
new Twig_SimpleFunction('filesystem_read', [$this, 'read']),
new Twig_SimpleFunction('filesystem_ext', [$this, 'ext']),
new Twig_SimpleFunction('filesystem_basename', [$this, 'basename']),
new \Twig\TwigFunction('filesystem_list_contents', [$this, 'list_contents']),
new \Twig\TwigFunction('filesystem_has', [$this, 'has']),
new \Twig\TwigFunction('filesystem_read', [$this, 'read']),
new \Twig\TwigFunction('filesystem_ext', [$this, 'ext']),
new \Twig\TwigFunction('filesystem_basename', [$this, 'basename']),
];
}

Expand Down
7 changes: 3 additions & 4 deletions twig/FlashTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_SimpleFunction;
use Twig\Extension\AbstractExtension;

class FlashTwigExtension extends Twig_Extension
class FlashTwigExtension extends AbstractExtension
{
/**
* Flextype Dependency Container
Expand All @@ -35,7 +34,7 @@ public function __construct($flextype)
public function getFunctions() : array
{
return [
new Twig_SimpleFunction('flash', [$this, 'getMessages']),
new \Twig\TwigFunction('flash', [$this, 'getMessages']),
];
}

Expand Down
8 changes: 4 additions & 4 deletions twig/GlobalVarsTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;
use const PHP_VERSION;

class GlobalVarsTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
class GlobalVarsTwigExtension extends AbstractExtension implements GlobalsInterface
{
/**
* Flextype Dependency Container
Expand All @@ -31,7 +31,7 @@ public function __construct($flextype)
/**
* Register Global variables in an extension
*/
public function getGlobals()
public function getGlobals() : array
{
return [
'PATH_PROJECT' => PATH['project'],
Expand Down
12 changes: 5 additions & 7 deletions twig/I18nTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
namespace Flextype\Plugin\Twig\Twig;

use Flextype\Component\I18n\I18n;
use Twig_Extension;
use Twig_SimpleFilter;
use Twig_SimpleFunction;
use Twig\Extension\AbstractExtension;

class I18nTwigExtension extends Twig_Extension
class I18nTwigExtension extends AbstractExtension
{
/**
* Returns a list of functions to add to the existing list.
Expand All @@ -24,8 +22,8 @@ class I18nTwigExtension extends Twig_Extension
public function getFunctions() : array
{
return [
new Twig_SimpleFunction('tr', [$this, 'tr']),
new Twig_SimpleFunction('__', [$this, 'tr']),
new \Twig\TwigFunction('tr', [$this, 'tr']),
new \Twig\TwigFunction('__', [$this, 'tr']),
];
}

Expand All @@ -37,7 +35,7 @@ public function getFunctions() : array
public function getFilters() : array
{
return [
new Twig_SimpleFilter('tr', [$this, 'tr'])
new \Twig\TwigFilter('tr', [$this, 'tr'])
];
}

Expand Down
14 changes: 6 additions & 8 deletions twig/JsonTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_SimpleFilter;
use Twig_SimpleFunction;
use Twig\Extension\AbstractExtension;

class JsonTwigExtension extends Twig_Extension
class JsonTwigExtension extends AbstractExtension
{
/**
* Flextype Dependency Container
Expand All @@ -36,8 +34,8 @@ public function __construct($flextype)
public function getFunctions() : array
{
return [
new Twig_SimpleFunction('json_decode', [$this, 'decode']),
new Twig_SimpleFunction('json_encode', [$this, 'encode']),
new \Twig\TwigFunction('json_decode', [$this, 'decode']),
new \Twig\TwigFunction('json_encode', [$this, 'encode']),
];
}

Expand All @@ -49,8 +47,8 @@ public function getFunctions() : array
public function getFilters() : array
{
return [
new Twig_SimpleFilter('json_decode', [$this, 'decode']),
new Twig_SimpleFilter('json_encode', [$this, 'encode']),
new \Twig\TwigFilter('json_decode', [$this, 'decode']),
new \Twig\TwigFilter('json_encode', [$this, 'encode']),
];
}

Expand Down
7 changes: 3 additions & 4 deletions twig/MarkdownTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_SimpleFilter;
use Twig\Extension\AbstractExtension;

class MarkdownTwigExtension extends Twig_Extension
class MarkdownTwigExtension extends AbstractExtension
{
/**
* Flextype Dependency Container
Expand All @@ -35,7 +34,7 @@ public function __construct($flextype)
public function getFilters() : array
{
return [
new Twig_SimpleFilter('markdown', [$this, 'markdown']),
new \Twig\TwigFilter('markdown', [$this, 'markdown']),
];
}

Expand Down
8 changes: 4 additions & 4 deletions twig/RegistryTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class RegistryTwigExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
class RegistryTwigExtension extends AbstractExtension implements GlobalsInterface
{
/**
* Flextype Dependency Container
Expand All @@ -30,7 +30,7 @@ public function __construct($flextype)
/**
* Register Global variables in an extension
*/
public function getGlobals()
public function getGlobals() : array
{
return [
'registry' => new RegistryTwig($this->flextype),
Expand Down
7 changes: 3 additions & 4 deletions twig/ShortcodeTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@

namespace Flextype\Plugin\Twig\Twig;

use Twig_Extension;
use Twig_SimpleFilter;
use Twig\Extension\AbstractExtension;

class ShortcodeTwigExtension extends Twig_Extension
class ShortcodeTwigExtension extends AbstractExtension
{
/**
* Flextype Dependency Container
Expand All @@ -35,7 +34,7 @@ public function __construct($flextype)
public function getFilters() : array
{
return [
new Twig_SimpleFilter('shortcode', [$this, 'shortcode']),
new \Twig\TwigFilter('shortcode', [$this, 'shortcode']),
];
}

Expand Down
Loading

0 comments on commit cae1295

Please sign in to comment.