public static function init()
    {
        self::$loader = new Twig_Loader_Filesystem();

        $config = Config::getInstance();

        foreach (array_reverse($config->get('Octo.paths.templates', [])) as $path) {
            self::$loader->addPath($path);
        }

        foreach (array_reverse($config->get('Octo.paths.admin_templates', [])) as $path) {
            self::$loader->addPath($path, 'admin');
        }

        self::$loader->addPath(CMS_PATH . 'Database/Templates/', 'db');

        if (OCTO_CACHE_ENABLED) {
            self::$cache = OCTO_CACHE_PATH;
        } else {
            self::$cache = false;
        }

        self::$twig = new Twig_Environment(self::$loader, [
            'charset' => 'UTF-8',
            'cache' => self::$cache,
            'auto_reload' => true,
            'strict_variables' => false,
        ]);

        $functions = [];
        Event::trigger('TemplateInit', $functions);

        foreach ($functions as $name => $callable) {
            self::addFunction($name, $callable);
        }

        self::$initialised = true;
    }
public static function init()
    {
        self::$loader = new Twig_Loader_Filesystem();

        $config = Config::getInstance();

        foreach (array_reverse($config->get('Octo.paths.templates', [])) as $path) {
            self::$loader->addPath($path);
        }

        foreach (array_reverse($config->get('Octo.paths.admin_templates', [])) as $path) {
            self::$loader->addPath($path, 'admin');
        }

        self::$loader->addPath(CMS_PATH . 'Database/Templates/', 'db');

        if (OCTO_CACHE_ENABLED) {
            self::$cache = OCTO_CACHE_PATH;
        } else {
            self::$cache = false;
        }

        self::$twig = new Twig_Environment(self::$loader, [
            'charset' => 'UTF-8',
            'cache' => self::$cache,
            'auto_reload' => true,
            'strict_variables' => false,
        ]);

        $functions = [];
        Event::trigger('TemplateInit', $functions);

        foreach ($functions as $name => $callable) {
            self::addFunction($name, $callable);
        }

        self::$initialised = true;
    }
public static function init ( ) { self :: $ loader = new Twig_Loader_Filesystem ( ) ; $ config = Config :: getInstance ( ) ; foreach ( array_reverse ( $ config -> get ( 'Octo.paths.templates' , [ ] ) ) as $ path ) { self :: $ loader -> addPath ( $ path ) ; } foreach ( array_reverse ( $ config -> get ( 'Octo.paths.admin_templates' , [ ] ) ) as $ path ) { self :: $ loader -> addPath ( $ path , 'admin' ) ; } self :: $ loader -> addPath ( CMS_PATH . 'Database/Templates/' , 'db' ) ; if ( OCTO_CACHE_ENABLED ) { self :: $ cache = OCTO_CACHE_PATH ; } else { self :: $ cache = false ; } self :: $ twig = new Twig_Environment ( self :: $ loader , [ 'charset' => 'UTF-8' , 'cache' => self :: $ cache , 'auto_reload' => true , 'strict_variables' => false , ] ) ; $ functions = [ ] ; Event :: trigger ( 'TemplateInit' , $ functions ) ; foreach ( $ functions as $ name => $ callable ) { self :: addFunction ( $ name , $ callable ) ; } self :: $ initialised = true ; }
Sets up the twig template loader.
Sets up the twig template loader .