summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah BrĂ¼chert <jbb@kaidan.im>2024-03-24 16:52:21 +0100
committerroot <root@vm-doku.spline.inf.fu-berlin.de>2024-03-24 16:52:21 +0100
commite14fce2076d65bfb0216fc72056e7233182ba307 (patch)
treed6e50dfef1bb43e83611529507276a598f703b76
parent42ada13ade5dd831789e37eae07b741ae0287f9d (diff)
downloaddokuwiki-e14fce2076d65bfb0216fc72056e7233182ba307.tar.gz
dokuwiki-e14fce2076d65bfb0216fc72056e7233182ba307.tar.bz2
dokuwiki-e14fce2076d65bfb0216fc72056e7233182ba307.zip
Second round of twig 3 fixes
-rw-r--r--lib/twig.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/twig.php b/lib/twig.php
index dfe735b..aeb39f1 100644
--- a/lib/twig.php
+++ b/lib/twig.php
@@ -6,6 +6,7 @@ use Twig\Loader\LoaderInterface;
use Twig\Source;
use Twig\Extension\AbstractExtension;
use Twig\Environment;
+use Twig\TwigFilter;
class Twig_Loader_Dokuwiki implements LoaderInterface
{
@@ -49,7 +50,7 @@ class Hostinfo_Twig_Extension extends AbstractExtension
public function getFilters()
{
return array(
- new Twig_SimpleFilter('contact_info', function($value) {
+ new TwigFilter('contact_info', function($value) {
if (is_array($value)) {
return '[[' . current($value) . '|' . key($value) . ']]';
}
@@ -57,7 +58,7 @@ class Hostinfo_Twig_Extension extends AbstractExtension
return '[[' . $value . '@spline.inf.fu-berlin.de' . '|' . $value . ']]';
}),
- new Twig_SimpleFilter('parse_service', function($value) {
+ new TwigFilter('parse_service', function($value) {
if (is_array($value)) {
return array(
'port' => current($value),
@@ -71,7 +72,7 @@ class Hostinfo_Twig_Extension extends AbstractExtension
);
}),
- new Twig_SimpleFilter('group_by', function($value, $key) {
+ new TwigFilter('group_by', function($value, $key) {
$array = array();
foreach ($value as $k => $v) {
@@ -90,7 +91,7 @@ class Hostinfo_Twig_Extension extends AbstractExtension
return $array;
}),
- new Twig_SimpleFilter('key_not_exists', function($value, $key) {
+ new TwigFilter('key_not_exists', function($value, $key) {
if (!is_array($value)) {
return array();
}
@@ -101,11 +102,11 @@ class Hostinfo_Twig_Extension extends AbstractExtension
});
}),
- new Twig_SimpleFilter('count', function($value) {
+ new TwigFilter('count', function($value) {
return count($value);
}),
- new Twig_SimpleFilter('length', function($value) {
+ new TwigFilter('length', function($value) {
return strlen($value);
}),
);
@@ -129,9 +130,9 @@ class Twig
$this->twig->addExtension(new Hostinfo_Twig_Extension());
}
- public function render($template, $vars=null)
+ public function render(string $template, $vars=null)
{
- $tmpl = $this->twig->loadTemplate($template . '.tpl');
+ $tmpl = $this->twig->load($template . '.tpl');
return $tmpl->render($vars);
}
}