summaryrefslogtreecommitdiffstats
path: root/lib/twig.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/twig.php')
-rw-r--r--lib/twig.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/twig.php b/lib/twig.php
index db1354d..7de451e 100644
--- a/lib/twig.php
+++ b/lib/twig.php
@@ -1,7 +1,6 @@
<?php
-require_once('Twig/Autoloader.php');
-Twig_Autoloader::register();
+require_once('Twig/autoload.php');
class Twig_Loader_Dokuwiki implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
{
@@ -9,10 +8,16 @@ class Twig_Loader_Dokuwiki implements Twig_LoaderInterface, Twig_ExistsLoaderInt
return 'hostinfo:templates:' . cleanID($name);
}
- public function getSource($name)
+ public function getSourceContext($name)
{
$page = $this->build_pagename($name);
- return rawWiki($page);
+ $source = rawWiki($page);
+
+ if (!$source) {
+ throw new \Twig\Error\LoaderError(sprintf('Template "%s" does not exist.', $name));
+ }
+
+ return new \Twig\Source($source, $name);
}
public function getCacheKey($name)