1
|
|
|
<?php |
2
|
|
|
/*************************************************************************************/ |
3
|
|
|
/* This file is part of the Thelia package. */ |
4
|
|
|
/* */ |
5
|
|
|
/* Copyright (c) OpenStudio */ |
6
|
|
|
/* email : [email protected] */ |
7
|
|
|
/* web : http://www.thelia.net */ |
8
|
|
|
/* */ |
9
|
|
|
/* For the full copyright and license information, please view the LICENSE.txt */ |
10
|
|
|
/* file that was distributed with this source code. */ |
11
|
|
|
/*************************************************************************************/ |
12
|
|
|
namespace Thelia\Core\Template\Parser; |
13
|
|
|
|
14
|
|
|
use Thelia\Core\HttpFoundation\Request; |
15
|
|
|
use Thelia\Core\Template\ParserInterface; |
16
|
|
|
use Thelia\Core\Template\TemplateDefinition; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class ParserFallback |
20
|
|
|
* @author manuel raynaud <[email protected]> |
21
|
|
|
*/ |
22
|
|
|
class ParserFallback implements ParserInterface |
23
|
|
|
{ |
24
|
|
|
public function render($realTemplateName, array $parameters = array(), $compressOutput = true) |
25
|
|
|
{ |
26
|
|
|
$this->throwException(); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function renderString($templateText, array $parameters = array(), $compressOutput = true) |
30
|
|
|
{ |
31
|
|
|
$this->throwException(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getStatus() |
35
|
|
|
{ |
36
|
|
|
$this->throwException(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function setStatus($status) |
40
|
|
|
{ |
41
|
|
|
$this->throwException(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Setup the parser with a template definition, which provides a template description. |
46
|
|
|
* |
47
|
|
|
* @param TemplateDefinition $templateDefinition |
48
|
|
|
*/ |
49
|
|
|
public function setTemplateDefinition(TemplateDefinition $templateDefinition, $fallbackToDefaultTemplate = false) |
50
|
|
|
{ |
51
|
|
|
$this->throwException(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Get template definition |
56
|
|
|
* |
57
|
|
|
* @param bool $webAssetTemplate Allow to load asset from another template |
58
|
|
|
* If the name of the template if provided |
59
|
|
|
* |
60
|
|
|
* @return TemplateDefinition |
61
|
|
|
*/ |
62
|
|
|
public function getTemplateDefinition($webAssetTemplate = false) |
63
|
|
|
{ |
64
|
|
|
$this->throwException(); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Add a template directory to the current template list |
69
|
|
|
* |
70
|
|
|
* @param int $templateType the template type ( |
71
|
|
|
* |
72
|
|
|
* @param string $templateName the template name |
73
|
|
|
* @param string $templateDirectory path to the template dirtectory |
74
|
|
|
* @param string $key ??? |
75
|
|
|
* @param bool $unshift ??? Etienne ? |
76
|
|
|
*/ |
77
|
|
|
public function addTemplateDirectory($templateType, $templateName, $templateDirectory, $key, $unshift = false) |
78
|
|
|
{ |
79
|
|
|
$this->throwException(); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Return the registeted template directories for a givent template type |
84
|
|
|
* |
85
|
|
|
* @param int $templateType |
86
|
|
|
* @throws \InvalidArgumentException if the templateType is not defined |
87
|
|
|
* @return array: an array of defined templates directories for the given template type |
88
|
|
|
*/ |
89
|
|
|
public function getTemplateDirectories($templateType) |
90
|
|
|
{ |
91
|
|
|
$this->throwException(); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Create a variable that will be available in the templates |
96
|
|
|
* |
97
|
|
|
* @param string $variable the variable name |
98
|
|
|
* @param mixed $value the value of the variable |
99
|
|
|
*/ |
100
|
|
|
public function assign($variable, $value = null) |
101
|
|
|
{ |
102
|
|
|
$this->throwException(); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return \Thelia\Core\Template\TemplateHelperInterface the parser template helper instance |
107
|
|
|
*/ |
108
|
|
|
public function getTemplateHelper() |
109
|
|
|
{ |
110
|
|
|
$this->throwException(); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
private function throwException() |
114
|
|
|
{ |
115
|
|
|
throw new \RuntimeException('if you want to use a parser, please register one'); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Returns the request used by the parser |
120
|
|
|
* |
121
|
|
|
* @return Request |
122
|
|
|
*/ |
123
|
|
|
public function getRequest() |
124
|
|
|
{ |
125
|
|
|
$this->throwException(); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Set a new template definition, and save the current one |
130
|
|
|
* |
131
|
|
|
* @param TemplateDefinition $templateDefinition |
132
|
|
|
* @param bool $fallbackToDefaultTemplate if true, resources will be also searched in the "default" template |
133
|
|
|
* @throws \SmartyException |
134
|
|
|
*/ |
135
|
|
|
public function pushTemplateDefinition(TemplateDefinition $templateDefinition, $fallbackToDefaultTemplate = false) |
136
|
|
|
{ |
137
|
|
|
$this->throwException(); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Restore the previous stored template definition, if one exists. |
142
|
|
|
* |
143
|
|
|
* @throws \SmartyException |
144
|
|
|
*/ |
145
|
|
|
public function popTemplateDefinition() |
146
|
|
|
{ |
147
|
|
|
$this->throwException(); |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* Get the current status of the fallback to "default" feature |
152
|
|
|
* |
153
|
|
|
* @return bool |
154
|
|
|
*/ |
155
|
|
|
public function getFallbackToDefaultTemplate() |
156
|
|
|
{ |
157
|
|
|
$this->throwException(); |
158
|
|
|
} |
159
|
|
|
} |
160
|
|
|
|