fix(php8): be compatible

This commit is contained in:
Jérémy Dufraisse 2023-01-24 10:34:22 +01:00
parent 344e486bbc
commit 8a41bb6b94
3 changed files with 12 additions and 12 deletions

View File

@ -1,5 +1,5 @@
--- ---
Logo: %theme_url%/img/pico-white.svg Logo: '%theme_url%/img/pico-white.svg'
Tagline: Making the web easy. Tagline: Making the web easy.
Social: Social:
- title: Visit us on GitHub - title: Visit us on GitHub

View File

@ -2102,12 +2102,12 @@ class Pico
if ($this->twig === null) { if ($this->twig === null) {
$twigConfig = $this->getConfig('twig_config'); $twigConfig = $this->getConfig('twig_config');
$twigLoader = new Twig_Loader_Filesystem($this->getThemesDir() . $this->getTheme()); $twigLoader = new \Twig\Loader\FilesystemLoader($this->getThemesDir() . $this->getTheme());
$this->twig = new Twig_Environment($twigLoader, $twigConfig); $this->twig = new \Twig\Environment($twigLoader, $twigConfig);
$this->twig->addExtension(new PicoTwigExtension($this)); $this->twig->addExtension(new PicoTwigExtension($this));
if (!empty($twigConfig['debug'])) { if (!empty($twigConfig['debug'])) {
$this->twig->addExtension(new Twig_Extension_Debug()); $this->twig->addExtension(new Twig\Extension\DebugExtension());
} }
// register content filter // register content filter
@ -2115,7 +2115,7 @@ class Pico
// this is the reason why we can't register this filter as part of PicoTwigExtension // this is the reason why we can't register this filter as part of PicoTwigExtension
$pico = $this; $pico = $this;
$pages = &$this->pages; $pages = &$this->pages;
$this->twig->addFilter(new Twig_SimpleFilter( $this->twig->addFilter(new \Twig\TwigFilter(
'content', 'content',
function ($page) use ($pico, &$pages) { function ($page) use ($pico, &$pages) {
if (isset($pages[$page])) { if (isset($pages[$page])) {
@ -2156,7 +2156,7 @@ class Pico
'theme_url' => $this->getConfig('themes_url') . $this->getTheme(), 'theme_url' => $this->getConfig('themes_url') . $this->getTheme(),
'site_title' => $this->getConfig('site_title'), 'site_title' => $this->getConfig('site_title'),
'meta' => $this->meta, 'meta' => $this->meta,
'content' => new Twig_Markup($this->content, 'UTF-8'), 'content' => new \Twig\Markup($this->content, 'UTF-8'),
'pages' => $this->pages, 'pages' => $this->pages,
'previous_page' => $this->previousPage, 'previous_page' => $this->previousPage,
'current_page' => $this->currentPage, 'current_page' => $this->currentPage,

View File

@ -67,20 +67,20 @@ class PicoTwigExtension extends Twig_Extension
* *
* @see Twig_ExtensionInterface::getFilters() * @see Twig_ExtensionInterface::getFilters()
* *
* @return Twig_SimpleFilter[] array of Pico's Twig filters * @return \Twig\TwigFilter[] array of Pico's Twig filters
*/ */
public function getFilters() public function getFilters()
{ {
return array( return array(
'markdown' => new Twig_SimpleFilter( 'markdown' => new \Twig\TwigFilter(
'markdown', 'markdown',
array($this, 'markdownFilter'), array($this, 'markdownFilter'),
array('is_safe' => array('html')) array('is_safe' => array('html'))
), ),
'map' => new Twig_SimpleFilter('map', array($this, 'mapFilter')), 'map' => new \Twig\TwigFilter('map', array($this, 'mapFilter')),
'sort_by' => new Twig_SimpleFilter('sort_by', array($this, 'sortByFilter')), 'sort_by' => new \Twig\TwigFilter('sort_by', array($this, 'sortByFilter')),
'link' => new Twig_SimpleFilter('link', array($this->pico, 'getPageUrl')), 'link' => new \Twig\TwigFilter('link', array($this->pico, 'getPageUrl')),
'url' => new Twig_SimpleFilter('url', array($this->pico, 'substituteUrl')) 'url' => new \Twig\TwigFilter('url', array($this->pico, 'substituteUrl'))
); );
} }