-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.php
More file actions
executable file
·45 lines (39 loc) · 1.56 KB
/
template.php
File metadata and controls
executable file
·45 lines (39 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
// ==============================================================
// Copyright (C) 2014 Mark Vejvoda
// Under GNU GPL v3.0
// ==============================================================
namespace riprunner;
require_once 'config_constants.php';
require __DIR__ . '/vendor/autoload.php';
//use Twig\Extensions\TextExtension;
class RiprunnerTwig {
private $twig_template_loader = null;
private $twig = null;
public function getLoader() {
if($this->twig_template_loader === null) {
$this->twig_template_loader = new \Twig\Loader\FilesystemLoader(
__RIPRUNNER_ROOT__ . '/views');
// This allows customized views to be placed in the folder below
if(file_exists(__RIPRUNNER_ROOT__ . '/views-custom') === true) {
$this->twig_template_loader->addPath(__RIPRUNNER_ROOT__ . '/views-custom', 'custom');
}
return $this->twig_template_loader;
}
}
public function getEnvironment() {
if($this->twig === null) {
$this->twig = new \Twig\Environment($this->getLoader(), array(
'cache' => __RIPRUNNER_ROOT__ . '/temp/twig',
'debug' => true,
'strict_variables' => true
));
// $this->twig->addExtension(new TextExtension());
}
return $this->twig;
}
}
$riprunner_twig = new \riprunner\RiprunnerTwig();
$twig = $riprunner_twig->getEnvironment();
//$twig->addExtension(new \Twig_Extension_Debug());
//$twig->addExtension(new \Twig_Extensions_Extension_Text());