]> git.mxchange.org Git - core.git/blob - framework/main/interfaces/template/class_CompileableTemplate.php
Some updates:
[core.git] / framework / main / interfaces / template / class_CompileableTemplate.php
1 <?php
2 // Own namespace
3 namespace Org\Mxchange\CoreFramework\Template;
4
5 // Import framework stuff
6 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
7 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
8 use Org\Mxchange\CoreFramework\Response\Responseable;
9
10 /**
11  * An interface for template engines
12  *
13  * @author              Roland Haeder <webmaster@shipsimu.org>
14  * @version             0.0.0
15 <<<<<<< HEAD:framework/main/interfaces/template/class_CompileableTemplate.php
16  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
17 =======
18  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
19 >>>>>>> Some updates::inc/main/interfaces/template/class_CompileableTemplate.php
20  * @license             GNU GPL 3.0 or any newer version
21  * @link                http://www.shipsimu.org
22  *
23  * This program is free software: you can redistribute it and/or modify
24  * it under the terms of the GNU General Public License as published by
25  * the Free Software Foundation, either version 3 of the License, or
26  * (at your option) any later version.
27  *
28  * This program is distributed in the hope that it will be useful,
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31  * GNU General Public License for more details.
32  *
33  * You should have received a copy of the GNU General Public License
34  * along with this program. If not, see <http://www.gnu.org/licenses/>.
35  */
36 interface CompileableTemplate extends FrameworkInterface {
37         /**
38          * Assign variables for templates
39          *
40          * @param       $variableName   The "variable" we want to assign
41          * @param       $value                  The value we want to store in the variable
42          * @return      void
43          */
44         function assignVariable ($variableName, $value);
45
46         /**
47          * Load a specified HTML template into the engine
48          *
49          * @param       $template       The web template we shall load which is located in
50          *                                              "html" by default
51          * @return      void
52          */
53         function loadHtmlTemplate ($template);
54
55         /**
56          * Load a specified code template into the engine for later compilation
57          * with other code/web/email templates.
58          *
59          * @param       $template       The code template we shall load which is
60          *                                              located in "html" by default
61          * @return      void
62          */
63         function loadCodeTemplate ($template);
64
65         /**
66          * Load a specified email template into the engine for later compilation
67          * with other code/web/email templates.
68          *
69          * @param       $template       The email template we shall load which is
70          *                                              located in "html" by default
71          * @return      void
72          */
73         function loadEmailTemplate ($template);
74
75         /**
76          * Compile all variables by inserting their respective values
77          *
78          * @return      void
79          */
80         function compileVariables ();
81
82
83         /**
84          * Compile all required code/web/email-templates into the current one
85          *
86          * @return      void
87          */
88         function compileTemplate ();
89
90         /**
91          * Adds a variable to current group
92          *
93          * @param       $variableName   Variable to set
94          * @param       $value                  Value to store in variable
95          * @return      void
96          */
97         function addGroupVariable ($variableName, $value);
98
99         /**
100          * Removes a given variable
101          *
102          * @param       $variableName   The variable we are looking for
103          * @param       $variableGroup  Name of variable group (default: 'general')
104          * @return      void
105          */
106         function removeVariable ($variableName, $variableGroup = 'general');
107
108         /**
109          * Assign a given congfiguration variable with a value
110          *
111          * @param       $variableName   The configuration variable we want to assign
112          * @return      void
113          */
114         function assignConfigVariable ($variableName);
115
116         /**
117          * Compiles configuration place-holders in all variables. This 'walks'
118          * through the variable stack 'general'. It interprets all values from that
119          * variables as configuration entries after compiling them.
120          *
121          * @return      void
122          */
123         function compileConfigInVariables ();
124
125         /**
126          * Assigns the last loaded raw template content with a given variable
127          *
128          * @param       $templateName   Name of the template we want to assign
129          * @param       $variableName   Name of the variable we want to assign
130          * @return      void
131          */
132         function assignTemplateWithVariable ($templateName, $variableName);
133
134         /**
135          * Transfers the content of this template engine to a given response instance
136          *
137          * @param       $responseInstance       An instance of a Responseable class
138          * @return      void
139          */
140         function transferToResponse (Responseable $responseInstance);
141
142         /**
143          * Assigns all the application data with template variables
144          *
145          * @param       $applicationInstance    A manageable application instance
146          * @return      void
147          */
148         function assignApplicationData (ManageableApplication $applicationInstance);
149
150         /**
151          * "Compiles" a variable by replacing {?var?} with it's content
152          *
153          * @param       $rawCode                        Raw code to compile
154          * @param       $setMatchAsCode         Sets $match if readVariable() returns empty result (default: false)
155          * @return      $rawCode                        Compile code with inserted variable value
156          */
157         function compileRawCode ($rawCode, $setMatchAsCode = false);
158
159         /**
160          * Renames a variable in code and in stack
161          *
162          * @param       $oldName        Old name of variable
163          * @param       $newName        New name of variable
164          * @return      void
165          */
166         function renameVariable ($oldName, $newName);
167
168         /**
169          * Renders the given XML content
170          *
171          * @param       $content        Valid XML content or if not set the current loaded raw content
172          * @return      void
173          * @throws      XmlParserException      If an XML error was found
174          */
175         function renderXmlContent ($content = NULL);
176
177         /**
178          * Enables or disables language support
179          *
180          * @param       $languageSupport        New language support setting
181          * @return      void
182          */
183         function enableLanguageSupport ($languageSupport = true);
184
185         /**
186          * Checks whether language support is enabled
187          *
188          * @return      $languageSupport        Whether language support is enabled or disabled
189          */
190         function isLanguageSupportEnabled ();
191
192         /**
193          * Enables or disables XML compacting
194          *
195          * @param       $xmlCompacting  New XML compacting setting
196          * @return      void
197          */
198         function enableXmlCompacting ($xmlCompacting = true);
199
200         /**
201          * Checks whether XML compacting is enabled
202          *
203          * @return      $xmlCompacting  Whether XML compacting is enabled or disabled
204          */
205         function isXmlCompactingEnabled ();
206
207         /**
208          * Removes all comments, tabs and new-line charcters to compact the content
209          *
210          * @param       $uncompactedContent             The uncompacted content
211          * @return      $compactedContent               The compacted content
212          */
213         function compactContent ($uncompactedContent);
214
215         /**
216          * Getter for given variable group
217          *
218          * @param       $variableGroup  Variable group to check
219          * @return      $varStack               Found variable group
220          */
221         function getVarStack ($variableGroup);
222
223         /**
224          * Settter for variable group
225          *
226          * @param       $groupName      Name of variable group
227          * @param       $add            Whether add this group
228          * @return      void
229          */
230         function setVariableGroup ($groupName, $add = true);
231
232         /**
233          * Getter for template type
234          *
235          * @return      $templateType   The current template's type
236          */
237         function getTemplateType ();
238
239         /**
240          * Getter for base path
241          *
242          * @return      $templateBasePath       The relative base path for all templates
243          */
244         function getTemplateBasePath ();
245
246         /**
247          * Getter for generic base path
248          *
249          * @return      $templateBasePath       The relative base path for all templates
250          */
251         function getGenericBasePath ();
252
253         /**
254          * Getter for template extension
255          *
256          * @return      $templateExtension      The file extension for all uncompiled
257          *                                                      templates
258          */
259         function getRawTemplateExtension ();
260
261         /**
262          * Getter for code-template extension
263          *
264          * @return      $codeExtension          The file extension for all code-
265          *                                                      templates
266          */
267         function getCodeTemplateExtension ();
268
269         /**
270          * Getter for raw template data
271          *
272          * @return      $rawTemplateData        The raw data from the template
273          */
274         function getRawTemplateData ();
275
276         /**
277          * Assigns a lot variables into the stack of currently loaded template.
278          * This method should only be used in very rare circumstances, e.g. when
279          * you have to copy a whole set of variables into the template engine.
280          * Before you use this method, please make sure you have considered all
281          * other possiblities.
282          *
283          * @param       $variables      An array with variables to be assigned
284          * @return      void
285          */
286         function assignMultipleVariables (array $variables);
287
288         /**
289          * Getter for variable group array
290          *
291          * @return      $variableGroups All variable groups
292          */
293         function getVariableGroups ();
294
295 }