diff --git a/system/init.php b/system/init.php index 8a5e9601..faf846de 100644 --- a/system/init.php +++ b/system/init.php @@ -32,36 +32,7 @@ require_once SYSTEM . 'libs/cache.php'; $cache = Cache::getInstance($config['cache_engine'], $config['cache_prefix']); // twig -require_once LIBS . 'Twig/Autoloader.php'; -Twig_Autoloader::register(); - -$twig_loader = new Twig_Loader_Filesystem(SYSTEM . 'templates'); -$twig = new Twig_Environment($twig_loader, array( - 'cache' => CACHE . 'twig/', - 'auto_reload' => true, - //'debug' => true -)); - -$function = new Twig_SimpleFunction('getStyle', function ($i) { - return getStyle($i); -}); -$twig->addFunction($function); - -$function = new Twig_SimpleFunction('getLink', function ($s) { - return getLink($s); -}); -$twig->addFunction($function); - -$function = new Twig_SimpleFunction('hook', function ($hook) { - global $hooks; - $hooks->trigger($hook); -}); -$twig->addFunction($function); - -$filter = new Twig_SimpleFilter('urlencode', function ($s) { - return urlencode($s); -}); -$twig->addFilter($filter); +require_once SYSTEM . 'twig.php'; // trim values we receive if(isset($_POST)) diff --git a/system/twig.php b/system/twig.php new file mode 100644 index 00000000..5d30bcfe --- /dev/null +++ b/system/twig.php @@ -0,0 +1,32 @@ + CACHE . 'twig/', + 'auto_reload' => true, + //'debug' => true +)); + +$function = new Twig_SimpleFunction('getStyle', function ($i) { + return getStyle($i); +}); +$twig->addFunction($function); + +$function = new Twig_SimpleFunction('getLink', function ($s) { + return getLink($s); +}); +$twig->addFunction($function); + +$function = new Twig_SimpleFunction('hook', function ($hook) { + global $hooks; + $hooks->trigger($hook); +}); +$twig->addFunction($function); + +$filter = new Twig_SimpleFilter('urlencode', function ($s) { + return urlencode($s); +}); +$twig->addFilter($filter); \ No newline at end of file