|
@@ -35,7 +35,7 @@ discard block |
|
|
block discarded – undo |
|
35
|
35
|
|
|
36
|
36
|
$cachedOutput = $this->loadTemplate(); |
|
37
|
37
|
//To be a valid XML document it must have a root element, automatically wrap it in <template> to ensure it does |
|
38
|
|
- $template = new Template($this->isValidDoc($cachedOutput['body']) ? $cachedOutput['body'] : '<template>' . $cachedOutput['body'] . '</template>' ); |
|
|
38
|
+ $template = new Template($this->isValidDoc($cachedOutput['body']) ? $cachedOutput['body'] : '<template>'.$cachedOutput['body'].'</template>'); |
|
39
|
39
|
|
|
40
|
40
|
//Allow $time to be set via arguments to spoof time passage during tests |
|
41
|
41
|
foreach ($this->getRules($template) as $rule) { |
|
@@ -71,8 +71,8 @@ discard block |
|
|
block discarded – undo |
|
71
|
71
|
|
|
72
|
72
|
private function getRules($template) { |
|
73
|
73
|
if (is_file($this->tss)) { |
|
74
|
|
- $this->baseDir = dirname(realpath($this->tss)) . DIRECTORY_SEPARATOR; |
|
75
|
|
- $key = $this->tss . $template->getPrefix() . $this->baseDir; |
|
|
74
|
+ $this->baseDir = dirname(realpath($this->tss)).DIRECTORY_SEPARATOR; |
|
|
75
|
+ $key = $this->tss.$template->getPrefix().$this->baseDir; |
|
76
|
76
|
$rules = $this->cache->load($key, filemtime($this->tss)); |
|
77
|
77
|
if (!$rules) return $this->cache->write($key, (new Sheet(file_get_contents($this->tss), $this->baseDir, $template->getPrefix()))->parse()); |
|
78
|
78
|
else return $rules; |
|
@@ -96,8 +96,8 @@ discard block |
|
|
block discarded – undo |
|
96
|
96
|
|
|
97
|
97
|
private function getLocale() { |
|
98
|
98
|
if (is_array($this->locale)) return $this->locale; |
|
99
|
|
- else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . $this->locale . '.json'), true); |
|
100
|
|
- else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true); |
|
|
99
|
+ else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.$this->locale.'.json'), true); |
|
|
100
|
+ else return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.'enGB.json'), true); |
|
101
|
101
|
} |
|
102
|
102
|
|
|
103
|
103
|
public function registerProperties($object) { |