|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SSpkS\Output; |
|
4
|
|
|
|
|
5
|
|
|
use \Mustache_Engine; |
|
|
|
|
|
|
6
|
|
|
use \Mustache_Loader_FilesystemLoader; |
|
|
|
|
|
|
7
|
|
|
use \Mustache_Logger_StreamLogger; |
|
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
class HtmlOutput |
|
10
|
|
|
{ |
|
11
|
|
|
private $config; |
|
12
|
|
|
private $mustache; |
|
13
|
|
|
private $tplVars; |
|
14
|
|
|
private $template; |
|
15
|
|
|
|
|
16
|
|
|
public function __construct(\SSpkS\Config $config) |
|
17
|
|
|
{ |
|
18
|
|
|
$this->config = $config; |
|
19
|
|
|
$tplBase = $this->config->basePath . DIRECTORY_SEPARATOR . $this->config->paths['themes']; |
|
20
|
|
|
$tplBase .= $this->config->site['theme'] . DIRECTORY_SEPARATOR . 'templates'; |
|
21
|
|
|
|
|
22
|
|
|
$this->mustache = new Mustache_Engine(array( |
|
23
|
|
|
'loader' => new Mustache_Loader_FilesystemLoader($tplBase), |
|
24
|
|
|
'partials_loader' => new Mustache_Loader_FilesystemLoader($tplBase . '/partials'), |
|
25
|
|
|
'charset' => 'utf-8', |
|
26
|
|
|
'logger' => new Mustache_Logger_StreamLogger('php://stderr'), |
|
27
|
|
|
)); |
|
28
|
|
|
|
|
29
|
|
|
$this->setVariable('siteName', $this->config->site['name']); |
|
30
|
|
|
$this->setVariable('baseUrl', $this->config->baseUrl); |
|
31
|
|
|
$this->setVariable('baseUrlRelative', $this->config->baseUrlRelative); |
|
32
|
|
|
$this->setVariable('themeUrl', $this->config->baseUrlRelative . $this->config->paths['themes'] . $this->config->site['theme'] . '/'); |
|
33
|
|
|
$this->setVariable('requestUri', $_SERVER['REQUEST_URI']); |
|
34
|
|
|
$this->setVariable('commitHash', $this->config->SSPKS_COMMIT); |
|
35
|
|
|
$this->setVariable('branch', $this->config->SSPKS_BRANCH); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param string $name |
|
40
|
|
|
* @param mixed $value |
|
41
|
|
|
*/ |
|
42
|
|
|
public function setVariable($name, $value) |
|
43
|
|
|
{ |
|
44
|
|
|
$this->tplVars[$name] = $value; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param string $tplName |
|
49
|
|
|
*/ |
|
50
|
|
|
public function setTemplate($tplName) |
|
51
|
|
|
{ |
|
52
|
|
|
$this->template = $tplName; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function output() |
|
56
|
|
|
{ |
|
57
|
|
|
$tpl = $this->mustache->loadTemplate($this->template); |
|
58
|
|
|
echo $tpl->render($this->tplVars); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths