fix(php8): be compatible
This commit is contained in:
parent
344e486bbc
commit
8a41bb6b94
@ -1,5 +1,5 @@
|
||||
---
|
||||
Logo: %theme_url%/img/pico-white.svg
|
||||
Logo: '%theme_url%/img/pico-white.svg'
|
||||
Tagline: Making the web easy.
|
||||
Social:
|
||||
- title: Visit us on GitHub
|
||||
|
10
lib/Pico.php
10
lib/Pico.php
@ -2102,12 +2102,12 @@ class Pico
|
||||
if ($this->twig === null) {
|
||||
$twigConfig = $this->getConfig('twig_config');
|
||||
|
||||
$twigLoader = new Twig_Loader_Filesystem($this->getThemesDir() . $this->getTheme());
|
||||
$this->twig = new Twig_Environment($twigLoader, $twigConfig);
|
||||
$twigLoader = new \Twig\Loader\FilesystemLoader($this->getThemesDir() . $this->getTheme());
|
||||
$this->twig = new \Twig\Environment($twigLoader, $twigConfig);
|
||||
$this->twig->addExtension(new PicoTwigExtension($this));
|
||||
|
||||
if (!empty($twigConfig['debug'])) {
|
||||
$this->twig->addExtension(new Twig_Extension_Debug());
|
||||
$this->twig->addExtension(new Twig\Extension\DebugExtension());
|
||||
}
|
||||
|
||||
// register content filter
|
||||
@ -2115,7 +2115,7 @@ class Pico
|
||||
// this is the reason why we can't register this filter as part of PicoTwigExtension
|
||||
$pico = $this;
|
||||
$pages = &$this->pages;
|
||||
$this->twig->addFilter(new Twig_SimpleFilter(
|
||||
$this->twig->addFilter(new \Twig\TwigFilter(
|
||||
'content',
|
||||
function ($page) use ($pico, &$pages) {
|
||||
if (isset($pages[$page])) {
|
||||
@ -2156,7 +2156,7 @@ class Pico
|
||||
'theme_url' => $this->getConfig('themes_url') . $this->getTheme(),
|
||||
'site_title' => $this->getConfig('site_title'),
|
||||
'meta' => $this->meta,
|
||||
'content' => new Twig_Markup($this->content, 'UTF-8'),
|
||||
'content' => new \Twig\Markup($this->content, 'UTF-8'),
|
||||
'pages' => $this->pages,
|
||||
'previous_page' => $this->previousPage,
|
||||
'current_page' => $this->currentPage,
|
||||
|
@ -67,20 +67,20 @@ class PicoTwigExtension extends Twig_Extension
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
return array(
|
||||
'markdown' => new Twig_SimpleFilter(
|
||||
'markdown' => new \Twig\TwigFilter(
|
||||
'markdown',
|
||||
array($this, 'markdownFilter'),
|
||||
array('is_safe' => array('html'))
|
||||
),
|
||||
'map' => new Twig_SimpleFilter('map', array($this, 'mapFilter')),
|
||||
'sort_by' => new Twig_SimpleFilter('sort_by', array($this, 'sortByFilter')),
|
||||
'link' => new Twig_SimpleFilter('link', array($this->pico, 'getPageUrl')),
|
||||
'url' => new Twig_SimpleFilter('url', array($this->pico, 'substituteUrl'))
|
||||
'map' => new \Twig\TwigFilter('map', array($this, 'mapFilter')),
|
||||
'sort_by' => new \Twig\TwigFilter('sort_by', array($this, 'sortByFilter')),
|
||||
'link' => new \Twig\TwigFilter('link', array($this->pico, 'getPageUrl')),
|
||||
'url' => new \Twig\TwigFilter('url', array($this->pico, 'substituteUrl'))
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user