Text Compare
Produced: 1/13/2014 16:28:20
   
Mode:  All  
Left file: C:\Users\lei.bi\Desktop\typo3.updated\sysext\core\Classes\Page\PageRenderer.php  
Right file: C:\Users\lei.bi\Desktop\typo3\sysext\core\Classes\Page\PageRenderer.php  
1 <?php = 1 <?php
2 namespace TYPO3\CMS\Core\Page;   2 namespace TYPO3\CMS\Core\Page;
3     3  
4 /***************************************************************   4 /***************************************************************
5 *  Copyright notice   5 *  Copyright notice
6 *   6 *
7 *  (c) 2009-2013 Steffen Kamper <info@sk-typo3.de>   7 *  (c) 2009-2013 Steffen Kamper <info@sk-typo3.de>
8 *  (c) 2011-2013 Kai Vogel <kai.vogel@speedprogs.de>   8 *  (c) 2011-2013 Kai Vogel <kai.vogel@speedprogs.de>
9 *  All rights reserved   9 *  All rights reserved
10 *   10 *
11 *  This script is part of the TYPO3 project. The TYPO3 project is   11 *  This script is part of the TYPO3 project. The TYPO3 project is
12 *  free software; you can redistribute it and/or modify   12 *  free software; you can redistribute it and/or modify
13 *  it under the terms of the GNU General Public License as published by   13 *  it under the terms of the GNU General Public License as published by
14 *  the Free Software Foundation; either version 2 of the License, or   14 *  the Free Software Foundation; either version 2 of the License, or
15 *  (at your option) any later version.   15 *  (at your option) any later version.
16 *   16 *
17 *  The GNU General Public License can be found at   17 *  The GNU General Public License can be found at
18 *  http://www.gnu.org/copyleft/gpl.html.   18 *  http://www.gnu.org/copyleft/gpl.html.
19 *  A copy is found in the textfile GPL.txt and important notices to the license   19 *  A copy is found in the textfile GPL.txt and important notices to the license
20 *  from the author is found in LICENSE.txt distributed with these scripts.   20 *  from the author is found in LICENSE.txt distributed with these scripts.
21 *   21 *
22 *   22 *
23 *  This script is distributed in the hope that it will be useful,   23 *  This script is distributed in the hope that it will be useful,
24 *  but WITHOUT ANY WARRANTY; without even the implied warranty of   24 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   25 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 *  GNU General Public License for more details.   26 *  GNU General Public License for more details.
27 *   27 *
28 *  This copyright notice MUST APPEAR in all copies of the script!   28 *  This copyright notice MUST APPEAR in all copies of the script!
29 ***************************************************************/   29 ***************************************************************/
30 /**   30 /**
31 * TYPO3 pageRender class (new in TYPO3 4.3.0)   31 * TYPO3 pageRender class (new in TYPO3 4.3.0)
32 * This class render the HTML of a webpage, usable for BE and FE   32 * This class render the HTML of a webpage, usable for BE and FE
33 *   33 *
34 * @author Steffen Kamper <info@sk-typo3.de>   34 * @author Steffen Kamper <info@sk-typo3.de>
35 * @author Kai Vogel <kai.vogel@speedprogs.de>   35 * @author Kai Vogel <kai.vogel@speedprogs.de>
36 */   36 */
37 class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {   37 class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
38     38  
39         // Constants for the part to be rendered   39         // Constants for the part to be rendered
40         const PART_COMPLETE = 0;   40         const PART_COMPLETE = 0;
41         const PART_HEADER = 1;   41         const PART_HEADER = 1;
42         const PART_FOOTER = 2;   42         const PART_FOOTER = 2;
43         // Available adapters for extJs   43         // Available adapters for extJs
44         const EXTJS_ADAPTER_JQUERY = 'jquery';   44         const EXTJS_ADAPTER_JQUERY = 'jquery';
45         const EXTJS_ADAPTER_PROTOTYPE = 'prototype';   45         const EXTJS_ADAPTER_PROTOTYPE = 'prototype';
46         const EXTJS_ADAPTER_YUI = 'yui';   46         const EXTJS_ADAPTER_YUI = 'yui';
47         // jQuery Core version that is shipped with TYPO3   47         // jQuery Core version that is shipped with TYPO3
48         const JQUERY_VERSION_LATEST = '1.9.1';   48         const JQUERY_VERSION_LATEST = '1.9.1';
49         // jQuery namespace options   49         // jQuery namespace options
50         const JQUERY_NAMESPACE_NONE = 'none';   50         const JQUERY_NAMESPACE_NONE = 'none';
51         const JQUERY_NAMESPACE_DEFAULT = 'jQuery';   51         const JQUERY_NAMESPACE_DEFAULT = 'jQuery';
52         const JQUERY_NAMESPACE_DEFAULT_NOCONFLICT = 'defaultNoConflict';   52         const JQUERY_NAMESPACE_DEFAULT_NOCONFLICT = 'defaultNoConflict';
53         /**   53         /**
54          * @var boolean   54          * @var boolean
55          */   55          */
56         protected $compressJavascript = FALSE;   56         protected $compressJavascript = FALSE;
57     57  
58         /**   58         /**
59          * @var boolean   59          * @var boolean
60          */   60          */
61         protected $compressCss = FALSE;   61         protected $compressCss = FALSE;
62     62  
63         /**   63         /**
64          * @var boolean   64          * @var boolean
65          */   65          */
66         protected $removeLineBreaksFromTemplate = FALSE;   66         protected $removeLineBreaksFromTemplate = FALSE;
67     67  
68         /**   68         /**
69          * @var boolean   69          * @var boolean
70          */   70          */
71         protected $concatenateFiles = FALSE;   71         protected $concatenateFiles = FALSE;
72     72  
73         /**   73         /**
74          * @var boolean   74          * @var boolean
75          */   75          */
76         protected $concatenateJavascript = FALSE;   76         protected $concatenateJavascript = FALSE;
77     77  
78         /**   78         /**
79          * @var boolean   79          * @var boolean
80          */   80          */
81         protected $concatenateCss = FALSE;   81         protected $concatenateCss = FALSE;
82     82  
83         /**   83         /**
84          * @var boolean   84          * @var boolean
85          */   85          */
86         protected $moveJsFromHeaderToFooter = FALSE;   86         protected $moveJsFromHeaderToFooter = FALSE;
87     87  
88         /**   88         /**
89          * @var \TYPO3\CMS\Core\Charset\CharsetConverter   89          * @var \TYPO3\CMS\Core\Charset\CharsetConverter
90          */   90          */
91         protected $csConvObj;   91         protected $csConvObj;
92     92  
93         /**   93         /**
94          * @var \TYPO3\CMS\Core\Localization\Locales   94          * @var \TYPO3\CMS\Core\Localization\Locales
95          */   95          */
96         protected $locales;   96         protected $locales;
97     97  
98         /**   98         /**
99          * The language key   99          * The language key
100          * Two character string or 'default'   100          * Two character string or 'default'
101          *   101          *
102          * @var string   102          * @var string
103          */   103          */
104         protected $lang;   104         protected $lang;
105     105  
106         /**   106         /**
107          * List of language dependencies for actual language. This is used for local variants of a language   107          * List of language dependencies for actual language. This is used for local variants of a language
108          * that depend on their "main" language, like Brazilian Portuguese or Canadian French.   108          * that depend on their "main" language, like Brazilian Portuguese or Canadian French.
109          *   109          *
110          * @var array   110          * @var array
111          */   111          */
112         protected $languageDependencies = array();   112         protected $languageDependencies = array();
113     113  
114         /**   114         /**
115          * @var \TYPO3\CMS\Core\Resource\ResourceCompressor   115          * @var \TYPO3\CMS\Core\Resource\ResourceCompressor
116          */   116          */
117         protected $compressor;   117         protected $compressor;
118     118  
119         // Arrays containing associative array for the included files   119         // Arrays containing associative array for the included files
120         /**   120         /**
121          * @var array   121          * @var array
122          */   122          */
123         protected $jsFiles = array();   123         protected $jsFiles = array();
124     124  
125         /**   125         /**
126          * @var array   126          * @var array
127          */   127          */
128         protected $jsFooterFiles = array();   128         protected $jsFooterFiles = array();
129     129  
130         /**   130         /**
131          * @var array   131          * @var array
132          */   132          */
133         protected $jsLibs = array();   133         protected $jsLibs = array();
134     134  
135         /**   135         /**
136          * @var array   136          * @var array
137          */   137          */
138         protected $jsFooterLibs = array();   138         protected $jsFooterLibs = array();
139     139  
140         /**   140         /**
141          * @var array   141          * @var array
142          */   142          */
143         protected $cssFiles = array();   143         protected $cssFiles = array();
144     144  
145         /**   145         /**
146          * The title of the page   146          * The title of the page
147          *   147          *
148          * @var string   148          * @var string
149          */   149          */
150         protected $title;   150         protected $title;
151     151  
152         /**   152         /**
153          * Charset for the rendering   153          * Charset for the rendering
154          *   154          *
155          * @var string   155          * @var string
156          */   156          */
157         protected $charSet;   157         protected $charSet;
158     158  
159         /**   159         /**
160          * @var string   160          * @var string
161          */   161          */
162         protected $favIcon;   162         protected $favIcon;
163     163  
164         /**   164         /**
165          * @var string   165          * @var string
166          */   166          */
167         protected $baseUrl;   167         protected $baseUrl;
168     168  
169         /**   169         /**
170          * @var boolean   170          * @var boolean
171          */   171          */
172         protected $renderXhtml = TRUE;   172         protected $renderXhtml = TRUE;
173     173  
174         // Static header blocks   174         // Static header blocks
175         /**   175         /**
176          * @var string   176          * @var string
177          */   177          */
178         protected $xmlPrologAndDocType = '';   178         protected $xmlPrologAndDocType = '';
179     179  
180         /**   180         /**
181          * @var array   181          * @var array
182          */   182          */
183         protected $metaTags = array();   183         protected $metaTags = array();
184     184  
185         /**   185         /**
186          * @var array   186          * @var array
187          */   187          */
188         protected $inlineComments = array();   188         protected $inlineComments = array();
189     189  
190         /**   190         /**
191          * @var array   191          * @var array
192          */   192          */
193         protected $headerData = array();   193         protected $headerData = array();
194     194  
195         /**   195         /**
196          * @var array   196          * @var array
197          */   197          */
198         protected $footerData = array();   198         protected $footerData = array();
199     199  
200         /**   200         /**
201          * @var string   201          * @var string
202          */   202          */
203         protected $titleTag = '<title>|</title>';   203         protected $titleTag = '<title>|</title>';
204     204  
205         /**   205         /**
206          * @var string   206          * @var string
207          */   207          */
208         protected $metaCharsetTag = '<meta http-equiv="Content-Type" content="text/html; charset=|" />';   208         protected $metaCharsetTag = '<meta http-equiv="Content-Type" content="text/html; charset=|" />';
209     209  
210         /**   210         /**
211          * @var string   211          * @var string
212          */   212          */
213         protected $htmlTag = '<html>';   213         protected $htmlTag = '<html>';
214     214  
215         /**   215         /**
216          * @var string   216          * @var string
217          */   217          */
218         protected $headTag = '<head>';   218         protected $headTag = '<head>';
219     219  
220         /**   220         /**
221          * @var string   221          * @var string
222          */   222          */
223         protected $baseUrlTag = '<base href="|" />';   223         protected $baseUrlTag = '<base href="|" />';
224     224  
225         /**   225         /**
226          * @var string   226          * @var string
227          */   227          */
228         protected $iconMimeType = '';   228         protected $iconMimeType = '';
229     229  
230         /**   230         /**
231          * @var string   231          * @var string
232          */   232          */
233         protected $shortcutTag = '<link rel="shortcut icon" href="%1$s"%2$s />   233         protected $shortcutTag = '<link rel="shortcut icon" href="%1$s"%2$s />
234 <link rel="icon" href="%1$s"%2$s />';   234 <link rel="icon" href="%1$s"%2$s />';
235     235  
236         // Static inline code blocks   236         // Static inline code blocks
237         /**   237         /**
238          * @var array   238          * @var array
239          */   239          */
240         protected $jsInline = array();   240         protected $jsInline = array();
241     241  
242         /**   242         /**
243          * @var array   243          * @var array
244          */   244          */
245         protected $jsFooterInline = array();   245         protected $jsFooterInline = array();
246     246  
247         /**   247         /**
248          * @var array   248          * @var array
249          */   249          */
250         protected $extOnReadyCode = array();   250         protected $extOnReadyCode = array();
251     251  
252         /**   252         /**
253          * @var array   253          * @var array
254          */   254          */
255         protected $cssInline = array();   255         protected $cssInline = array();
256     256  
257         /**   257         /**
258          * @var string   258          * @var string
259          */   259          */
260         protected $bodyContent;   260         protected $bodyContent;
261     261  
262         /**   262         /**
263          * @var string   263          * @var string
264          */   264          */
265         protected $templateFile;   265         protected $templateFile;
266     266  
267         /**   267         /**
268          * @var array   268          * @var array
269          */   269          */
270         protected $jsLibraryNames = array('prototype', 'scriptaculous', 'extjs');   270         protected $jsLibraryNames = array('prototype', 'scriptaculous', 'extjs');
271     271  
272         // Paths to contibuted libraries   272         // Paths to contibuted libraries
273     273  
274         /**   274         /**
275          * default path to the requireJS library, relative to the typo3/ directory   275          * default path to the requireJS library, relative to the typo3/ directory
276          * @var string   276          * @var string
277          */   277          */
278         protected $requireJsPath = 'contrib/requirejs/';   278         protected $requireJsPath = 'contrib/requirejs/';
279     279  
280         /**   280         /**
281          * @var string   281          * @var string
282          */   282          */
283         protected $prototypePath = 'contrib/prototype/';   283         protected $prototypePath = 'contrib/prototype/';
284     284  
285         /**   285         /**
286          * @var string   286          * @var string
287          */   287          */
288         protected $scriptaculousPath = 'contrib/scriptaculous/';   288         protected $scriptaculousPath = 'contrib/scriptaculous/';
289     289  
290         /**   290         /**
291          * @var string   291          * @var string
292          */   292          */
293         protected $extCorePath = 'contrib/extjs/';   293         protected $extCorePath = 'contrib/extjs/';
294     294  
295         /**   295         /**
296          * @var string   296          * @var string
297          */   297          */
298         protected $extJsPath = 'contrib/extjs/';   298         protected $extJsPath = 'contrib/extjs/';
299     299  
300         /**   300         /**
301          * @var string   301          * @var string
302          */   302          */
303         protected $svgPath = 'contrib/websvg/';   303         protected $svgPath = 'contrib/websvg/';
304     304  
305         /**   305         /**
306          * The local directory where one can find jQuery versions and plugins   306          * The local directory where one can find jQuery versions and plugins
307          *   307          *
308          * @var string   308          * @var string
309          */   309          */
310         protected $jQueryPath = 'contrib/jquery/';   310         protected $jQueryPath = 'contrib/jquery/';
311     311  
312         // Internal flags for JS-libraries   312         // Internal flags for JS-libraries
313         /**   313         /**
314          * This array holds all jQuery versions that should be included in the   314          * This array holds all jQuery versions that should be included in the
315          * current page.   315          * current page.
316          * Each version is described by "source", "version" and "namespace"   316          * Each version is described by "source", "version" and "namespace"
317          *   317          *
318          * The namespace of every particular version is the key   318          * The namespace of every particular version is the key
319          * of that array, because only one version per namespace can exist.   319          * of that array, because only one version per namespace can exist.
320          *   320          *
321          * The type "source" describes where the jQuery core should be included from   321          * The type "source" describes where the jQuery core should be included from
322          * currently, TYPO3 supports "local" (make use of jQuery path), "google",   322          * currently, TYPO3 supports "local" (make use of jQuery path), "google",
323          * "jquery" and "msn".   323          * "jquery" and "msn".
324          * Currently there are downsides to "local" and "jquery", as "local" only   324          * Currently there are downsides to "local" and "jquery", as "local" only
325          * supports the latest/shipped jQuery core out of the box, and   325          * supports the latest/shipped jQuery core out of the box, and
326          * "jquery" does not have SSL support.   326          * "jquery" does not have SSL support.
327          *   327          *
328          * @var array   328          * @var array
329          */   329          */
330         protected $jQueryVersions = array();   330         protected $jQueryVersions = array();
331     331  
332         /**   332         /**
333          * Array of jQuery version numbers shipped with the core   333          * Array of jQuery version numbers shipped with the core
334          *   334          *
335          * @var array   335          * @var array
336          */   336          */
337         protected $availableLocalJqueryVersions = array(   337         protected $availableLocalJqueryVersions = array(
338                 '1.8.2',        // jquery version shipped with TYPO3 6.0, still available in the contrib/ directory   338                 '1.8.2',        // jquery version shipped with TYPO3 6.0, still available in the contrib/ directory
339                 self::JQUERY_VERSION_LATEST   339                 self::JQUERY_VERSION_LATEST
340         );   340         );
341     341  
342         /**   342         /**
343          * Array of jQuery CDNs with placeholders   343          * Array of jQuery CDNs with placeholders
344          *   344          *
345          * @var array   345          * @var array
346          */   346          */
347         protected $jQueryCdnUrls = array(   347         protected $jQueryCdnUrls = array(
348                 'google' => '//ajax.googleapis.com/ajax/libs/jquery/%1$s/jquery%2$s.js',   348                 'google' => '//ajax.googleapis.com/ajax/libs/jquery/%1$s/jquery%2$s.js',
349                 'msn' => '//ajax.aspnetcdn.com/ajax/jQuery/jquery-%1$s%2$s.js',   349                 'msn' => '//ajax.aspnetcdn.com/ajax/jQuery/jquery-%1$s%2$s.js',
350                 'jquery' => 'http://code.jquery.com/jquery-%1$s%2$s.js'   350                 'jquery' => 'http://code.jquery.com/jquery-%1$s%2$s.js'
351         );   351         );
352     352  
353         /**   353         /**
354          * if set, the requireJS library is included   354          * if set, the requireJS library is included
355          * @var boolean   355          * @var boolean
356          */   356          */
357         protected $addRequireJs = FALSE;   357         protected $addRequireJs = FALSE;
358     358  
359         /**   359         /**
360          * inline configuration for requireJS   360          * inline configuration for requireJS
361          * @var array   361          * @var array
362          */   362          */
363         protected $requireJsConfig = array();   363         protected $requireJsConfig = array();
364     364  
365         /**   365         /**
366          * @var boolean   366          * @var boolean
367          */   367          */
368         protected $addPrototype = FALSE;   368         protected $addPrototype = FALSE;
369     369  
370         /**   370         /**
371          * @var boolean   371          * @var boolean
372          */   372          */
373         protected $addScriptaculous = FALSE;   373         protected $addScriptaculous = FALSE;
374     374  
375         /**   375         /**
376          * @var array   376          * @var array
377          */   377          */
378         protected $addScriptaculousModules = array('builder' => FALSE, 'effects' => FALSE, 'dragdrop' => FALSE, 'controls' => FALSE, 'slider' => FALSE);   378         protected $addScriptaculousModules = array('builder' => FALSE, 'effects' => FALSE, 'dragdrop' => FALSE, 'controls' => FALSE, 'slider' => FALSE);
379     379  
380         /**   380         /**
381          * @var boolean   381          * @var boolean
382          */   382          */
383         protected $addExtJS = FALSE;   383         protected $addExtJS = FALSE;
384     384  
385         /**   385         /**
386          * @var boolean   386          * @var boolean
387          */   387          */
388         protected $addExtCore = FALSE;   388         protected $addExtCore = FALSE;
389     389  
390         /**   390         /**
391          * @var string   391          * @var string
392          */   392          */
393         protected $extJSadapter = 'ext/ext-base.js';   393         protected $extJSadapter = 'ext/ext-base.js';
394     394  
395         /**   395         /**
396          * @var boolean   396          * @var boolean
397          */   397          */
398         protected $extDirectCodeAdded = FALSE;   398         protected $extDirectCodeAdded = FALSE;
399     399  
400         /**   400         /**
401          * @var boolean   401          * @var boolean
402          */   402          */
403         protected $enableExtJsDebug = FALSE;   403         protected $enableExtJsDebug = FALSE;
404     404  
405         /**   405         /**
406          * @var boolean   406          * @var boolean
407          */   407          */
408         protected $enableExtCoreDebug = FALSE;   408         protected $enableExtCoreDebug = FALSE;
409     409  
410         /**   410         /**
411          * @var boolean   411          * @var boolean
412          */   412          */
413         protected $enableJqueryDebug = FALSE;   413         protected $enableJqueryDebug = FALSE;
414     414  
415         /**   415         /**
416          * @var boolean   416          * @var boolean
417          */   417          */
418         protected $extJStheme = TRUE;   418         protected $extJStheme = TRUE;
419     419  
420         /**   420         /**
421          * @var boolean   421          * @var boolean
422          */   422          */
423         protected $extJScss = TRUE;   423         protected $extJScss = TRUE;
424     424  
425         /**   425         /**
426          * @var boolean   426          * @var boolean
427          */   427          */
428         protected $enableExtJSQuickTips = FALSE;   428         protected $enableExtJSQuickTips = FALSE;
429     429  
430         /**   430         /**
431          * @var array   431          * @var array
432          */   432          */
433         protected $inlineLanguageLabels = array();   433         protected $inlineLanguageLabels = array();
434     434  
435         /**   435         /**
436          * @var array   436          * @var array
437          */   437          */
438         protected $inlineLanguageLabelFiles = array();   438         protected $inlineLanguageLabelFiles = array();
439     439  
440         /**   440         /**
441          * @var array   441          * @var array
442          */   442          */
443         protected $inlineSettings = array();   443         protected $inlineSettings = array();
444     444  
445         /**   445         /**
446          * @var array   446          * @var array
447          */   447          */
448         protected $inlineJavascriptWrap = array();   448         protected $inlineJavascriptWrap = array();
449     449  
450         /**   450         /**
451          * Saves error messages generated during compression   451          * Saves error messages generated during compression
452          *   452          *
453          * @var string   453          * @var string
454          */   454          */
455         protected $compressError = '';   455         protected $compressError = '';
456     456  
457         /**   457         /**
458          * Is empty string for HTML and ' /' for XHTML rendering   458          * Is empty string for HTML and ' /' for XHTML rendering
459          *   459          *
460          * @var string   460          * @var string
461          */   461          */
462         protected $endingSlash = '';   462         protected $endingSlash = '';
463     463  
464         /**   464         /**
465          * SVG library   465          * SVG library
466          *   466          *
467          * @var boolean   467          * @var boolean
468          */   468          */
469         protected $addSvg = FALSE;   469         protected $addSvg = FALSE;
470     470  
471         /**   471         /**
472          * @var boolean   472          * @var boolean
473          */   473          */
474         protected $enableSvgDebug = FALSE;   474         protected $enableSvgDebug = FALSE;
475     475  
476         /**   476         /**
477          * Used by BE modules   477          * Used by BE modules
478          *   478          *
479          * @var null|string   479          * @var null|string
480          */   480          */
481         public $backPath;   481         public $backPath;
482     482  
483         /**   483         /**
484          * @param string $templateFile Declare the used template file. Omit this parameter will use default template   484          * @param string $templateFile Declare the used template file. Omit this parameter will use default template
485          * @param string $backPath Relative path to typo3-folder. It varies for BE modules, in FE it will be typo3/   485          * @param string $backPath Relative path to typo3-folder. It varies for BE modules, in FE it will be typo3/
486          */   486          */
487         public function __construct($templateFile = '', $backPath = NULL) {   487         public function __construct($templateFile = '', $backPath = NULL) {
488                 $this->reset();   488                 $this->reset();
489                 $this->csConvObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter');   489                 $this->csConvObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter');
490                 $this->locales = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');   490                 $this->locales = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');
491                 if (strlen($templateFile)) {   491                 if (strlen($templateFile)) {
492                         $this->templateFile = $templateFile;   492                         $this->templateFile = $templateFile;
493                 }   493                 }
494                 $this->backPath = isset($backPath) ? $backPath : $GLOBALS['BACK_PATH'];   494                 $this->backPath = isset($backPath) ? $backPath : $GLOBALS['BACK_PATH'];
495                 $this->inlineJavascriptWrap = array(   495                 $this->inlineJavascriptWrap = array(
496                         '<script type="text/javascript">' . LF . '/*<![CDATA[*/' . LF . '<!-- ' . LF,   496                         '<script type="text/javascript">' . LF . '/*<![CDATA[*/' . LF . '<!-- ' . LF,
497                         '// -->' . LF . '/*]]>*/' . LF . '</script>' . LF   497                         '// -->' . LF . '/*]]>*/' . LF . '</script>' . LF
498                 );   498                 );
499                 $this->inlineCssWrap = array(   499                 $this->inlineCssWrap = array(
500                         '<style type="text/css">' . LF . '/*<![CDATA[*/' . LF . '<!-- ' . LF,   500                         '<style type="text/css">' . LF . '/*<![CDATA[*/' . LF . '<!-- ' . LF,
501                         '-->' . LF . '/*]]>*/' . LF . '</style>' . LF   501                         '-->' . LF . '/*]]>*/' . LF . '</style>' . LF
502                 );   502                 );
503         }   503         }
504     504  
505         /**   505         /**
506          * Reset all vars to initial values   506          * Reset all vars to initial values
507          *   507          *
508          * @return void   508          * @return void
509          */   509          */
510         protected function reset() {   510         protected function reset() {
511                 $this->templateFile = TYPO3_mainDir . 'templates/template_page_backend.html';   511                 $this->templateFile = TYPO3_mainDir . 'templates/template_page_backend.html';
512                 $this->jsFiles = array();   512                 $this->jsFiles = array();
513                 $this->jsFooterFiles = array();   513                 $this->jsFooterFiles = array();
514                 $this->jsInline = array();   514                 $this->jsInline = array();
515                 $this->jsFooterInline = array();   515                 $this->jsFooterInline = array();
516                 $this->jsLibs = array();   516                 $this->jsLibs = array();
517                 $this->cssFiles = array();   517                 $this->cssFiles = array();
518                 $this->cssInline = array();   518                 $this->cssInline = array();
519                 $this->metaTags = array();   519                 $this->metaTags = array();
520                 $this->inlineComments = array();   520                 $this->inlineComments = array();
521                 $this->headerData = array();   521                 $this->headerData = array();
522                 $this->footerData = array();   522                 $this->footerData = array();
523                 $this->extOnReadyCode = array();   523                 $this->extOnReadyCode = array();
524                 $this->jQueryVersions = array();   524                 $this->jQueryVersions = array();
525         }   525         }
526     526  
527         /*****************************************************/   527         /*****************************************************/
528         /*                                                   */   528         /*                                                   */
529         /*  Public Setters                                   */   529         /*  Public Setters                                   */
530         /*                                                   */   530         /*                                                   */
531         /*                                                   */   531         /*                                                   */
532         /*****************************************************/   532         /*****************************************************/
533         /**   533         /**
534          * Sets the title   534          * Sets the title
535          *   535          *
536          * @param string $title        title of webpage   536          * @param string $title        title of webpage
537          * @return void   537          * @return void
538          */   538          */
539         public function setTitle($title) {   539         public function setTitle($title) {
540                 $this->title = $title;   540                 $this->title = $title;
541         }   541         }
542     542  
543         /**   543         /**
544          * Enables/disables rendering of XHTML code   544          * Enables/disables rendering of XHTML code
545          *   545          *
546          * @param boolean $enable Enable XHTML   546          * @param boolean $enable Enable XHTML
547          * @return void   547          * @return void
548          */   548          */
549         public function setRenderXhtml($enable) {   549         public function setRenderXhtml($enable) {
550                 $this->renderXhtml = $enable;   550                 $this->renderXhtml = $enable;
551         }   551         }
552     552  
553         /**   553         /**
554          * Sets xml prolog and docType   554          * Sets xml prolog and docType
555          *   555          *
556          * @param string $xmlPrologAndDocType Complete tags for xml prolog and docType   556          * @param string $xmlPrologAndDocType Complete tags for xml prolog and docType
557          * @return void   557          * @return void
558          */   558          */
559         public function setXmlPrologAndDocType($xmlPrologAndDocType) {   559         public function setXmlPrologAndDocType($xmlPrologAndDocType) {
560                 $this->xmlPrologAndDocType = $xmlPrologAndDocType;   560                 $this->xmlPrologAndDocType = $xmlPrologAndDocType;
561         }   561         }
562     562  
563         /**   563         /**
564          * Sets meta charset   564          * Sets meta charset
565          *   565          *
566          * @param string $charSet Used charset   566          * @param string $charSet Used charset
567          * @return void   567          * @return void
568          */   568          */
569         public function setCharSet($charSet) {   569         public function setCharSet($charSet) {
570                 $this->charSet = $charSet;   570                 $this->charSet = $charSet;
571         }   571         }
572     572  
573         /**   573         /**
574          * Sets language   574          * Sets language
575          *   575          *
576          * @param string $lang Used language   576          * @param string $lang Used language
577          * @return void   577          * @return void
578          */   578          */
579         public function setLanguage($lang) {   579         public function setLanguage($lang) {
580                 $this->lang = $lang;   580                 $this->lang = $lang;
581                 $this->languageDependencies = array();   581                 $this->languageDependencies = array();
582     582  
583                 // Language is found. Configure it:   583                 // Language is found. Configure it:
584                 if (in_array($this->lang, $this->locales->getLocales())) {   584                 if (in_array($this->lang, $this->locales->getLocales())) {
585                         $this->languageDependencies[] = $this->lang;   585                         $this->languageDependencies[] = $this->lang;
586                         foreach ($this->locales->getLocaleDependencies($this->lang) as $language) {   586                         foreach ($this->locales->getLocaleDependencies($this->lang) as $language) {
587                                 $this->languageDependencies[] = $language;   587                                 $this->languageDependencies[] = $language;
588                         }   588                         }
589                 }   589                 }
590         }   590         }
591     591  
592         /**   592         /**
593          * Set the meta charset tag   593          * Set the meta charset tag
594          *   594          *
595          * @param string $metaCharsetTag   595          * @param string $metaCharsetTag
596          * @return void   596          * @return void
597          */   597          */
598         public function setMetaCharsetTag($metaCharsetTag) {   598         public function setMetaCharsetTag($metaCharsetTag) {
599                 $this->metaCharsetTag = $metaCharsetTag;   599                 $this->metaCharsetTag = $metaCharsetTag;
600         }   600         }
601     601  
602         /**   602         /**
603          * Sets html tag   603          * Sets html tag
604          *   604          *
605          * @param string $htmlTag Html tag   605          * @param string $htmlTag Html tag
606          * @return void   606          * @return void
607          */   607          */
608         public function setHtmlTag($htmlTag) {   608         public function setHtmlTag($htmlTag) {
609                 $this->htmlTag = $htmlTag;   609                 $this->htmlTag = $htmlTag;
610         }   610         }
611     611  
612         /**   612         /**
613          * Sets HTML head tag   613          * Sets HTML head tag
614          *   614          *
615          * @param string $headTag HTML head tag   615          * @param string $headTag HTML head tag
616          * @return void   616          * @return void
617          */   617          */
618         public function setHeadTag($headTag) {   618         public function setHeadTag($headTag) {
619                 $this->headTag = $headTag;   619                 $this->headTag = $headTag;
620         }   620         }
621     621  
622         /**   622         /**
623          * Sets favicon   623          * Sets favicon
624          *   624          *
625          * @param string $favIcon   625          * @param string $favIcon
626          * @return void   626          * @return void
627          */   627          */
628         public function setFavIcon($favIcon) {   628         public function setFavIcon($favIcon) {
629                 $this->favIcon = $favIcon;   629                 $this->favIcon = $favIcon;
630         }   630         }
631     631  
632         /**   632         /**
633          * Sets icon mime type   633          * Sets icon mime type
634          *   634          *
635          * @param string $iconMimeType   635          * @param string $iconMimeType
636          * @return void   636          * @return void
637          */   637          */
638         public function setIconMimeType($iconMimeType) {   638         public function setIconMimeType($iconMimeType) {
639                 $this->iconMimeType = $iconMimeType;   639                 $this->iconMimeType = $iconMimeType;
640         }   640         }
641     641  
642         /**   642         /**
643          * Sets HTML base URL   643          * Sets HTML base URL
644          *   644          *
645          * @param string $baseUrl HTML base URL   645          * @param string $baseUrl HTML base URL
646          * @return void   646          * @return void
647          */   647          */
648         public function setBaseUrl($baseUrl) {   648         public function setBaseUrl($baseUrl) {
649                 $this->baseUrl = $baseUrl;   649                 $this->baseUrl = $baseUrl;
650         }   650         }
651     651  
652         /**   652         /**
653          * Sets template file   653          * Sets template file
654          *   654          *
655          * @param string $file   655          * @param string $file
656          * @return void   656          * @return void
657          */   657          */
658         public function setTemplateFile($file) {   658         public function setTemplateFile($file) {
659                 $this->templateFile = $file;   659                 $this->templateFile = $file;
660         }   660         }
661     661  
662         /**   662         /**
663          * Sets back path   663          * Sets back path
664          *   664          *
665          * @param string $backPath   665          * @param string $backPath
666          * @return void   666          * @return void
667          */   667          */
668         public function setBackPath($backPath) {   668         public function setBackPath($backPath) {
669                 $this->backPath = $backPath;   669                 $this->backPath = $backPath;
670         }   670         }
671     671  
672         /**   672         /**
673          * Sets Content for Body   673          * Sets Content for Body
674          *   674          *
675          * @param string $content   675          * @param string $content
676          * @return void   676          * @return void
677          */   677          */
678         public function setBodyContent($content) {   678         public function setBodyContent($content) {
679                 $this->bodyContent = $content;   679                 $this->bodyContent = $content;
680         }   680         }
681     681  
682         /**   682         /**
683          * Sets path to requireJS library (relative to typo3 directory)   683          * Sets path to requireJS library (relative to typo3 directory)
684          *   684          *
685          * @param string $path Path to requireJS library   685          * @param string $path Path to requireJS library
686          * @return void   686          * @return void
687          */   687          */
688         public function setRequireJsPath($path) {   688         public function setRequireJsPath($path) {
689                 $this->requireJsPath = $path;   689                 $this->requireJsPath = $path;
690         }   690         }
691     691  
692         /**   692         /**
693          * Sets path to prototype library (relative to typo3 directory)   693          * Sets path to prototype library (relative to typo3 directory)
694          *   694          *
695          * @param string $path Path to prototype library   695          * @param string $path Path to prototype library
696          * @return void   696          * @return void
697          */   697          */
698         public function setPrototypePath($path) {   698         public function setPrototypePath($path) {
699                 $this->prototypePath = $path;   699                 $this->prototypePath = $path;
700         }   700         }
701     701  
702         /**   702         /**
703          * Sets Path for scriptaculous library (relative to typo3 directory)   703          * Sets Path for scriptaculous library (relative to typo3 directory)
704          *   704          *
705          * @param string $path   705          * @param string $path
706          * @return void   706          * @return void
707          */   707          */
708         public function setScriptaculousPath($path) {   708         public function setScriptaculousPath($path) {
709                 $this->scriptaculousPath = $path;   709                 $this->scriptaculousPath = $path;
710         }   710         }
711     711  
712         /**   712         /**
713          * Sets Path for Ext Core library (relative to typo3 directory)   713          * Sets Path for Ext Core library (relative to typo3 directory)
714          *   714          *
715          * @param string $path   715          * @param string $path
716          * @return void   716          * @return void
717          */   717          */
718         public function setExtCorePath($path) {   718         public function setExtCorePath($path) {
719                 $this->extCorePath = $path;   719                 $this->extCorePath = $path;
720         }   720         }
721     721  
722         /**   722         /**
723          * Sets Path for ExtJs library (relative to typo3 directory)   723          * Sets Path for ExtJs library (relative to typo3 directory)
724          *   724          *
725          * @param string $path   725          * @param string $path
726          * @return void   726          * @return void
727          */   727          */
728         public function setExtJsPath($path) {   728         public function setExtJsPath($path) {
729                 $this->extJsPath = $path;   729                 $this->extJsPath = $path;
730         }   730         }
731     731  
732         /**   732         /**
733          * Sets Path for SVG library (websvg)   733          * Sets Path for SVG library (websvg)
734          *   734          *
735          * @param string $path   735          * @param string $path
736          * @return void   736          * @return void
737          */   737          */
738         public function setSvgPath($path) {   738         public function setSvgPath($path) {
739                 $this->svgPath = $path;   739                 $this->svgPath = $path;
740         }   740         }
741     741  
742         /*****************************************************/   742         /*****************************************************/
743         /*                                                   */   743         /*                                                   */
744         /*  Public Enablers / Disablers                      */   744         /*  Public Enablers / Disablers                      */
745         /*                                                   */   745         /*                                                   */
746         /*                                                   */   746         /*                                                   */
747         /*****************************************************/   747         /*****************************************************/
748         /**   748         /**
749          * Enables MoveJsFromHeaderToFooter   749          * Enables MoveJsFromHeaderToFooter
750          *   750          *
751          * @return void   751          * @return void
752          */   752          */
753         public function enableMoveJsFromHeaderToFooter() {   753         public function enableMoveJsFromHeaderToFooter() {
754                 $this->moveJsFromHeaderToFooter = TRUE;   754                 $this->moveJsFromHeaderToFooter = TRUE;
755         }   755         }
756     756  
757         /**   757         /**
758          * Disables MoveJsFromHeaderToFooter   758          * Disables MoveJsFromHeaderToFooter
759          *   759          *
760          * @return void   760          * @return void
761          */   761          */
762         public function disableMoveJsFromHeaderToFooter() {   762         public function disableMoveJsFromHeaderToFooter() {
763                 $this->moveJsFromHeaderToFooter = FALSE;   763                 $this->moveJsFromHeaderToFooter = FALSE;
764         }   764         }
765     765  
766         /**   766         /**
767          * Enables compression of javascript   767          * Enables compression of javascript
768          *   768          *
769          * @return void   769          * @return void
770          */   770          */
771         public function enableCompressJavascript() {   771         public function enableCompressJavascript() {
772                 $this->compressJavascript = TRUE;   772                 $this->compressJavascript = TRUE;
773         }   773         }
774     774  
775         /**   775         /**
776          * Disables compression of javascript   776          * Disables compression of javascript
777          *   777          *
778          * @return void   778          * @return void
779          */   779          */
780         public function disableCompressJavascript() {   780         public function disableCompressJavascript() {
781                 $this->compressJavascript = FALSE;   781                 $this->compressJavascript = FALSE;
782         }   782         }
783     783  
784         /**   784         /**
785          * Enables compression of css   785          * Enables compression of css
786          *   786          *
787          * @return void   787          * @return void
788          */   788          */
789         public function enableCompressCss() {   789         public function enableCompressCss() {
790                 $this->compressCss = TRUE;   790                 $this->compressCss = TRUE;
791         }   791         }
792     792  
793         /**   793         /**
794          * Disables compression of css   794          * Disables compression of css
795          *   795          *
796          * @return void   796          * @return void
797          */   797          */
798         public function disableCompressCss() {   798         public function disableCompressCss() {
799                 $this->compressCss = FALSE;   799                 $this->compressCss = FALSE;
800         }   800         }
801     801  
802         /**   802         /**
803          * Enables concatenation of js and css files   803          * Enables concatenation of js and css files
804          *   804          *
805          * @return void   805          * @return void
806          */   806          */
807         public function enableConcatenateFiles() {   807         public function enableConcatenateFiles() {
808                 $this->concatenateFiles = TRUE;   808                 $this->concatenateFiles = TRUE;
809         }   809         }
810     810  
811         /**   811         /**
812          * Disables concatenation of js and css files   812          * Disables concatenation of js and css files
813          *   813          *
814          * @return void   814          * @return void
815          */   815          */
816         public function disableConcatenateFiles() {   816         public function disableConcatenateFiles() {
817                 $this->concatenateFiles = FALSE;   817                 $this->concatenateFiles = FALSE;
818         }   818         }
819     819  
820         /**   820         /**
821          * Enables concatenation of js files   821          * Enables concatenation of js files
822          *   822          *
823          * @return void   823          * @return void
824          */   824          */
825         public function enableConcatenateJavascript() {   825         public function enableConcatenateJavascript() {
826                 $this->concatenateJavascript = TRUE;   826                 $this->concatenateJavascript = TRUE;
827         }   827         }
828     828  
829         /**   829         /**
830          * Disables concatenation of js files   830          * Disables concatenation of js files
831          *   831          *
832          * @return void   832          * @return void
833          */   833          */
834         public function disableConcatenateJavascript() {   834         public function disableConcatenateJavascript() {
835                 $this->concatenateJavascript = FALSE;   835                 $this->concatenateJavascript = FALSE;
836         }   836         }
837     837  
838         /**   838         /**
839          * Enables concatenation of css files   839          * Enables concatenation of css files
840          *   840          *
841          * @return void   841          * @return void
842          */   842          */
843         public function enableConcatenateCss() {   843         public function enableConcatenateCss() {
844                 $this->concatenateCss = TRUE;   844                 $this->concatenateCss = TRUE;
845         }   845         }
846     846  
847         /**   847         /**
848          * Disables concatenation of css files   848          * Disables concatenation of css files
849          *   849          *
850          * @return void   850          * @return void
851          */   851          */
852         public function disableConcatenateCss() {   852         public function disableConcatenateCss() {
853                 $this->concatenateCss = FALSE;   853                 $this->concatenateCss = FALSE;
854         }   854         }
855     855  
856         /**   856         /**
857          * Sets removal of all line breaks in template   857          * Sets removal of all line breaks in template
858          *   858          *
859          * @return void   859          * @return void
860          */   860          */
861         public function enableRemoveLineBreaksFromTemplate() {   861         public function enableRemoveLineBreaksFromTemplate() {
862                 $this->removeLineBreaksFromTemplate = TRUE;   862                 $this->removeLineBreaksFromTemplate = TRUE;
863         }   863         }
864     864  
865         /**   865         /**
866          * Unsets removal of all line breaks in template   866          * Unsets removal of all line breaks in template
867          *   867          *
868          * @return void   868          * @return void
869          */   869          */
870         public function disableRemoveLineBreaksFromTemplate() {   870         public function disableRemoveLineBreaksFromTemplate() {
871                 $this->removeLineBreaksFromTemplate = FALSE;   871                 $this->removeLineBreaksFromTemplate = FALSE;
872         }   872         }
873     873  
874         /**   874         /**
875          * Enables Debug Mode   875          * Enables Debug Mode
876          * This is a shortcut to switch off all compress/concatenate features to enable easier debug   876          * This is a shortcut to switch off all compress/concatenate features to enable easier debug
877          *   877          *
878          * @return void   878          * @return void
879          */   879          */
880         public function enableDebugMode() {   880         public function enableDebugMode() {
881                 $this->compressJavascript = FALSE;   881                 $this->compressJavascript = FALSE;
882                 $this->compressCss = FALSE;   882                 $this->compressCss = FALSE;
883                 $this->concatenateFiles = FALSE;   883                 $this->concatenateFiles = FALSE;
884                 $this->removeLineBreaksFromTemplate = FALSE;   884                 $this->removeLineBreaksFromTemplate = FALSE;
885                 $this->enableExtCoreDebug = TRUE;   885                 $this->enableExtCoreDebug = TRUE;
886                 $this->enableExtJsDebug = TRUE;   886                 $this->enableExtJsDebug = TRUE;
887                 $this->enableJqueryDebug = TRUE;   887                 $this->enableJqueryDebug = TRUE;
888                 $this->enableSvgDebug = TRUE;   888                 $this->enableSvgDebug = TRUE;
889         }   889         }
890     890  
891         /*****************************************************/   891         /*****************************************************/
892         /*                                                   */   892         /*                                                   */
893         /*  Public Getters                                   */   893         /*  Public Getters                                   */
894         /*                                                   */   894         /*                                                   */
895         /*                                                   */   895         /*                                                   */
896         /*****************************************************/   896         /*****************************************************/
897         /**   897         /**
898          * Gets the title   898          * Gets the title
899          *   899          *
900          * @return string $title Title of webpage   900          * @return string $title Title of webpage
901          */   901          */
902         public function getTitle() {   902         public function getTitle() {
903                 return $this->title;   903                 return $this->title;
904         }   904         }
905     905  
906         /**   906         /**
907          * Gets the charSet   907          * Gets the charSet
908          *   908          *
909          * @return string $charSet   909          * @return string $charSet
910          */   910          */
911         public function getCharSet() {   911         public function getCharSet() {
912                 return $this->charSet;   912                 return $this->charSet;
913         }   913         }
914     914  
915         /**   915         /**
916          * Gets the language   916          * Gets the language
917          *   917          *
918          * @return string $lang   918          * @return string $lang
919          */   919          */
920         public function getLanguage() {   920         public function getLanguage() {
921                 return $this->lang;   921                 return $this->lang;
922         }   922         }
923     923  
924         /**   924         /**
925          * Returns rendering mode XHTML or HTML   925          * Returns rendering mode XHTML or HTML
926          *   926          *
927          * @return boolean TRUE if XHTML, FALSE if HTML   927          * @return boolean TRUE if XHTML, FALSE if HTML
928          */   928          */
929         public function getRenderXhtml() {   929         public function getRenderXhtml() {
930                 return $this->renderXhtml;   930                 return $this->renderXhtml;
931         }   931         }
932     932  
933         /**   933         /**
934          * Gets html tag   934          * Gets html tag
935          *   935          *
936          * @return string $htmlTag Html tag   936          * @return string $htmlTag Html tag
937          */   937          */
938         public function getHtmlTag() {   938         public function getHtmlTag() {
939                 return $this->htmlTag;   939                 return $this->htmlTag;
940         }   940         }
941     941  
942         /**   942         /**
943          * Get meta charset   943          * Get meta charset
944          *   944          *
945          * @return string   945          * @return string
946          */   946          */
947         public function getMetaCharsetTag() {   947         public function getMetaCharsetTag() {
948                 return $this->metaCharsetTag;   948                 return $this->metaCharsetTag;
949         }   949         }
950     950  
951         /**   951         /**
952          * Gets head tag   952          * Gets head tag
953          *   953          *
954          * @return string $tag Head tag   954          * @return string $tag Head tag
955          */   955          */
956         public function getHeadTag() {   956         public function getHeadTag() {
957                 return $this->headTag;   957                 return $this->headTag;
958         }   958         }
959     959  
960         /**   960         /**
961          * Gets favicon   961          * Gets favicon
962          *   962          *
963          * @return string $favIcon   963          * @return string $favIcon
964          */   964          */
965         public function getFavIcon() {   965         public function getFavIcon() {
966                 return $this->favIcon;   966                 return $this->favIcon;
967         }   967         }
968     968  
969         /**   969         /**
970          * Gets icon mime type   970          * Gets icon mime type
971          *   971          *
972          * @return string $iconMimeType   972          * @return string $iconMimeType
973          */   973          */
974         public function getIconMimeType() {   974         public function getIconMimeType() {
975                 return $this->iconMimeType;   975                 return $this->iconMimeType;
976         }   976         }
977     977  
978         /**   978         /**
979          * Gets HTML base URL   979          * Gets HTML base URL
980          *   980          *
981          * @return string $url   981          * @return string $url
982          */   982          */
983         public function getBaseUrl() {   983         public function getBaseUrl() {
984                 return $this->baseUrl;   984                 return $this->baseUrl;
985         }   985         }
986     986  
987         /**   987         /**
988          * Gets template file   988          * Gets template file
989          *   989          *
990          * @return string   990          * @return string
991          */   991          */
992         public function getTemplateFile() {   992         public function getTemplateFile() {
993                 return $this->templateFile;   993                 return $this->templateFile;
994         }   994         }
995     995  
996         /**   996         /**
997          * Gets MoveJsFromHeaderToFooter   997          * Gets MoveJsFromHeaderToFooter
998          *   998          *
999          * @return boolean   999          * @return boolean
1000          */   1000          */
1001         public function getMoveJsFromHeaderToFooter() {   1001         public function getMoveJsFromHeaderToFooter() {
1002                 return $this->moveJsFromHeaderToFooter;   1002                 return $this->moveJsFromHeaderToFooter;
1003         }   1003         }
1004     1004  
1005         /**   1005         /**
1006          * Gets compress of javascript   1006          * Gets compress of javascript
1007          *   1007          *
1008          * @return boolean   1008          * @return boolean
1009          */   1009          */
1010         public function getCompressJavascript() {   1010         public function getCompressJavascript() {
1011                 return $this->compressJavascript;   1011                 return $this->compressJavascript;
1012         }   1012         }
1013     1013  
1014         /**   1014         /**
1015          * Gets compress of css   1015          * Gets compress of css
1016          *   1016          *
1017          * @return boolean   1017          * @return boolean
1018          */   1018          */
1019         public function getCompressCss() {   1019         public function getCompressCss() {
1020                 return $this->compressCss;   1020                 return $this->compressCss;
1021         }   1021         }
1022     1022  
1023         /**   1023         /**
1024          * Gets concatenate of js and css files   1024          * Gets concatenate of js and css files
1025          *   1025          *
1026          * @return boolean   1026          * @return boolean
1027          */   1027          */
1028         public function getConcatenateFiles() {   1028         public function getConcatenateFiles() {
1029                 return $this->concatenateFiles;   1029                 return $this->concatenateFiles;
1030         }   1030         }
1031     1031  
1032         /**   1032         /**
1033          * Gets concatenate of js files   1033          * Gets concatenate of js files
1034          *   1034          *
1035          * @return boolean   1035          * @return boolean
1036          */   1036          */
1037         public function getConcatenateJavascript() {   1037         public function getConcatenateJavascript() {
1038                 return $this->concatenateJavascript;   1038                 return $this->concatenateJavascript;
1039         }   1039         }
1040     1040  
1041         /**   1041         /**
1042          * Gets concatenate of css files   1042          * Gets concatenate of css files
1043          *   1043          *
1044          * @return boolean   1044          * @return boolean
1045          */   1045          */
1046         public function getConcatenateCss() {   1046         public function getConcatenateCss() {
1047                 return $this->concatenateCss;   1047                 return $this->concatenateCss;
1048         }   1048         }
1049     1049  
1050         /**   1050         /**
1051          * Gets remove of empty lines from template   1051          * Gets remove of empty lines from template
1052          *   1052          *
1053          * @return boolean   1053          * @return boolean
1054          */   1054          */
1055         public function getRemoveLineBreaksFromTemplate() {   1055         public function getRemoveLineBreaksFromTemplate() {
1056                 return $this->removeLineBreaksFromTemplate;   1056                 return $this->removeLineBreaksFromTemplate;
1057         }   1057         }
1058     1058  
1059         /**   1059         /**
1060          * Gets content for body   1060          * Gets content for body
1061          *   1061          *
1062          * @return string   1062          * @return string
1063          */   1063          */
1064         public function getBodyContent() {   1064         public function getBodyContent() {
1065                 return $this->bodyContent;   1065                 return $this->bodyContent;
1066         }   1066         }
1067     1067  
1068         /**   1068         /**
1069          * Gets Path for prototype library (relative to typo3 directory)   1069          * Gets Path for prototype library (relative to typo3 directory)
1070          *   1070          *
1071          * @return string   1071          * @return string
1072          */   1072          */
1073         public function getPrototypePath() {   1073         public function getPrototypePath() {
1074                 return $this->prototypePath;   1074                 return $this->prototypePath;
1075         }   1075         }
1076     1076  
1077         /**   1077         /**
1078          * Gets Path for scriptaculous library (relative to typo3 directory)   1078          * Gets Path for scriptaculous library (relative to typo3 directory)
1079          *   1079          *
1080          * @return string   1080          * @return string
1081          */   1081          */
1082         public function getScriptaculousPath() {   1082         public function getScriptaculousPath() {
1083                 return $this->scriptaculousPath;   1083                 return $this->scriptaculousPath;
1084         }   1084         }
1085     1085  
1086         /**   1086         /**
1087          * Gets Path for Ext Core library (relative to typo3 directory)   1087          * Gets Path for Ext Core library (relative to typo3 directory)
1088          *   1088          *
1089          * @return string   1089          * @return string
1090          */   1090          */
1091         public function getExtCorePath() {   1091         public function getExtCorePath() {
1092                 return $this->extCorePath;   1092                 return $this->extCorePath;
1093         }   1093         }
1094     1094  
1095         /**   1095         /**
1096          * Gets Path for ExtJs library (relative to typo3 directory)   1096          * Gets Path for ExtJs library (relative to typo3 directory)
1097          *   1097          *
1098          * @return string   1098          * @return string
1099          */   1099          */
1100         public function getExtJsPath() {   1100         public function getExtJsPath() {
1101                 return $this->extJsPath;   1101                 return $this->extJsPath;
1102         }   1102         }
1103     1103  
1104         /**   1104         /**
1105          * Gets Path for SVG library (relative to typo3 directory)   1105          * Gets Path for SVG library (relative to typo3 directory)
1106          *   1106          *
1107          * @return string   1107          * @return string
1108          */   1108          */
1109         public function getSvgPath() {   1109         public function getSvgPath() {
1110                 return $this->svgPath;   1110                 return $this->svgPath;
1111         }   1111         }
1112     1112  
1113         /**   1113         /**
1114          * Gets the inline language labels.   1114          * Gets the inline language labels.
1115          *   1115          *
1116          * @return array The inline language labels   1116          * @return array The inline language labels
1117          */   1117          */
1118         public function getInlineLanguageLabels() {   1118         public function getInlineLanguageLabels() {
1119                 return $this->inlineLanguageLabels;   1119                 return $this->inlineLanguageLabels;
1120         }   1120         }
1121     1121  
1122         /**   1122         /**
1123          * Gets the inline language files   1123          * Gets the inline language files
1124          *   1124          *
1125          * @return array   1125          * @return array
1126          */   1126          */
1127         public function getInlineLanguageLabelFiles() {   1127         public function getInlineLanguageLabelFiles() {
1128                 return $this->inlineLanguageLabelFiles;   1128                 return $this->inlineLanguageLabelFiles;
1129         }   1129         }
1130     1130  
1131         /*****************************************************/   1131         /*****************************************************/
1132         /*                                                   */   1132         /*                                                   */
1133         /*  Public Functions to add Data                     */   1133         /*  Public Functions to add Data                     */
1134         /*                                                   */   1134         /*                                                   */
1135         /*                                                   */   1135         /*                                                   */
1136         /*****************************************************/   1136         /*****************************************************/
1137         /**   1137         /**
1138          * Adds meta data   1138          * Adds meta data
1139          *   1139          *
1140          * @param string $meta Meta data (complete metatag)   1140          * @param string $meta Meta data (complete metatag)
1141          * @return void   1141          * @return void
1142          */   1142          */
1143         public function addMetaTag($meta) {   1143         public function addMetaTag($meta) {
1144                 if (!in_array($meta, $this->metaTags)) {   1144                 if (!in_array($meta, $this->metaTags)) {
1145                         $this->metaTags[] = $meta;   1145                         $this->metaTags[] = $meta;
1146                 }   1146                 }
1147         }   1147         }
1148     1148  
1149         /**   1149         /**
1150          * Adds inline HTML comment   1150          * Adds inline HTML comment
1151          *   1151          *
1152          * @param string $comment   1152          * @param string $comment
1153          * @return void   1153          * @return void
1154          */   1154          */
1155         public function addInlineComment($comment) {   1155         public function addInlineComment($comment) {
1156                 if (!in_array($comment, $this->inlineComments)) {   1156                 if (!in_array($comment, $this->inlineComments)) {
1157                         $this->inlineComments[] = $comment;   1157                         $this->inlineComments[] = $comment;
1158                 }   1158                 }
1159         }   1159         }
1160     1160  
1161         /**   1161         /**
1162          * Adds header data   1162          * Adds header data
1163          *   1163          *
1164          * @param string $data Free header data for HTML header   1164          * @param string $data Free header data for HTML header
1165          * @return void   1165          * @return void
1166          */   1166          */
1167         public function addHeaderData($data) {   1167         public function addHeaderData($data) {
1168                 if (!in_array($data, $this->headerData)) {   1168                 if (!in_array($data, $this->headerData)) {
1169                         $this->headerData[] = $data;   1169                         $this->headerData[] = $data;
1170                 }   1170                 }
1171         }   1171         }
1172     1172  
1173         /**   1173         /**
1174          * Adds footer data   1174          * Adds footer data
1175          *   1175          *
1176          * @param string $data Free header data for HTML header   1176          * @param string $data Free header data for HTML header
1177          * @return void   1177          * @return void
1178          */   1178          */
1179         public function addFooterData($data) {   1179         public function addFooterData($data) {
1180                 if (!in_array($data, $this->footerData)) {   1180                 if (!in_array($data, $this->footerData)) {
1181                         $this->footerData[] = $data;   1181                         $this->footerData[] = $data;
1182                 }   1182                 }
1183         }   1183         }
1184     1184  
1185         /**   1185         /**
1186          * Adds JS Library. JS Library block is rendered on top of the JS files.   1186          * Adds JS Library. JS Library block is rendered on top of the JS files.
1187          *   1187          *
1188          * @param string $name Arbitrary identifier   1188          * @param string $name Arbitrary identifier
1189          * @param string $file File name   1189          * @param string $file File name
1190          * @param string $type Content Type   1190          * @param string $type Content Type
1191          * @param boolean $compress Flag if library should be compressed   1191          * @param boolean $compress Flag if library should be compressed
1192          * @param boolean $forceOnTop Flag if added library should be inserted at begin of this block   1192          * @param boolean $forceOnTop Flag if added library should be inserted at begin of this block
1193          * @param string $allWrap   1193          * @param string $allWrap
1194          * @param boolean $excludeFromConcatenation   1194          * @param boolean $excludeFromConcatenation
1195          * @return void   1195          * @return void
1196          */   1196          */
1197         public function addJsLibrary($name, $file, $type = 'text/javascript', $compress = FALSE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {   1197         public function addJsLibrary($name, $file, $type = 'text/javascript', $compress = FALSE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {
1198                 if (!$type) {   1198                 if (!$type) {
1199                         $type = 'text/javascript';   1199                         $type = 'text/javascript';
1200                 }   1200                 }
1201                 if (!in_array(strtolower($name), $this->jsLibs)) {   1201                 if (!in_array(strtolower($name), $this->jsLibs)) {
1202                         $this->jsLibs[strtolower($name)] = array(   1202                         $this->jsLibs[strtolower($name)] = array(
1203                                 'file' => $file,   1203                                 'file' => $file,
1204                                 'type' => $type,   1204                                 'type' => $type,
1205                                 'section' => self::PART_HEADER,   1205                                 'section' => self::PART_HEADER,
1206                                 'compress' => $compress,   1206                                 'compress' => $compress,
1207                                 'forceOnTop' => $forceOnTop,   1207                                 'forceOnTop' => $forceOnTop,
1208                                 'allWrap' => $allWrap,   1208                                 'allWrap' => $allWrap,
1209                                 'excludeFromConcatenation' => $excludeFromConcatenation   1209                                 'excludeFromConcatenation' => $excludeFromConcatenation
1210                         );   1210                         );
1211                 }   1211                 }
1212         }   1212         }
1213     1213  
1214         /**   1214         /**
1215          * Adds JS Library to Footer. JS Library block is rendered on top of the Footer JS files.   1215          * Adds JS Library to Footer. JS Library block is rendered on top of the Footer JS files.
1216          *   1216          *
1217          * @param string $name Arbitrary identifier   1217          * @param string $name Arbitrary identifier
1218          * @param string $file File name   1218          * @param string $file File name
1219          * @param string $type Content Type   1219          * @param string $type Content Type
1220          * @param boolean $compress Flag if library should be compressed   1220          * @param boolean $compress Flag if library should be compressed
1221          * @param boolean $forceOnTop Flag if added library should be inserted at begin of this block   1221          * @param boolean $forceOnTop Flag if added library should be inserted at begin of this block
1222          * @param string $allWrap   1222          * @param string $allWrap
1223          * @param boolean $excludeFromConcatenation   1223          * @param boolean $excludeFromConcatenation
1224          * @return void   1224          * @return void
1225          */   1225          */
1226         public function addJsFooterLibrary($name, $file, $type = 'text/javascript', $compress = FALSE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {   1226         public function addJsFooterLibrary($name, $file, $type = 'text/javascript', $compress = FALSE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {
1227                 if (!$type) {   1227                 if (!$type) {
1228                         $type = 'text/javascript';   1228                         $type = 'text/javascript';
1229                 }   1229                 }
1230                 if (!in_array(strtolower($name), $this->jsLibs)) {   1230                 if (!in_array(strtolower($name), $this->jsLibs)) {
1231                         $this->jsLibs[strtolower($name)] = array(   1231                         $this->jsLibs[strtolower($name)] = array(
1232                                 'file' => $file,   1232                                 'file' => $file,
1233                                 'type' => $type,   1233                                 'type' => $type,
1234                                 'section' => self::PART_FOOTER,   1234                                 'section' => self::PART_FOOTER,
1235                                 'compress' => $compress,   1235                                 'compress' => $compress,
1236                                 'forceOnTop' => $forceOnTop,   1236                                 'forceOnTop' => $forceOnTop,
1237                                 'allWrap' => $allWrap,   1237                                 'allWrap' => $allWrap,
1238                                 'excludeFromConcatenation' => $excludeFromConcatenation   1238                                 'excludeFromConcatenation' => $excludeFromConcatenation
1239                         );   1239                         );
1240                 }   1240                 }
1241         }   1241         }
1242     1242  
1243         /**   1243         /**
1244          * Adds JS file   1244          * Adds JS file
1245          *   1245          *
1246          * @param string $file File name   1246          * @param string $file File name
1247          * @param string $type Content Type   1247          * @param string $type Content Type
1248          * @param boolean $compress   1248          * @param boolean $compress
1249          * @param boolean $forceOnTop   1249          * @param boolean $forceOnTop
1250          * @param string $allWrap   1250          * @param string $allWrap
1251          * @param boolean $excludeFromConcatenation   1251          * @param boolean $excludeFromConcatenation
1252          * @return void   1252          * @return void
1253          */   1253          */
1254         public function addJsFile($file, $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {   1254         public function addJsFile($file, $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {
1255                 if (!$type) {   1255                 if (!$type) {
1256                         $type = 'text/javascript';   1256                         $type = 'text/javascript';
1257                 }   1257                 }
1258                 if (!isset($this->jsFiles[$file])) {   1258                 if (!isset($this->jsFiles[$file])) {
1259                         if (strpos($file, 'ajax.php?') !== FALSE) {   1259                         if (strpos($file, 'ajax.php?') !== FALSE) {
1260                                 $compress = FALSE;   1260                                 $compress = FALSE;
1261                         }   1261                         }
1262                         $this->jsFiles[$file] = array(   1262                         $this->jsFiles[$file] = array(
1263                                 'file' => $file,   1263                                 'file' => $file,
1264                                 'type' => $type,   1264                                 'type' => $type,
1265                                 'section' => self::PART_HEADER,   1265                                 'section' => self::PART_HEADER,
1266                                 'compress' => $compress,   1266                                 'compress' => $compress,
1267                                 'forceOnTop' => $forceOnTop,   1267                                 'forceOnTop' => $forceOnTop,
1268                                 'allWrap' => $allWrap,   1268                                 'allWrap' => $allWrap,
1269                                 'excludeFromConcatenation' => $excludeFromConcatenation   1269                                 'excludeFromConcatenation' => $excludeFromConcatenation
1270                         );   1270                         );
1271                 }   1271                 }
1272         }   1272         }
1273     1273  
1274         /**   1274         /**
1275          * Adds JS file to footer   1275          * Adds JS file to footer
1276          *   1276          *
1277          * @param string $file File name   1277          * @param string $file File name
1278          * @param string $type Content Type   1278          * @param string $type Content Type
1279          * @param boolean $compress   1279          * @param boolean $compress
1280          * @param boolean $forceOnTop   1280          * @param boolean $forceOnTop
1281          * @param string $allWrap   1281          * @param string $allWrap
1282          * @param boolean $excludeFromConcatenation   1282          * @param boolean $excludeFromConcatenation
1283          * @return void   1283          * @return void
1284          */   1284          */
1285         public function addJsFooterFile($file, $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {   1285         public function addJsFooterFile($file, $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {
1286                 if (!$type) {   1286                 if (!$type) {
1287                         $type = 'text/javascript';   1287                         $type = 'text/javascript';
1288                 }   1288                 }
1289                 if (!isset($this->jsFiles[$file])) {   1289                 if (!isset($this->jsFiles[$file])) {
1290                         if (strpos($file, 'ajax.php?') !== FALSE) {   1290                         if (strpos($file, 'ajax.php?') !== FALSE) {
1291                                 $compress = FALSE;   1291                                 $compress = FALSE;
1292                         }   1292                         }
1293                         $this->jsFiles[$file] = array(   1293                         $this->jsFiles[$file] = array(
1294                                 'file' => $file,   1294                                 'file' => $file,
1295                                 'type' => $type,   1295                                 'type' => $type,
1296                                 'section' => self::PART_FOOTER,   1296                                 'section' => self::PART_FOOTER,
1297                                 'compress' => $compress,   1297                                 'compress' => $compress,
1298                                 'forceOnTop' => $forceOnTop,   1298                                 'forceOnTop' => $forceOnTop,
1299                                 'allWrap' => $allWrap,   1299                                 'allWrap' => $allWrap,
1300                                 'excludeFromConcatenation' => $excludeFromConcatenation   1300                                 'excludeFromConcatenation' => $excludeFromConcatenation
1301                         );   1301                         );
1302                 }   1302                 }
1303         }   1303         }
1304     1304  
1305         /**   1305         /**
1306          * Adds JS inline code   1306          * Adds JS inline code
1307          *   1307          *
1308          * @param string $name   1308          * @param string $name
1309          * @param string $block   1309          * @param string $block
1310          * @param boolean $compress   1310          * @param boolean $compress
1311          * @param boolean $forceOnTop   1311          * @param boolean $forceOnTop
1312          * @return void   1312          * @return void
1313          */   1313          */
1314         public function addJsInlineCode($name, $block, $compress = TRUE, $forceOnTop = FALSE) {   1314         public function addJsInlineCode($name, $block, $compress = TRUE, $forceOnTop = FALSE) {
1315                 if (!isset($this->jsInline[$name]) && !empty($block)) {   1315                 if (!isset($this->jsInline[$name]) && !empty($block)) {
1316                         $this->jsInline[$name] = array(   1316                         $this->jsInline[$name] = array(
1317                                 'code' => $block . LF,   1317                                 'code' => $block . LF,
1318                                 'section' => self::PART_HEADER,   1318                                 'section' => self::PART_HEADER,
1319                                 'compress' => $compress,   1319                                 'compress' => $compress,
1320                                 'forceOnTop' => $forceOnTop   1320                                 'forceOnTop' => $forceOnTop
1321                         );   1321                         );
1322                 }   1322                 }
1323         }   1323         }
1324     1324  
1325         /**   1325         /**
1326          * Adds JS inline code to footer   1326          * Adds JS inline code to footer
1327          *   1327          *
1328          * @param string $name   1328          * @param string $name
1329          * @param string $block   1329          * @param string $block
1330          * @param boolean $compress   1330          * @param boolean $compress
1331          * @param boolean $forceOnTop   1331          * @param boolean $forceOnTop
1332          * @return void   1332          * @return void
1333          */   1333          */
1334         public function addJsFooterInlineCode($name, $block, $compress = TRUE, $forceOnTop = FALSE) {   1334         public function addJsFooterInlineCode($name, $block, $compress = TRUE, $forceOnTop = FALSE) {
1335                 if (!isset($this->jsInline[$name]) && !empty($block)) {   1335                 if (!isset($this->jsInline[$name]) && !empty($block)) {
1336                         $this->jsInline[$name] = array(   1336                         $this->jsInline[$name] = array(
1337                                 'code' => $block . LF,   1337                                 'code' => $block . LF,
1338                                 'section' => self::PART_FOOTER,   1338                                 'section' => self::PART_FOOTER,
1339                                 'compress' => $compress,   1339                                 'compress' => $compress,
1340                                 'forceOnTop' => $forceOnTop   1340                                 'forceOnTop' => $forceOnTop
1341                         );   1341                         );
1342                 }   1342                 }
1343         }   1343         }
1344     1344  
1345         /**   1345         /**
1346          * Adds Ext.onready code, which will be wrapped in Ext.onReady(function() {...});   1346          * Adds Ext.onready code, which will be wrapped in Ext.onReady(function() {...});
1347          *   1347          *
1348          * @param string $block Javascript code   1348          * @param string $block Javascript code
1349          * @param boolean $forceOnTop Position of the javascript code (TRUE for putting it on top, default is FALSE = bottom)   1349          * @param boolean $forceOnTop Position of the javascript code (TRUE for putting it on top, default is FALSE = bottom)
1350          * @return void   1350          * @return void
1351          */   1351          */
1352         public function addExtOnReadyCode($block, $forceOnTop = FALSE) {   1352         public function addExtOnReadyCode($block, $forceOnTop = FALSE) {
1353                 if (!in_array($block, $this->extOnReadyCode)) {   1353                 if (!in_array($block, $this->extOnReadyCode)) {
1354                         if ($forceOnTop) {   1354                         if ($forceOnTop) {
1355                                 array_unshift($this->extOnReadyCode, $block);   1355                                 array_unshift($this->extOnReadyCode, $block);
1356                         } else {   1356                         } else {
1357                                 $this->extOnReadyCode[] = $block;   1357                                 $this->extOnReadyCode[] = $block;
1358                         }   1358                         }
1359                 }   1359                 }
1360         }   1360         }
1361     1361  
1362         /**   1362         /**
1363          * Adds the ExtDirect code   1363          * Adds the ExtDirect code
1364          *   1364          *
1365          * @param array $filterNamespaces Limit the output to defined namespaces. If empty, all namespaces are generated   1365          * @param array $filterNamespaces Limit the output to defined namespaces. If empty, all namespaces are generated
1366          * @return void   1366          * @return void
1367          */   1367          */
1368         public function addExtDirectCode(array $filterNamespaces = array()) {   1368         public function addExtDirectCode(array $filterNamespaces = array()) {
1369                 if ($this->extDirectCodeAdded) {   1369                 if ($this->extDirectCodeAdded) {
1370                         return;   1370                         return;
1371                 }   1371                 }
1372                 $this->extDirectCodeAdded = TRUE;   1372                 $this->extDirectCodeAdded = TRUE;
1373                 if (count($filterNamespaces) === 0) {   1373                 if (count($filterNamespaces) === 0) {
1374                         $filterNamespaces = array('TYPO3');   1374                         $filterNamespaces = array('TYPO3');
1375                 }   1375                 }
1376                 // For ExtDirect we need flash message support   1376                 // For ExtDirect we need flash message support
1377                 $this->addJsFile(\TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($this->backPath . '../t3lib/js/extjs/ux/flashmessages.js'));   1377                 $this->addJsFile(\TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($this->backPath . '../t3lib/js/extjs/ux/flashmessages.js'));
1378                 // Add language labels for ExtDirect   1378                 // Add language labels for ExtDirect
1379                 if (TYPO3_MODE === 'FE') {   1379                 if (TYPO3_MODE === 'FE') {
1380                         $this->addInlineLanguageLabelArray(array(   1380                         $this->addInlineLanguageLabelArray(array(
1381                                 'extDirect_timeoutHeader' => $GLOBALS['TSFE']->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutHeader'),   1381                                 'extDirect_timeoutHeader' => $GLOBALS['TSFE']->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutHeader'),
1382                                 'extDirect_timeoutMessage' => $GLOBALS['TSFE']->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutMessage')   1382                                 'extDirect_timeoutMessage' => $GLOBALS['TSFE']->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutMessage')
1383                         ));   1383                         ));
1384                 } else {   1384                 } else {
1385                         $this->addInlineLanguageLabelArray(array(   1385                         $this->addInlineLanguageLabelArray(array(
1386                                 'extDirect_timeoutHeader' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutHeader'),   1386                                 'extDirect_timeoutHeader' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutHeader'),
1387                                 'extDirect_timeoutMessage' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutMessage')   1387                                 'extDirect_timeoutMessage' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutMessage')
1388                         ));   1388                         ));
1389                 }   1389                 }
1390                 $token = ($api = '');   1390                 $token = ($api = '');
1391                 if (TYPO3_MODE === 'BE') {   1391                 if (TYPO3_MODE === 'BE') {
1392                         $formprotection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();   1392                         $formprotection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
1393                         $token = $formprotection->generateToken('extDirect');   1393                         $token = $formprotection->generateToken('extDirect');
1394                 }   1394                 }
1395                 /** @var $extDirect \TYPO3\CMS\Core\ExtDirect\ExtDirectApi */   1395                 /** @var $extDirect \TYPO3\CMS\Core\ExtDirect\ExtDirectApi */
1396                 $extDirect = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\ExtDirect\\ExtDirectApi');   1396                 $extDirect = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\ExtDirect\\ExtDirectApi');
1397                 $api = $extDirect->getApiPhp($filterNamespaces);   1397                 $api = $extDirect->getApiPhp($filterNamespaces);
1398                 if ($api) {   1398                 if ($api) {
1399                         $this->addJsInlineCode('TYPO3ExtDirectAPI', $api, FALSE);   1399                         $this->addJsInlineCode('TYPO3ExtDirectAPI', $api, FALSE);
1400                 }   1400                 }
1401                 // Note: we need to iterate thru the object, because the addProvider method   1401                 // Note: we need to iterate thru the object, because the addProvider method
1402                 // does this only with multiple arguments   1402                 // does this only with multiple arguments
1403                 $this->addExtOnReadyCode('   1403                 $this->addExtOnReadyCode('
1404                         (function() {   1404                         (function() {
1405                                 TYPO3.ExtDirectToken = "' . $token . '";   1405                                 TYPO3.ExtDirectToken = "' . $token . '";
1406                                 for (var api in Ext.app.ExtDirectAPI) {   1406                                 for (var api in Ext.app.ExtDirectAPI) {
1407                                         var provider = Ext.Direct.addProvider(Ext.app.ExtDirectAPI[api]);   1407                                         var provider = Ext.Direct.addProvider(Ext.app.ExtDirectAPI[api]);
1408                                         provider.on("beforecall", function(provider, transaction, meta) {   1408                                         provider.on("beforecall", function(provider, transaction, meta) {
1409                                                 if (transaction.data) {   1409                                                 if (transaction.data) {
1410                                                         transaction.data[transaction.data.length] = TYPO3.ExtDirectToken;   1410                                                         transaction.data[transaction.data.length] = TYPO3.ExtDirectToken;
1411                                                 } else {   1411                                                 } else {
1412                                                         transaction.data = [TYPO3.ExtDirectToken];   1412                                                         transaction.data = [TYPO3.ExtDirectToken];
1413                                                 }   1413                                                 }
1414                                         });   1414                                         });
1415     1415  
1416                                         provider.on("call", function(provider, transaction, meta) {   1416                                         provider.on("call", function(provider, transaction, meta) {
1417                                                 if (transaction.isForm) {   1417                                                 if (transaction.isForm) {
1418                                                         transaction.params.securityToken = TYPO3.ExtDirectToken;   1418                                                         transaction.params.securityToken = TYPO3.ExtDirectToken;
1419                                                 }   1419                                                 }
1420                                         });   1420                                         });
1421                                 }   1421                                 }
1422                         })();   1422                         })();
1423     1423  
1424                         var extDirectDebug = function(message, header, group) {   1424                         var extDirectDebug = function(message, header, group) {
1425                                 var TYPO3ViewportInstance = null;   1425                                 var TYPO3ViewportInstance = null;
1426     1426  
1427                                 if (top && top.TYPO3 && typeof top.TYPO3.Backend === "object") {   1427                                 if (top && top.TYPO3 && typeof top.TYPO3.Backend === "object") {
1428                                         TYPO3ViewportInstance = top.TYPO3.Backend;   1428                                         TYPO3ViewportInstance = top.TYPO3.Backend;
1429                                 } else if (typeof TYPO3 === "object" && typeof TYPO3.Backend === "object") {   1429                                 } else if (typeof TYPO3 === "object" && typeof TYPO3.Backend === "object") {
1430                                         TYPO3ViewportInstance = TYPO3.Backend;   1430                                         TYPO3ViewportInstance = TYPO3.Backend;
1431                                 }   1431                                 }
1432     1432  
1433                                 if (TYPO3ViewportInstance !== null) {   1433                                 if (TYPO3ViewportInstance !== null) {
1434                                         TYPO3ViewportInstance.DebugConsole.addTab(message, header, group);   1434                                         TYPO3ViewportInstance.DebugConsole.addTab(message, header, group);
1435                                 } else if (typeof console === "object") {   1435                                 } else if (typeof console === "object") {
1436                                         console.log(message);   1436                                         console.log(message);
1437                                 } else {   1437                                 } else {
1438                                         document.write(message);   1438                                         document.write(message);
1439                                 }   1439                                 }
1440                         };   1440                         };
1441     1441  
1442                         Ext.Direct.on("exception", function(event) {   1442                         Ext.Direct.on("exception", function(event) {
1443                                 if (event.code === Ext.Direct.exceptions.TRANSPORT && !event.where) {   1443                                 if (event.code === Ext.Direct.exceptions.TRANSPORT && !event.where) {
1444                                         TYPO3.Flashmessage.display(   1444                                         TYPO3.Flashmessage.display(
1445                                                 TYPO3.Severity.error,   1445                                                 TYPO3.Severity.error,
1446                                                 TYPO3.l10n.localize("extDirect_timeoutHeader"),   1446                                                 TYPO3.l10n.localize("extDirect_timeoutHeader"),
1447                                                 TYPO3.l10n.localize("extDirect_timeoutMessage"),   1447                                                 TYPO3.l10n.localize("extDirect_timeoutMessage"),
1448                                                 30   1448                                                 30
1449                                         );   1449                                         );
1450                                 } else {   1450                                 } else {
1451                                         var backtrace = "";   1451                                         var backtrace = "";
1452                                         if (event.code === "parse") {   1452                                         if (event.code === "parse") {
1453                                                 extDirectDebug(   1453                                                 extDirectDebug(
1454                                                         "<p>" + event.xhr.responseText + "<\\/p>",   1454                                                         "<p>" + event.xhr.responseText + "<\\/p>",
1455                                                         event.type,   1455                                                         event.type,
1456                                                         "ExtDirect - Exception"   1456                                                         "ExtDirect - Exception"
1457                                                 );   1457                                                 );
1458                                         } else if (event.code === "router") {   1458                                         } else if (event.code === "router") {
1459                                                 TYPO3.Flashmessage.display(   1459                                                 TYPO3.Flashmessage.display(
1460                                                         TYPO3.Severity.error,   1460                                                         TYPO3.Severity.error,
1461                                                         event.code,   1461                                                         event.code,
1462                                                         event.message,   1462                                                         event.message,
1463                                                         30   1463                                                         30
1464                                                 );   1464                                                 );
1465                                         } else if (event.where) {   1465                                         } else if (event.where) {
1466                                                 backtrace = "<p style=\\"margin-top: 20px;\\">" +   1466                                                 backtrace = "<p style=\\"margin-top: 20px;\\">" +
1467                                                         "<strong>Backtrace:<\\/strong><br \\/>" +   1467                                                         "<strong>Backtrace:<\\/strong><br \\/>" +
1468                                                         event.where.replace(/#/g, "<br \\/>#") +   1468                                                         event.where.replace(/#/g, "<br \\/>#") +
1469                                                         "<\\/p>";   1469                                                         "<\\/p>";
1470                                                 extDirectDebug(   1470                                                 extDirectDebug(
1471                                                         "<p>" + event.message + "<\\/p>" + backtrace,   1471                                                         "<p>" + event.message + "<\\/p>" + backtrace,
1472                                                         event.method,   1472                                                         event.method,
1473                                                         "ExtDirect - Exception"   1473                                                         "ExtDirect - Exception"
1474                                                 );   1474                                                 );
1475                                         }   1475                                         }
1476     1476  
1477     1477  
1478                                 }   1478                                 }
1479                         });   1479                         });
1480     1480  
1481                         Ext.Direct.on("event", function(event, provider) {   1481                         Ext.Direct.on("event", function(event, provider) {
1482                                 if (typeof event.debug !== "undefined" && event.debug !== "") {   1482                                 if (typeof event.debug !== "undefined" && event.debug !== "") {
1483                                         extDirectDebug(event.debug, event.method, "ExtDirect - Debug");   1483                                         extDirectDebug(event.debug, event.method, "ExtDirect - Debug");
1484                                 }   1484                                 }
1485                         });   1485                         });
1486                         ', TRUE);   1486                         ', TRUE);
1487         }   1487         }
1488     1488  
1489         /**   1489         /**
1490          * Adds CSS file   1490          * Adds CSS file
1491          *   1491          *
1492          * @param string $file   1492          * @param string $file
1493          * @param string $rel   1493          * @param string $rel
1494          * @param string $media   1494          * @param string $media
1495          * @param string $title   1495          * @param string $title
1496          * @param boolean $compress   1496          * @param boolean $compress
1497          * @param boolean $forceOnTop   1497          * @param boolean $forceOnTop
1498          * @param string $allWrap   1498          * @param string $allWrap
1499          * @param boolean $excludeFromConcatenation   1499          * @param boolean $excludeFromConcatenation
1500          * @return void   1500          * @return void
1501          */   1501          */
1502         public function addCssFile($file, $rel = 'stylesheet', $media = 'all', $title = '', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {   1502         public function addCssFile($file, $rel = 'stylesheet', $media = 'all', $title = '', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE) {
1503                 if (!isset($this->cssFiles[$file])) {   1503                 if (!isset($this->cssFiles[$file])) {
1504                         $this->cssFiles[$file] = array(   1504                         $this->cssFiles[$file] = array(
1505                                 'file' => $file,   1505                                 'file' => $file,
1506                                 'rel' => $rel,   1506                                 'rel' => $rel,
1507                                 'media' => $media,   1507                                 'media' => $media,
1508                                 'title' => $title,   1508                                 'title' => $title,
1509                                 'compress' => $compress,   1509                                 'compress' => $compress,
1510                                 'forceOnTop' => $forceOnTop,   1510                                 'forceOnTop' => $forceOnTop,
1511                                 'allWrap' => $allWrap,   1511                                 'allWrap' => $allWrap,
1512                                 'excludeFromConcatenation' => $excludeFromConcatenation   1512                                 'excludeFromConcatenation' => $excludeFromConcatenation
1513                         );   1513                         );
1514                 }   1514                 }
1515         }   1515         }
1516     1516  
1517         /**   1517         /**
1518          * Adds CSS inline code   1518          * Adds CSS inline code
1519          *   1519          *
1520          * @param string $name   1520          * @param string $name
1521          * @param string $block   1521          * @param string $block
1522          * @param boolean $compress   1522          * @param boolean $compress
1523          * @param boolean $forceOnTop   1523          * @param boolean $forceOnTop
1524          * @return void   1524          * @return void
1525          */   1525          */
1526         public function addCssInlineBlock($name, $block, $compress = FALSE, $forceOnTop = FALSE) {   1526         public function addCssInlineBlock($name, $block, $compress = FALSE, $forceOnTop = FALSE) {
1527                 if (!isset($this->cssInline[$name]) && !empty($block)) {   1527                 if (!isset($this->cssInline[$name]) && !empty($block)) {
1528                         $this->cssInline[$name] = array(   1528                         $this->cssInline[$name] = array(
1529                                 'code' => $block,   1529                                 'code' => $block,
1530                                 'compress' => $compress,   1530                                 'compress' => $compress,
1531                                 'forceOnTop' => $forceOnTop   1531                                 'forceOnTop' => $forceOnTop
1532                         );   1532                         );
1533                 }   1533                 }
1534         }   1534         }
1535     1535  
1536         /**   1536         /**
1537          * Call this function if you need to include the jQuery library   1537          * Call this function if you need to include the jQuery library
1538          *   1538          *
1539          * @param null|string $version The jQuery version that should be included, either "latest" or any available version   1539          * @param null|string $version The jQuery version that should be included, either "latest" or any available version
1540          * @param null|string $source The location of the jQuery source, can be "local", "google", "msn", "jquery" or just an URL to your jQuery lib   1540          * @param null|string $source The location of the jQuery source, can be "local", "google", "msn", "jquery" or just an URL to your jQuery lib
1541          * @param string $namespace The namespace in which the jQuery object of the specific version should be stored.   1541          * @param string $namespace The namespace in which the jQuery object of the specific version should be stored.
1542          * @return void   1542          * @return void
1543          * @throws \UnexpectedValueException   1543          * @throws \UnexpectedValueException
1544          */   1544          */
1545         public function loadJquery($version = NULL, $source = NULL, $namespace = self::JQUERY_NAMESPACE_DEFAULT) {   1545         public function loadJquery($version = NULL, $source = NULL, $namespace = self::JQUERY_NAMESPACE_DEFAULT) {
1546                 // Set it to the version that is shipped with the TYPO3 core   1546                 // Set it to the version that is shipped with the TYPO3 core
1547                 if ($version === NULL || $version === 'latest') {   1547                 if ($version === NULL || $version === 'latest') {
1548                         $version = self::JQUERY_VERSION_LATEST;   1548                         $version = self::JQUERY_VERSION_LATEST;
1549                 }   1549                 }
1550                 // Check if the source is set, otherwise set it to "default"   1550                 // Check if the source is set, otherwise set it to "default"
1551                 if ($source === NULL) {   1551                 if ($source === NULL) {
1552                         $source = 'local';   1552                         $source = 'local';
1553                 }   1553                 }
1554                 if ($source === 'local' && !in_array($version, $this->availableLocalJqueryVersions)) {   1554                 if ($source === 'local' && !in_array($version, $this->availableLocalJqueryVersions)) {
1555                         throw new \UnexpectedValueException('The requested jQuery version is not available in the local filesystem.', 1341505305);   1555                         throw new \UnexpectedValueException('The requested jQuery version is not available in the local filesystem.', 1341505305);
1556                 }   1556                 }
1557                 if (!preg_match('/^[a-zA-Z0-9]+$/', $namespace)) {   1557                 if (!preg_match('/^[a-zA-Z0-9]+$/', $namespace)) {
1558                         throw new \UnexpectedValueException('The requested namespace contains non alphanumeric characters.', 1341571604);   1558                         throw new \UnexpectedValueException('The requested namespace contains non alphanumeric characters.', 1341571604);
1559                 }   1559                 }
1560                 $this->jQueryVersions[$namespace] = array(   1560                 $this->jQueryVersions[$namespace] = array(
1561                         'version' => $version,   1561                         'version' => $version,
1562                         'source' => $source   1562                         'source' => $source
1563                 );   1563                 );
1564         }   1564         }
1565     1565  
1566         /**   1566         /**
1567          * Call function if you need the requireJS library   1567          * Call function if you need the requireJS library
1568          * this automatically adds the JavaScript path of all loaded extensions in the requireJS path option   1568          * this automatically adds the JavaScript path of all loaded extensions in the requireJS path option
1569          * so it resolves names like TYPO3/CMS/MyExtension/MyJsFile to EXT:MyExtension/Resources/Public/JavaScript/MyJsFile.js   1569          * so it resolves names like TYPO3/CMS/MyExtension/MyJsFile to EXT:MyExtension/Resources/Public/JavaScript/MyJsFile.js
1570          * when using requireJS   1570          * when using requireJS
1571          *   1571          *
1572          * @return void   1572          * @return void
1573          */   1573          */
1574         public function loadRequireJs() {   1574         public function loadRequireJs() {
1575     1575  
1576                         // load all paths to map to package names / namespaces   1576                         // load all paths to map to package names / namespaces
1577                 if (count($this->requireJsConfig) === 0) {   1577                 if (count($this->requireJsConfig) === 0) {
1578                                 // first, load all paths for the namespaces   1578                                 // first, load all paths for the namespaces
1579                         $this->requireJsConfig['paths'] = array();   1579                         $this->requireJsConfig['paths'] = array();
1580                         // get all extensions that are loaded   1580                         // get all extensions that are loaded
1581                         $loadedExtensions = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getLoadedExtensionListArray();   1581                         $loadedExtensions = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getLoadedExtensionListArray();
1582                         foreach ($loadedExtensions as $packageName) {   1582                         foreach ($loadedExtensions as $packageName) {
1583                                 $fullJsPath = 'EXT:' . $packageName . '/Resources/Public/JavaScript/';   1583                                 $fullJsPath = 'EXT:' . $packageName . '/Resources/Public/JavaScript/';
1584                                 $fullJsPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($fullJsPath);   1584                                 $fullJsPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($fullJsPath);
1585                                 $fullJsPath = \TYPO3\CMS\Core\Utility\PathUtility::getRelativePath(PATH_typo3, $fullJsPath);   1585                                 $fullJsPath = \TYPO3\CMS\Core\Utility\PathUtility::getRelativePath(PATH_typo3, $fullJsPath);
1586                                 $fullJsPath = rtrim($fullJsPath, '/');   1586                                 $fullJsPath = rtrim($fullJsPath, '/');
1587                                 if ($fullJsPath) {   1587                                 if ($fullJsPath) {
1588                                         $this->requireJsConfig['paths']['TYPO3/CMS/' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($packageName)] = $this->backPath . $fullJsPath;   1588                                         $this->requireJsConfig['paths']['TYPO3/CMS/' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($packageName)] = $this->backPath . $fullJsPath;
1589                                 }   1589                                 }
1590                         }   1590                         }
1591     1591  
1592                                 // check if additional AMD modules need to be loaded if a single AMD module is initialized   1592                                 // check if additional AMD modules need to be loaded if a single AMD module is initialized
1593                         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['RequireJS']['postInitializationModules'])) {   1593                         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['RequireJS']['postInitializationModules'])) {
1594                                 $this->addInlineSettingArray('RequireJS.PostInitializationModules', $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['RequireJS']['postInitializationModules']);   1594                                 $this->addInlineSettingArray('RequireJS.PostInitializationModules', $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['RequireJS']['postInitializationModules']);
1595                         }   1595                         }
1596                 }   1596                 }
1597     1597  
1598                 $this->addRequireJs = TRUE;   1598                 $this->addRequireJs = TRUE;
1599         }   1599         }
1600     1600  
1601         /**   1601         /**
1602          * includes a AMD-compatible JS file by resolving the ModuleName, and then requires the file via a requireJS request   1602          * includes a AMD-compatible JS file by resolving the ModuleName, and then requires the file via a requireJS request
1603          *   1603          *
1604          * this function only works for AMD-ready JS modules, used like "define('TYPO3/CMS/Backend/FormEngine..."   1604          * this function only works for AMD-ready JS modules, used like "define('TYPO3/CMS/Backend/FormEngine..."
1605          * in the JS file   1605          * in the JS file
1606          *   1606          *
1607          *        TYPO3/CMS/Backend/FormEngine =>   1607          *        TYPO3/CMS/Backend/FormEngine =>
1608          *                 "TYPO3": Vendor Name   1608          *                 "TYPO3": Vendor Name
1609          *                 "CMS": Product Name   1609          *                 "CMS": Product Name
1610          *                "Backend": Extension Name   1610          *                "Backend": Extension Name
1611          *                "FormEngine": FileName in the Resources/Public/JavaScript folder   1611          *                "FormEngine": FileName in the Resources/Public/JavaScript folder
1612          *   1612          *
1613          * @param $mainModuleName must be in the form of "TYPO3/CMS/PackageName/ModuleName" e.g. "TYPO3/CMS/Backend/FormEngine"   1613          * @param $mainModuleName must be in the form of "TYPO3/CMS/PackageName/ModuleName" e.g. "TYPO3/CMS/Backend/FormEngine"
1614          * @return void   1614          * @return void
1615          */   1615          */
1616         public function loadRequireJsModule($mainModuleName) {   1616         public function loadRequireJsModule($mainModuleName) {
1617     1617  
1618                 // make sure requireJS is initialized   1618                 // make sure requireJS is initialized
1619                 $this->loadRequireJs();   1619                 $this->loadRequireJs();
1620     1620  
1621                 // execute the main module   1621                 // execute the main module
1622                 $this->addJsInlineCode('RequireJS-Module-' . $mainModuleName, 'require(["' . $mainModuleName . '"]);');   1622                 $this->addJsInlineCode('RequireJS-Module-' . $mainModuleName, 'require(["' . $mainModuleName . '"]);');
1623         }   1623         }
1624     1624  
1625         /**   1625         /**
1626          * Call function if you need the prototype library   1626          * Call function if you need the prototype library
1627          *   1627          *
1628          * @return void   1628          * @return void
1629          */   1629          */
1630         public function loadPrototype() {   1630         public function loadPrototype() {
1631                 $this->addPrototype = TRUE;   1631                 $this->addPrototype = TRUE;
1632         }   1632         }
1633     1633  
1634         /**   1634         /**
1635          * Call function if you need the Scriptaculous library   1635          * Call function if you need the Scriptaculous library
1636          *   1636          *
1637          * @param string $modules Add modules you need. use "all" if you need complete modules   1637          * @param string $modules Add modules you need. use "all" if you need complete modules
1638          * @return void   1638          * @return void
1639          */   1639          */
1640         public function loadScriptaculous($modules = 'all') {   1640         public function loadScriptaculous($modules = 'all') {
1641                 // Scriptaculous require prototype, so load prototype too.   1641                 // Scriptaculous require prototype, so load prototype too.
1642                 $this->addPrototype = TRUE;   1642                 $this->addPrototype = TRUE;
1643                 $this->addScriptaculous = TRUE;   1643                 $this->addScriptaculous = TRUE;
1644                 if ($modules) {   1644                 if ($modules) {
1645                         if ($modules == 'all') {   1645                         if ($modules == 'all') {
1646                                 foreach ($this->addScriptaculousModules as $key => $value) {   1646                                 foreach ($this->addScriptaculousModules as $key => $value) {
1647                                         $this->addScriptaculousModules[$key] = TRUE;   1647                                         $this->addScriptaculousModules[$key] = TRUE;
1648                                 }   1648                                 }
1649                         } else {   1649                         } else {
1650                                 $mods = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $modules);   1650                                 $mods = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $modules);
1651                                 foreach ($mods as $mod) {   1651                                 foreach ($mods as $mod) {
1652                                         if (isset($this->addScriptaculousModules[strtolower($mod)])) {   1652                                         if (isset($this->addScriptaculousModules[strtolower($mod)])) {
1653                                                 $this->addScriptaculousModules[strtolower($mod)] = TRUE;   1653                                                 $this->addScriptaculousModules[strtolower($mod)] = TRUE;
1654                                         }   1654                                         }
1655                                 }   1655                                 }
1656                         }   1656                         }
1657                 }   1657                 }
1658         }   1658         }
1659     1659  
1660         /**   1660         /**
1661          * call this function if you need the extJS library   1661          * call this function if you need the extJS library
1662          *   1662          *
1663          * @param boolean $css Flag, if set the ext-css will be loaded   1663          * @param boolean $css Flag, if set the ext-css will be loaded
1664          * @param boolean $theme Flag, if set the ext-theme "grey" will be loaded   1664          * @param boolean $theme Flag, if set the ext-theme "grey" will be loaded
1665          * @param string $adapter Choose alternative adapter, possible values: yui, prototype, jquery   1665          * @param string $adapter Choose alternative adapter, possible values: yui, prototype, jquery
1666          * @return void   1666          * @return void
1667          */   1667          */
1668         public function loadExtJS($css = TRUE, $theme = TRUE, $adapter = '') {   1668         public function loadExtJS($css = TRUE, $theme = TRUE, $adapter = '') {
1669                 if ($adapter) {   1669                 if ($adapter) {
1670                         // Empty $adapter will always load the ext adapter   1670                         // Empty $adapter will always load the ext adapter
1671                         switch (\TYPO3\CMS\Core\Utility\GeneralUtility::strtolower(trim($adapter))) {   1671                         switch (\TYPO3\CMS\Core\Utility\GeneralUtility::strtolower(trim($adapter))) {
1672                         case self::EXTJS_ADAPTER_YUI:   1672                         case self::EXTJS_ADAPTER_YUI:
1673                                 $this->extJSadapter = 'yui/ext-yui-adapter.js';   1673                                 $this->extJSadapter = 'yui/ext-yui-adapter.js';
1674                                 break;   1674                                 break;
1675                         case self::EXTJS_ADAPTER_PROTOTYPE:   1675                         case self::EXTJS_ADAPTER_PROTOTYPE:
1676                                 $this->extJSadapter = 'prototype/ext-prototype-adapter.js';   1676                                 $this->extJSadapter = 'prototype/ext-prototype-adapter.js';
1677                                 break;   1677                                 break;
1678                         case self::EXTJS_ADAPTER_JQUERY:   1678                         case self::EXTJS_ADAPTER_JQUERY:
1679                                 $this->extJSadapter = 'jquery/ext-jquery-adapter.js';   1679                                 $this->extJSadapter = 'jquery/ext-jquery-adapter.js';
1680                                 break;   1680                                 break;
1681                         }   1681                         }
1682                 }   1682                 }
1683                 $this->addExtJS = TRUE;   1683                 $this->addExtJS = TRUE;
1684                 $this->extJStheme = $theme;   1684                 $this->extJStheme = $theme;
1685                 $this->extJScss = $css;   1685                 $this->extJScss = $css;
1686         }   1686         }
1687     1687  
1688         /**   1688         /**
1689          * Enables ExtJs QuickTips   1689          * Enables ExtJs QuickTips
1690          * Need extJs loaded   1690          * Need extJs loaded
1691          *   1691          *
1692          * @return void   1692          * @return void
1693          */   1693          */
1694         public function enableExtJSQuickTips() {   1694         public function enableExtJSQuickTips() {
1695                 $this->enableExtJSQuickTips = TRUE;   1695                 $this->enableExtJSQuickTips = TRUE;
1696         }   1696         }
1697     1697  
1698         /**   1698         /**
1699          * Call function if you need the ExtCore library   1699          * Call function if you need the ExtCore library
1700          *   1700          *
1701          * @return void   1701          * @return void
1702          */   1702          */
1703         public function loadExtCore() {   1703         public function loadExtCore() {
1704                 $this->addExtCore = TRUE;   1704                 $this->addExtCore = TRUE;
1705         }   1705         }
1706     1706  
1707         /**   1707         /**
1708          * Call function if you need the SVG library   1708          * Call function if you need the SVG library
1709          *   1709          *
1710          * @return void   1710          * @return void
1711          */   1711          */
1712         public function loadSvg() {   1712         public function loadSvg() {
1713                 $this->addSvg = TRUE;   1713                 $this->addSvg = TRUE;
1714         }   1714         }
1715     1715  
1716         /**   1716         /**
1717          * Call this function to load debug version of ExtJS. Use this for development only   1717          * Call this function to load debug version of ExtJS. Use this for development only
1718          *   1718          *
1719          * @return void   1719          * @return void
1720          */   1720          */
1721         public function enableSvgDebug() {   1721         public function enableSvgDebug() {
1722                 $this->enableSvgDebug = TRUE;   1722                 $this->enableSvgDebug = TRUE;
1723         }   1723         }
1724     1724  
1725         /**   1725         /**
1726          * Call this function to force flash usage with SVG library   1726          * Call this function to force flash usage with SVG library
1727          *   1727          *
1728          * @return void   1728          * @return void
1729          */   1729          */
1730         public function svgForceFlash() {   1730         public function svgForceFlash() {
1731                 $this->addMetaTag('<meta name="svg.render.forceflash" content="true" />');   1731                 $this->addMetaTag('<meta name="svg.render.forceflash" content="true" />');
1732         }   1732         }
1733     1733  
1734         /**   1734         /**
1735          * Call this function to load debug version of ExtJS. Use this for development only   1735          * Call this function to load debug version of ExtJS. Use this for development only
1736          *   1736          *
1737          * @return void   1737          * @return void
1738          */   1738          */
1739         public function enableExtJsDebug() {   1739         public function enableExtJsDebug() {
1740                 $this->enableExtJsDebug = TRUE;   1740                 $this->enableExtJsDebug = TRUE;
1741         }   1741         }
1742     1742  
1743         /**   1743         /**
1744          * Call this function to load debug version of ExtCore. Use this for development only   1744          * Call this function to load debug version of ExtCore. Use this for development only
1745          *   1745          *
1746          * @return void   1746          * @return void
1747          */   1747          */
1748         public function enableExtCoreDebug() {   1748         public function enableExtCoreDebug() {
1749                 $this->enableExtCoreDebug = TRUE;   1749                 $this->enableExtCoreDebug = TRUE;
1750         }   1750         }
1751     1751  
1752         /**   1752         /**
1753          * Adds Javascript Inline Label. This will occur in TYPO3.lang - object   1753          * Adds Javascript Inline Label. This will occur in TYPO3.lang - object
1754          * The label can be used in scripts with TYPO3.lang.<key>   1754          * The label can be used in scripts with TYPO3.lang.<key>
1755          * Need extJs loaded   1755          * Need extJs loaded
1756          *   1756          *
1757          * @param string $key   1757          * @param string $key
1758          * @param string $value   1758          * @param string $value
1759          * @return void   1759          * @return void
1760          */   1760          */
1761         public function addInlineLanguageLabel($key, $value) {   1761         public function addInlineLanguageLabel($key, $value) {
1762                 $this->inlineLanguageLabels[$key] = $value;   1762                 $this->inlineLanguageLabels[$key] = $value;
1763         }   1763         }
1764     1764  
1765         /**   1765         /**
1766          * Adds Javascript Inline Label Array. This will occur in TYPO3.lang - object   1766          * Adds Javascript Inline Label Array. This will occur in TYPO3.lang - object
1767          * The label can be used in scripts with TYPO3.lang.<key>   1767          * The label can be used in scripts with TYPO3.lang.<key>
1768          * Array will be merged with existing array.   1768          * Array will be merged with existing array.
1769          * Need extJs loaded   1769          * Need extJs loaded
1770          *   1770          *
1771          * @param array $array   1771          * @param array $array
1772          * @return void   1772          * @return void
1773          */   1773          */
1774         public function addInlineLanguageLabelArray(array $array) {   1774         public function addInlineLanguageLabelArray(array $array) {
1775                 $this->inlineLanguageLabels = array_merge($this->inlineLanguageLabels, $array);   1775                 $this->inlineLanguageLabels = array_merge($this->inlineLanguageLabels, $array);
1776         }   1776         }
1777     1777  
1778         /**   1778         /**
1779          * Gets labels to be used in JavaScript fetched from a locallang file.   1779          * Gets labels to be used in JavaScript fetched from a locallang file.
1780          *   1780          *
1781          * @param string $fileRef Input is a file-reference (see \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName). That file is expected to be a 'locallang.xml' file containing a valid XML TYPO3 language structure.   1781          * @param string $fileRef Input is a file-reference (see \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName). That file is expected to be a 'locallang.xml' file containing a valid XML TYPO3 language structure.
1782          * @param string $selectionPrefix Prefix to select the correct labels (default: '')   1782          * @param string $selectionPrefix Prefix to select the correct labels (default: '')
1783          * @param string $stripFromSelectionName Sub-prefix to be removed from label names in the result (default: '')   1783          * @param string $stripFromSelectionName Sub-prefix to be removed from label names in the result (default: '')
1784          * @param integer $errorMode Error mode (when file could not be found): 0 - syslog entry, 1 - do nothing, 2 - throw an exception   1784          * @param integer $errorMode Error mode (when file could not be found): 0 - syslog entry, 1 - do nothing, 2 - throw an exception
1785          * @return void   1785          * @return void
1786          */   1786          */
1787         public function addInlineLanguageLabelFile($fileRef, $selectionPrefix = '', $stripFromSelectionName = '', $errorMode = 0) {   1787         public function addInlineLanguageLabelFile($fileRef, $selectionPrefix = '', $stripFromSelectionName = '', $errorMode = 0) {
1788                 $index = md5($fileRef . $selectionPrefix . $stripFromSelectionName);   1788                 $index = md5($fileRef . $selectionPrefix . $stripFromSelectionName);
1789                 if ($fileRef && !isset($this->inlineLanguageLabelFiles[$index])) {   1789                 if ($fileRef && !isset($this->inlineLanguageLabelFiles[$index])) {
1790                         $this->inlineLanguageLabelFiles[$index] = array(   1790                         $this->inlineLanguageLabelFiles[$index] = array(
1791                                 'fileRef' => $fileRef,   1791                                 'fileRef' => $fileRef,
1792                                 'selectionPrefix' => $selectionPrefix,   1792                                 'selectionPrefix' => $selectionPrefix,
1793                                 'stripFromSelectionName' => $stripFromSelectionName,   1793                                 'stripFromSelectionName' => $stripFromSelectionName,
1794                                 'errorMode' => $errorMode   1794                                 'errorMode' => $errorMode
1795                         );   1795                         );
1796                 }   1796                 }
1797         }   1797         }
1798     1798  
1799         /**   1799         /**
1800          * Adds Javascript Inline Setting. This will occur in TYPO3.settings - object   1800          * Adds Javascript Inline Setting. This will occur in TYPO3.settings - object
1801          * The label can be used in scripts with TYPO3.setting.<key>   1801          * The label can be used in scripts with TYPO3.setting.<key>
1802          * Need extJs loaded   1802          * Need extJs loaded
1803          *   1803          *
1804          * @param string $namespace   1804          * @param string $namespace
1805          * @param string $key   1805          * @param string $key
1806          * @param string $value   1806          * @param string $value
1807          * @return void   1807          * @return void
1808          */   1808          */
1809         public function addInlineSetting($namespace, $key, $value) {   1809         public function addInlineSetting($namespace, $key, $value) {
1810                 if ($namespace) {   1810                 if ($namespace) {
1811                         if (strpos($namespace, '.')) {   1811                         if (strpos($namespace, '.')) {
1812                                 $parts = explode('.', $namespace);   1812                                 $parts = explode('.', $namespace);
1813                                 $a = &$this->inlineSettings;   1813                                 $a = &$this->inlineSettings;
1814                                 foreach ($parts as $part) {   1814                                 foreach ($parts as $part) {
1815                                         $a = &$a[$part];   1815                                         $a = &$a[$part];
1816                                 }   1816                                 }
1817                                 $a[$key] = $value;   1817                                 $a[$key] = $value;
1818                         } else {   1818                         } else {
1819                                 $this->inlineSettings[$namespace][$key] = $value;   1819                                 $this->inlineSettings[$namespace][$key] = $value;
1820                         }   1820                         }
1821                 } else {   1821                 } else {
1822                         $this->inlineSettings[$key] = $value;   1822                         $this->inlineSettings[$key] = $value;
1823                 }   1823                 }
1824         }   1824         }
1825     1825  
1826         /**   1826         /**
1827          * Adds Javascript Inline Setting. This will occur in TYPO3.settings - object   1827          * Adds Javascript Inline Setting. This will occur in TYPO3.settings - object
1828          * The label can be used in scripts with TYPO3.setting.<key>   1828          * The label can be used in scripts with TYPO3.setting.<key>
1829          * Array will be merged with existing array.   1829          * Array will be merged with existing array.
1830          * Need extJs loaded   1830          * Need extJs loaded
1831          *   1831          *
1832          * @param string $namespace   1832          * @param string $namespace
1833          * @param array $array   1833          * @param array $array
1834          * @return void   1834          * @return void
1835          */   1835          */
1836         public function addInlineSettingArray($namespace, array $array) {   1836         public function addInlineSettingArray($namespace, array $array) {
1837                 if ($namespace) {   1837                 if ($namespace) {
1838                         if (strpos($namespace, '.')) {   1838                         if (strpos($namespace, '.')) {
1839                                 $parts = explode('.', $namespace);   1839                                 $parts = explode('.', $namespace);
1840                                 $a = &$this->inlineSettings;   1840                                 $a = &$this->inlineSettings;
1841                                 foreach ($parts as $part) {   1841                                 foreach ($parts as $part) {
1842                                         $a = &$a[$part];   1842                                         $a = &$a[$part];
1843                                 }   1843                                 }
1844                                 $a = array_merge((array) $a, $array);   1844                                 $a = array_merge((array) $a, $array);
1845                         } else {   1845                         } else {
1846                                 $this->inlineSettings[$namespace] = array_merge((array) $this->inlineSettings[$namespace], $array);   1846                                 $this->inlineSettings[$namespace] = array_merge((array) $this->inlineSettings[$namespace], $array);
1847                         }   1847                         }
1848                 } else {   1848                 } else {
1849                         $this->inlineSettings = array_merge($this->inlineSettings, $array);   1849                         $this->inlineSettings = array_merge($this->inlineSettings, $array);
1850                 }   1850                 }
1851         }   1851         }
1852     1852  
1853         /**   1853         /**
1854          * Adds content to body content   1854          * Adds content to body content
1855          *   1855          *
1856          * @param string $content   1856          * @param string $content
1857          * @return void   1857          * @return void
1858          */   1858          */
1859         public function addBodyContent($content) {   1859         public function addBodyContent($content) {
1860                 $this->bodyContent .= $content;   1860                 $this->bodyContent .= $content;
1861         }   1861         }
1862     1862  
1863         /*****************************************************/   1863         /*****************************************************/
1864         /*                                                   */   1864         /*                                                   */
1865         /*  Render Functions                                 */   1865         /*  Render Functions                                 */
1866         /*                                                   */   1866         /*                                                   */
1867         /*****************************************************/   1867         /*****************************************************/
1868         /**   1868         /**
1869          * Render the section (Header or Footer)   1869          * Render the section (Header or Footer)
1870          *   1870          *
1871          * @param integer $part Section which should be rendered: self::PART_COMPLETE, self::PART_HEADER or self::PART_FOOTER   1871          * @param integer $part Section which should be rendered: self::PART_COMPLETE, self::PART_HEADER or self::PART_FOOTER
1872          * @return string Content of rendered section   1872          * @return string Content of rendered section
1873          */   1873          */
1874         public function render($part = self::PART_COMPLETE) {   1874         public function render($part = self::PART_COMPLETE) {
1875                 $this->prepareRendering();   1875                 $this->prepareRendering();
1876                 list($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs) = $this->renderJavaScriptAndCss();   1876                 list($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs) = $this->renderJavaScriptAndCss();
1877                 $metaTags = implode(LF, $this->metaTags);   1877                 $metaTags = implode(LF, $this->metaTags);
1878                 $markerArray = $this->getPreparedMarkerArray($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs, $metaTags);   1878                 $markerArray = $this->getPreparedMarkerArray($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs, $metaTags);
1879                 $template = $this->getTemplateForPart($part);   1879                 $template = $this->getTemplateForPart($part);
1880                 $this->reset();   1880                 $this->reset();
1881                 return trim(\TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markerArray, '###|###'));   1881                 return trim(\TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markerArray, '###|###'));
1882         }   1882         }
1883     1883  
1884         /**   1884         /**
1885          * Render the page but not the JavaScript and CSS Files   1885          * Render the page but not the JavaScript and CSS Files
1886          *   1886          *
1887          * @param string $substituteHash The hash that is used for the placehoder markers   1887          * @param string $substituteHash The hash that is used for the placehoder markers
1888          * @access private   1888          * @access private
1889          * @return string Content of rendered section   1889          * @return string Content of rendered section
1890          */   1890          */
1891         public function renderPageWithUncachedObjects($substituteHash) {   1891         public function renderPageWithUncachedObjects($substituteHash) {
1892                 $this->prepareRendering();   1892                 $this->prepareRendering();
1893                 $markerArray = $this->getPreparedMarkerArrayForPageWithUncachedObjects($substituteHash);   1893                 $markerArray = $this->getPreparedMarkerArrayForPageWithUncachedObjects($substituteHash);
1894                 $template = $this->getTemplateForPart(self::PART_COMPLETE);   1894                 $template = $this->getTemplateForPart(self::PART_COMPLETE);
1895                 return trim(\TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markerArray, '###|###'));   1895                 return trim(\TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markerArray, '###|###'));
1896         }   1896         }
1897     1897  
1898         /**   1898         /**
1899          * Renders the JavaScript and CSS files that have been added during processing   1899          * Renders the JavaScript and CSS files that have been added during processing
1900          * of uncached content objects (USER_INT, COA_INT)   1900          * of uncached content objects (USER_INT, COA_INT)
1901          *   1901          *
1902          * @param string $cachedPageContent   1902          * @param string $cachedPageContent
1903          * @param string $substituteHash The hash that is used for the placehoder markers   1903          * @param string $substituteHash The hash that is used for the placehoder markers
1904          * @access private   1904          * @access private
1905          * @return string   1905          * @return string
1906          */   1906          */
1907         public function renderJavaScriptAndCssForProcessingOfUncachedContentObjects($cachedPageContent, $substituteHash) {   1907         public function renderJavaScriptAndCssForProcessingOfUncachedContentObjects($cachedPageContent, $substituteHash) {
1908                 $this->prepareRendering();   1908                 $this->prepareRendering();
1909                 list($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs) = $this->renderJavaScriptAndCss();   1909                 list($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs) = $this->renderJavaScriptAndCss();
1910   +-    
1911                 $titleTagContent = $GLOBALS['TSFE']->tmpl->printTitle($GLOBALS['TSFE']->altPageTitle ? $GLOBALS['TSFE']->altPageTitle : $GLOBALS['TSFE']->page['title'], $GLOBALS['TSFE']->config['config']['noPageTitle'], $GLOBALS['TSFE']->config['config']['pageTitleFirst']);      
1912                 if ($GLOBALS['TSFE']->config['config']['titleTagFunction']) {      
1913                         $titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction($GLOBALS['TSFE']->config['config']['titleTagFunction'], array(), $titleTagContent);      
1914                 }      
1915                 if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config['config']['noPageTitle']) !== 2) {      
1916                         $this->setTitle($titleTagContent);      
1917                 }      
1918        
1919                 $markerArray = array( = 1910                 $markerArray = array(
1920                         '<!-- ###TITLE' . $substituteHash . '### -->' => $this->title ? str_replace('|', htmlspecialchars($this->title), $this->titleTag) : '', +-    
1921                         '<!-- ###CSS_INCLUDE' . $substituteHash . '### -->' => $cssFiles, = 1911                         '<!-- ###CSS_INCLUDE' . $substituteHash . '### -->' => $cssFiles,
1922                         '<!-- ###CSS_INLINE' . $substituteHash . '### -->' => $cssInline,   1912                         '<!-- ###CSS_INLINE' . $substituteHash . '### -->' => $cssInline,
1923                         '<!-- ###JS_INLINE' . $substituteHash . '### -->' => $jsInline,   1913                         '<!-- ###JS_INLINE' . $substituteHash . '### -->' => $jsInline,
1924                         '<!-- ###JS_INCLUDE' . $substituteHash . '### -->' => $jsFiles,   1914                         '<!-- ###JS_INCLUDE' . $substituteHash . '### -->' => $jsFiles,
1925                         '<!-- ###JS_LIBS' . $substituteHash . '### -->' => $jsLibs,   1915                         '<!-- ###JS_LIBS' . $substituteHash . '### -->' => $jsLibs,
1926                         '<!-- ###HEADERDATA' . $substituteHash . '### -->' => implode(LF, $this->headerData),   1916                         '<!-- ###HEADERDATA' . $substituteHash . '### -->' => implode(LF, $this->headerData),
1927                         '<!-- ###FOOTERDATA' . $substituteHash . '### -->' => implode(LF, $this->footerData),   1917                         '<!-- ###FOOTERDATA' . $substituteHash . '### -->' => implode(LF, $this->footerData),
1928                         '<!-- ###JS_LIBS_FOOTER' . $substituteHash . '### -->' => $jsFooterLibs,   1918                         '<!-- ###JS_LIBS_FOOTER' . $substituteHash . '### -->' => $jsFooterLibs,
1929                         '<!-- ###JS_INCLUDE_FOOTER' . $substituteHash . '### -->' => $jsFooterFiles,   1919                         '<!-- ###JS_INCLUDE_FOOTER' . $substituteHash . '### -->' => $jsFooterFiles,
1930                         '<!-- ###JS_INLINE_FOOTER' . $substituteHash . '### -->' => $jsFooterInline   1920                         '<!-- ###JS_INLINE_FOOTER' . $substituteHash . '### -->' => $jsFooterInline
1931                 );   1921                 );
1932                 foreach ($markerArray as $placeHolder => $content) {   1922                 foreach ($markerArray as $placeHolder => $content) {
1933                         $cachedPageContent = str_replace($placeHolder, $content, $cachedPageContent);   1923                         $cachedPageContent = str_replace($placeHolder, $content, $cachedPageContent);
1934                 }   1924                 }
1935                 $this->reset();   1925                 $this->reset();
1936                 return $cachedPageContent;   1926                 return $cachedPageContent;
1937         }   1927         }
1938     1928  
1939         /**   1929         /**
1940          * Remove ending slashes from static header block   1930          * Remove ending slashes from static header block
1941          * if the page is beeing rendered as html (not xhtml)   1931          * if the page is beeing rendered as html (not xhtml)
1942          * and define property $this->endingSlash for further use   1932          * and define property $this->endingSlash for further use
1943          *   1933          *
1944          * @return void   1934          * @return void
1945          */   1935          */
1946         protected function prepareRendering() {   1936         protected function prepareRendering() {
1947                 if ($this->getRenderXhtml()) {   1937                 if ($this->getRenderXhtml()) {
1948                         $this->endingSlash = ' /';   1938                         $this->endingSlash = ' /';
1949                 } else {   1939                 } else {
1950                         $this->metaCharsetTag = str_replace(' />', '>', $this->metaCharsetTag);   1940                         $this->metaCharsetTag = str_replace(' />', '>', $this->metaCharsetTag);
1951                         $this->baseUrlTag = str_replace(' />', '>', $this->baseUrlTag);   1941                         $this->baseUrlTag = str_replace(' />', '>', $this->baseUrlTag);
1952                         $this->shortcutTag = str_replace(' />', '>', $this->shortcutTag);   1942                         $this->shortcutTag = str_replace(' />', '>', $this->shortcutTag);
1953                         $this->endingSlash = '';   1943                         $this->endingSlash = '';
1954                 }   1944                 }
1955         }   1945         }
1956     1946  
1957         /**   1947         /**
1958          * Renders all JavaScript and CSS   1948          * Renders all JavaScript and CSS
1959          *   1949          *
1960          * @return array<string>   1950          * @return array<string>
1961          */   1951          */
1962         protected function renderJavaScriptAndCss() {   1952         protected function renderJavaScriptAndCss() {
1963                 $this->executePreRenderHook();   1953                 $this->executePreRenderHook();
1964                 $mainJsLibs = $this->renderMainJavaScriptLibraries();   1954                 $mainJsLibs = $this->renderMainJavaScriptLibraries();
1965                 if ($this->concatenateFiles || $this->concatenateJavascript || $this->concatenateCss) {   1955                 if ($this->concatenateFiles || $this->concatenateJavascript || $this->concatenateCss) {
1966                         // Do the file concatenation   1956                         // Do the file concatenation
1967                         $this->doConcatenate();   1957                         $this->doConcatenate();
1968                 }   1958                 }
1969                 if ($this->compressCss || $this->compressJavascript) {   1959                 if ($this->compressCss || $this->compressJavascript) {
1970                         // Do the file compression   1960                         // Do the file compression
1971                         $this->doCompress();   1961                         $this->doCompress();
1972                 }   1962                 }
1973                 $this->executeRenderPostTransformHook();   1963                 $this->executeRenderPostTransformHook();
1974                 $cssFiles = $this->renderCssFiles();   1964                 $cssFiles = $this->renderCssFiles();
1975                 $cssInline = $this->renderCssInline();   1965                 $cssInline = $this->renderCssInline();
1976                 list($jsLibs, $jsFooterLibs) = $this->renderAdditionalJavaScriptLibraries();   1966                 list($jsLibs, $jsFooterLibs) = $this->renderAdditionalJavaScriptLibraries();
1977                 list($jsFiles, $jsFooterFiles) = $this->renderJavaScriptFiles();   1967                 list($jsFiles, $jsFooterFiles) = $this->renderJavaScriptFiles();
1978                 list($jsInline, $jsFooterInline) = $this->renderInlineJavaScript();   1968                 list($jsInline, $jsFooterInline) = $this->renderInlineJavaScript();
1979                 $jsLibs = $mainJsLibs . $jsLibs;   1969                 $jsLibs = $mainJsLibs . $jsLibs;
1980                 if ($this->moveJsFromHeaderToFooter) {   1970                 if ($this->moveJsFromHeaderToFooter) {
1981                         $jsFooterLibs = $jsLibs . LF . $jsFooterLibs;   1971                         $jsFooterLibs = $jsLibs . LF . $jsFooterLibs;
1982                         $jsLibs = '';   1972                         $jsLibs = '';
1983                         $jsFooterFiles = $jsFiles . LF . $jsFooterFiles;   1973                         $jsFooterFiles = $jsFiles . LF . $jsFooterFiles;
1984                         $jsFiles = '';   1974                         $jsFiles = '';
1985                         $jsFooterInline = $jsInline . LF . $jsFooterInline;   1975                         $jsFooterInline = $jsInline . LF . $jsFooterInline;
1986                         $jsInline = '';   1976                         $jsInline = '';
1987                 }   1977                 }
1988                 $this->executePostRenderHook($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs);   1978                 $this->executePostRenderHook($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs);
1989                 return array($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs);   1979                 return array($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs);
1990         }   1980         }
1991     1981  
1992         /**   1982         /**
1993          * Fills the marker array with the given strings and trims each value   1983          * Fills the marker array with the given strings and trims each value
1994          *   1984          *
1995          * @param $jsLibs string   1985          * @param $jsLibs string
1996          * @param $jsFiles string   1986          * @param $jsFiles string
1997          * @param $jsFooterFiles string   1987          * @param $jsFooterFiles string
1998          * @param $cssFiles string   1988          * @param $cssFiles string
1999          * @param $jsInline string   1989          * @param $jsInline string
2000          * @param $cssInline string   1990          * @param $cssInline string
2001          * @param $jsFooterInline string   1991          * @param $jsFooterInline string
2002          * @param $jsFooterLibs string   1992          * @param $jsFooterLibs string
2003          * @param $metaTags string   1993          * @param $metaTags string
2004          * @return array Marker array   1994          * @return array Marker array
2005          */   1995          */
2006         protected function getPreparedMarkerArray($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs, $metaTags) {   1996         protected function getPreparedMarkerArray($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs, $metaTags) {
2007                 $markerArray = array(   1997                 $markerArray = array(
2008                         'XMLPROLOG_DOCTYPE' => $this->xmlPrologAndDocType,   1998                         'XMLPROLOG_DOCTYPE' => $this->xmlPrologAndDocType,
2009                         'HTMLTAG' => $this->htmlTag,   1999                         'HTMLTAG' => $this->htmlTag,
2010                         'HEADTAG' => $this->headTag,   2000                         'HEADTAG' => $this->headTag,
2011                         'METACHARSET' => $this->charSet ? str_replace('|', htmlspecialchars($this->charSet), $this->metaCharsetTag) : '',   2001                         'METACHARSET' => $this->charSet ? str_replace('|', htmlspecialchars($this->charSet), $this->metaCharsetTag) : '',
2012                         'INLINECOMMENT' => $this->inlineComments ? LF . LF . '<!-- ' . LF . implode(LF, $this->inlineComments) . '-->' . LF . LF : '',   2002                         'INLINECOMMENT' => $this->inlineComments ? LF . LF . '<!-- ' . LF . implode(LF, $this->inlineComments) . '-->' . LF . LF : '',
2013                         'BASEURL' => $this->baseUrl ? str_replace('|', $this->baseUrl, $this->baseUrlTag) : '',   2003                         'BASEURL' => $this->baseUrl ? str_replace('|', $this->baseUrl, $this->baseUrlTag) : '',
2014                         'SHORTCUT' => $this->favIcon ? sprintf($this->shortcutTag, htmlspecialchars($this->favIcon), $this->iconMimeType) : '',   2004                         'SHORTCUT' => $this->favIcon ? sprintf($this->shortcutTag, htmlspecialchars($this->favIcon), $this->iconMimeType) : '',
2015                         'CSS_INCLUDE' => $cssFiles,   2005                         'CSS_INCLUDE' => $cssFiles,
2016                         'CSS_INLINE' => $cssInline,   2006                         'CSS_INLINE' => $cssInline,
2017                         'JS_INLINE' => $jsInline,   2007                         'JS_INLINE' => $jsInline,
2018                         'JS_INCLUDE' => $jsFiles,   2008                         'JS_INCLUDE' => $jsFiles,
2019                         'JS_LIBS' => $jsLibs,   2009                         'JS_LIBS' => $jsLibs,
2020                         'TITLE' => $this->title ? str_replace('|', htmlspecialchars($this->title), $this->titleTag) : '',   2010                         'TITLE' => $this->title ? str_replace('|', htmlspecialchars($this->title), $this->titleTag) : '',
2021                         'META' => $metaTags,   2011                         'META' => $metaTags,
2022                         'HEADERDATA' => $this->headerData ? implode(LF, $this->headerData) : '',   2012                         'HEADERDATA' => $this->headerData ? implode(LF, $this->headerData) : '',
2023                         'FOOTERDATA' => $this->footerData ? implode(LF, $this->footerData) : '',   2013                         'FOOTERDATA' => $this->footerData ? implode(LF, $this->footerData) : '',
2024                         'JS_LIBS_FOOTER' => $jsFooterLibs,   2014                         'JS_LIBS_FOOTER' => $jsFooterLibs,
2025                         'JS_INCLUDE_FOOTER' => $jsFooterFiles,   2015                         'JS_INCLUDE_FOOTER' => $jsFooterFiles,
2026                         'JS_INLINE_FOOTER' => $jsFooterInline,   2016                         'JS_INLINE_FOOTER' => $jsFooterInline,
2027                         'BODY' => $this->bodyContent   2017                         'BODY' => $this->bodyContent
2028                 );   2018                 );
2029                 $markerArray = array_map('trim', $markerArray);   2019                 $markerArray = array_map('trim', $markerArray);
2030                 return $markerArray;   2020                 return $markerArray;
2031         }   2021         }
2032     2022  
2033         /**   2023         /**
2034          * Fills the marker array with the given strings and trims each value   2024          * Fills the marker array with the given strings and trims each value
2035          *   2025          *
2036          * @param string $substituteHash The hash that is used for the placehoder markers   2026          * @param string $substituteHash The hash that is used for the placehoder markers
2037          * @return array Marker array   2027          * @return array Marker array
2038          */   2028          */
2039         protected function getPreparedMarkerArrayForPageWithUncachedObjects($substituteHash) {   2029         protected function getPreparedMarkerArrayForPageWithUncachedObjects($substituteHash) {
2040                 $markerArray = array(   2030                 $markerArray = array(
2041                         'XMLPROLOG_DOCTYPE' => $this->xmlPrologAndDocType,   2031                         'XMLPROLOG_DOCTYPE' => $this->xmlPrologAndDocType,
2042                         'HTMLTAG' => $this->htmlTag,   2032                         'HTMLTAG' => $this->htmlTag,
2043                         'HEADTAG' => $this->headTag,   2033                         'HEADTAG' => $this->headTag,
2044                         'METACHARSET' => $this->charSet ? str_replace('|', htmlspecialchars($this->charSet), $this->metaCharsetTag) : '',   2034                         'METACHARSET' => $this->charSet ? str_replace('|', htmlspecialchars($this->charSet), $this->metaCharsetTag) : '',
2045                         'INLINECOMMENT' => $this->inlineComments ? LF . LF . '<!-- ' . LF . implode(LF, $this->inlineComments) . '-->' . LF . LF : '',   2035                         'INLINECOMMENT' => $this->inlineComments ? LF . LF . '<!-- ' . LF . implode(LF, $this->inlineComments) . '-->' . LF . LF : '',
2046                         'BASEURL' => $this->baseUrl ? str_replace('|', $this->baseUrl, $this->baseUrlTag) : '',   2036                         'BASEURL' => $this->baseUrl ? str_replace('|', $this->baseUrl, $this->baseUrlTag) : '',
2047                         'SHORTCUT' => $this->favIcon ? sprintf($this->shortcutTag, htmlspecialchars($this->favIcon), $this->iconMimeType) : '',   2037                         'SHORTCUT' => $this->favIcon ? sprintf($this->shortcutTag, htmlspecialchars($this->favIcon), $this->iconMimeType) : '',
2048                         'TITLE' => '<!-- ###TITLE' . $substituteHash . '### -->', <> 2038                         'TITLE' => $this->title ? str_replace('|', htmlspecialchars($this->title), $this->titleTag) : '',
2049                         'META' => implode(LF, $this->metaTags), = 2039                         'META' => implode(LF, $this->metaTags),
2050                         'BODY' => $this->bodyContent,   2040                         'BODY' => $this->bodyContent,
2051                         'CSS_INCLUDE' => '<!-- ###CSS_INCLUDE' . $substituteHash . '### -->',   2041                         'CSS_INCLUDE' => '<!-- ###CSS_INCLUDE' . $substituteHash . '### -->',
2052                         'CSS_INLINE' => '<!-- ###CSS_INLINE' . $substituteHash . '### -->',   2042                         'CSS_INLINE' => '<!-- ###CSS_INLINE' . $substituteHash . '### -->',
2053                         'JS_INLINE' => '<!-- ###JS_INLINE' . $substituteHash . '### -->',   2043                         'JS_INLINE' => '<!-- ###JS_INLINE' . $substituteHash . '### -->',
2054                         'JS_INCLUDE' => '<!-- ###JS_INCLUDE' . $substituteHash . '### -->',   2044                         'JS_INCLUDE' => '<!-- ###JS_INCLUDE' . $substituteHash . '### -->',
2055                         'JS_LIBS' => '<!-- ###JS_LIBS' . $substituteHash . '### -->',   2045                         'JS_LIBS' => '<!-- ###JS_LIBS' . $substituteHash . '### -->',
2056                         'HEADERDATA' => '<!-- ###HEADERDATA' . $substituteHash . '### -->',   2046                         'HEADERDATA' => '<!-- ###HEADERDATA' . $substituteHash . '### -->',
2057                         'FOOTERDATA' => '<!-- ###FOOTERDATA' . $substituteHash . '### -->',   2047                         'FOOTERDATA' => '<!-- ###FOOTERDATA' . $substituteHash . '### -->',
2058                         'JS_LIBS_FOOTER' => '<!-- ###JS_LIBS_FOOTER' . $substituteHash . '### -->',   2048                         'JS_LIBS_FOOTER' => '<!-- ###JS_LIBS_FOOTER' . $substituteHash . '### -->',
2059                         'JS_INCLUDE_FOOTER' => '<!-- ###JS_INCLUDE_FOOTER' . $substituteHash . '### -->',   2049                         'JS_INCLUDE_FOOTER' => '<!-- ###JS_INCLUDE_FOOTER' . $substituteHash . '### -->',
2060                         'JS_INLINE_FOOTER' => '<!-- ###JS_INLINE_FOOTER' . $substituteHash . '### -->'   2050                         'JS_INLINE_FOOTER' => '<!-- ###JS_INLINE_FOOTER' . $substituteHash . '### -->'
2061                 );   2051                 );
2062                 $markerArray = array_map('trim', $markerArray);   2052                 $markerArray = array_map('trim', $markerArray);
2063                 return $markerArray;   2053                 return $markerArray;
2064         }   2054         }
2065     2055  
2066         /**   2056         /**
2067          * Reads the template file and returns the requested part as string   2057          * Reads the template file and returns the requested part as string
2068          *   2058          *
2069          * @param integer $part   2059          * @param integer $part
2070          * @return string   2060          * @return string
2071          */   2061          */
2072         protected function getTemplateForPart($part) {   2062         protected function getTemplateForPart($part) {
2073                 $templateFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->templateFile, TRUE);   2063                 $templateFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->templateFile, TRUE);
2074                 $template = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($templateFile);   2064                 $template = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($templateFile);
2075                 if ($this->removeLineBreaksFromTemplate) {   2065                 if ($this->removeLineBreaksFromTemplate) {
2076                         $template = strtr($template, array(LF => '', CR => ''));   2066                         $template = strtr($template, array(LF => '', CR => ''));
2077                 }   2067                 }
2078                 if ($part != self::PART_COMPLETE) {   2068                 if ($part != self::PART_COMPLETE) {
2079                         $templatePart = explode('###BODY###', $template);   2069                         $templatePart = explode('###BODY###', $template);
2080                         $template = $templatePart[$part - 1];   2070                         $template = $templatePart[$part - 1];
2081                 }   2071                 }
2082                 return $template;   2072                 return $template;
2083         }   2073         }
2084     2074  
2085         /**   2075         /**
2086          * Helper function for render the main JavaScript libraries,   2076          * Helper function for render the main JavaScript libraries,
2087          * currently: RequireJS, jQuery, PrototypeJS, Scriptaculous, SVG, ExtJs   2077          * currently: RequireJS, jQuery, PrototypeJS, Scriptaculous, SVG, ExtJs
2088          *   2078          *
2089          * @return string Content with JavaScript libraries   2079          * @return string Content with JavaScript libraries
2090          */   2080          */
2091         protected function renderMainJavaScriptLibraries() {   2081         protected function renderMainJavaScriptLibraries() {
2092                 $out = '';   2082                 $out = '';
2093     2083  
2094                 // Include RequireJS   2084                 // Include RequireJS
2095                 if ($this->addRequireJs) {   2085                 if ($this->addRequireJs) {
2096                                 // load the paths of the requireJS configuration   2086                                 // load the paths of the requireJS configuration
2097                         $out .= \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS('var require = ' . json_encode($this->requireJsConfig)) . LF;   2087                         $out .= \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS('var require = ' . json_encode($this->requireJsConfig)) . LF;
2098                                 // directly after that, include the require.js file   2088                                 // directly after that, include the require.js file
2099                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->requireJsPath . 'require.js')) . '" type="text/javascript"></script>' . LF;   2089                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->requireJsPath . 'require.js')) . '" type="text/javascript"></script>' . LF;
2100                 }   2090                 }
2101     2091  
2102                 if ($this->addSvg) {   2092                 if ($this->addSvg) {
2103                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->svgPath . 'svg.js')) . '" data-path="' . $this->backPath . $this->svgPath . '"' . ($this->enableSvgDebug ? ' data-debug="true"' : '') . '></script>' . LF;   2093                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->svgPath . 'svg.js')) . '" data-path="' . $this->backPath . $this->svgPath . '"' . ($this->enableSvgDebug ? ' data-debug="true"' : '') . '></script>' . LF;
2104                 }   2094                 }
2105                 // Include jQuery Core for each namespace, depending on the version and source   2095                 // Include jQuery Core for each namespace, depending on the version and source
2106                 if (!empty($this->jQueryVersions)) {   2096                 if (!empty($this->jQueryVersions)) {
2107                         foreach ($this->jQueryVersions as $namespace => $jQueryVersion) {   2097                         foreach ($this->jQueryVersions as $namespace => $jQueryVersion) {
2108                                 $out .= $this->renderJqueryScriptTag($jQueryVersion['version'], $jQueryVersion['source'], $namespace);   2098                                 $out .= $this->renderJqueryScriptTag($jQueryVersion['version'], $jQueryVersion['source'], $namespace);
2109                         }   2099                         }
2110                 }   2100                 }
2111                 if ($this->addPrototype) {   2101                 if ($this->addPrototype) {
2112                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->prototypePath . 'prototype.js')) . '" type="text/javascript"></script>' . LF;   2102                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->prototypePath . 'prototype.js')) . '" type="text/javascript"></script>' . LF;
2113                         unset($this->jsFiles[$this->backPath . $this->prototypePath . 'prototype.js']);   2103                         unset($this->jsFiles[$this->backPath . $this->prototypePath . 'prototype.js']);
2114                 }   2104                 }
2115                 if ($this->addScriptaculous) {   2105                 if ($this->addScriptaculous) {
2116                         $mods = array();   2106                         $mods = array();
2117                         foreach ($this->addScriptaculousModules as $key => $value) {   2107                         foreach ($this->addScriptaculousModules as $key => $value) {
2118                                 if ($this->addScriptaculousModules[$key]) {   2108                                 if ($this->addScriptaculousModules[$key]) {
2119                                         $mods[] = $key;   2109                                         $mods[] = $key;
2120                                 }   2110                                 }
2121                         }   2111                         }
2122                         // Resolve dependencies   2112                         // Resolve dependencies
2123                         if (in_array('dragdrop', $mods) || in_array('controls', $mods)) {   2113                         if (in_array('dragdrop', $mods) || in_array('controls', $mods)) {
2124                                 $mods = array_merge(array('effects'), $mods);   2114                                 $mods = array_merge(array('effects'), $mods);
2125                         }   2115                         }
2126                         if (count($mods)) {   2116                         if (count($mods)) {
2127                                 foreach ($mods as $module) {   2117                                 foreach ($mods as $module) {
2128                                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->scriptaculousPath . $module . '.js')) . '" type="text/javascript"></script>' . LF;   2118                                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->scriptaculousPath . $module . '.js')) . '" type="text/javascript"></script>' . LF;
2129                                         unset($this->jsFiles[$this->backPath . $this->scriptaculousPath . $module . '.js']);   2119                                         unset($this->jsFiles[$this->backPath . $this->scriptaculousPath . $module . '.js']);
2130                                 }   2120                                 }
2131                         }   2121                         }
2132                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->scriptaculousPath . 'scriptaculous.js')) . '" type="text/javascript"></script>' . LF;   2122                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->scriptaculousPath . 'scriptaculous.js')) . '" type="text/javascript"></script>' . LF;
2133                         unset($this->jsFiles[$this->backPath . $this->scriptaculousPath . 'scriptaculous.js']);   2123                         unset($this->jsFiles[$this->backPath . $this->scriptaculousPath . 'scriptaculous.js']);
2134                 }   2124                 }
2135                 // Include extCore, but only if ExtJS is not included   2125                 // Include extCore, but only if ExtJS is not included
2136                 if ($this->addExtCore && !$this->addExtJS) {   2126                 if ($this->addExtCore && !$this->addExtJS) {
2137                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->extCorePath . 'ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js')) . '" type="text/javascript"></script>' . LF;   2127                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->extCorePath . 'ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js')) . '" type="text/javascript"></script>' . LF;
2138                         unset($this->jsFiles[$this->backPath . $this->extCorePath . 'ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js']);   2128                         unset($this->jsFiles[$this->backPath . $this->extCorePath . 'ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js']);
2139                 }   2129                 }
2140                 // Include extJS   2130                 // Include extJS
2141                 if ($this->addExtJS) {   2131                 if ($this->addExtJS) {
2142                         // Use the base adapter all the time   2132                         // Use the base adapter all the time
2143                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->extJsPath . 'adapter/' . ($this->enableExtJsDebug ? str_replace('.js', '-debug.js', $this->extJSadapter) : $this->extJSadapter))) . '" type="text/javascript"></script>' . LF;   2133                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->extJsPath . 'adapter/' . ($this->enableExtJsDebug ? str_replace('.js', '-debug.js', $this->extJSadapter) : $this->extJSadapter))) . '" type="text/javascript"></script>' . LF;
2144                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->extJsPath . 'ext-all' . ($this->enableExtJsDebug ? '-debug' : '') . '.js')) . '" type="text/javascript"></script>' . LF;   2134                         $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->extJsPath . 'ext-all' . ($this->enableExtJsDebug ? '-debug' : '') . '.js')) . '" type="text/javascript"></script>' . LF;
2145                         // Add extJS localization   2135                         // Add extJS localization
2146                         // Load standard ISO mapping and modify for use with ExtJS   2136                         // Load standard ISO mapping and modify for use with ExtJS
2147                         $localeMap = $this->locales->getIsoMapping();   2137                         $localeMap = $this->locales->getIsoMapping();
2148                         $localeMap[''] = 'en';   2138                         $localeMap[''] = 'en';
2149                         $localeMap['default'] = 'en';   2139                         $localeMap['default'] = 'en';
2150                         // Greek   2140                         // Greek
2151                         $localeMap['gr'] = 'el_GR';   2141                         $localeMap['gr'] = 'el_GR';
2152                         // Norwegian Bokmaal   2142                         // Norwegian Bokmaal
2153                         $localeMap['no'] = 'no_BO';   2143                         $localeMap['no'] = 'no_BO';
2154                         // Swedish   2144                         // Swedish
2155                         $localeMap['se'] = 'se_SV';   2145                         $localeMap['se'] = 'se_SV';
2156                         $extJsLang = isset($localeMap[$this->lang]) ? $localeMap[$this->lang] : $this->lang;   2146                         $extJsLang = isset($localeMap[$this->lang]) ? $localeMap[$this->lang] : $this->lang;
2157                         // TODO autoconvert file from UTF8 to current BE charset if necessary!!!!   2147                         // TODO autoconvert file from UTF8 to current BE charset if necessary!!!!
2158                         $extJsLocaleFile = $this->extJsPath . 'locale/ext-lang-' . $extJsLang . '.js';   2148                         $extJsLocaleFile = $this->extJsPath . 'locale/ext-lang-' . $extJsLang . '.js';
2159                         if (file_exists(PATH_typo3 . $extJsLocaleFile)) {   2149                         if (file_exists(PATH_typo3 . $extJsLocaleFile)) {
2160                                 $out .= '<script src="' . $this->processJsFile(($this->backPath . $extJsLocaleFile)) . '" type="text/javascript" charset="utf-8"></script>' . LF;   2150                                 $out .= '<script src="' . $this->processJsFile(($this->backPath . $extJsLocaleFile)) . '" type="text/javascript" charset="utf-8"></script>' . LF;
2161                         }   2151                         }
2162                         // Remove extjs from JScodeLibArray   2152                         // Remove extjs from JScodeLibArray
2163                         unset($this->jsFiles[$this->backPath . $this->extJsPath . 'ext-all.js'], $this->jsFiles[$this->backPath . $this->extJsPath . 'ext-all-debug.js']);   2153                         unset($this->jsFiles[$this->backPath . $this->extJsPath . 'ext-all.js'], $this->jsFiles[$this->backPath . $this->extJsPath . 'ext-all-debug.js']);
2164                 }   2154                 }
2165                 if (count($this->inlineLanguageLabelFiles)) {   2155                 if (count($this->inlineLanguageLabelFiles)) {
2166                         foreach ($this->inlineLanguageLabelFiles as $languageLabelFile) {   2156                         foreach ($this->inlineLanguageLabelFiles as $languageLabelFile) {
2167                                 $this->includeLanguageFileForInline($languageLabelFile['fileRef'], $languageLabelFile['selectionPrefix'], $languageLabelFile['stripFromSelectionName'], $languageLabelFile['$errorMode']);   2157                                 $this->includeLanguageFileForInline($languageLabelFile['fileRef'], $languageLabelFile['selectionPrefix'], $languageLabelFile['stripFromSelectionName'], $languageLabelFile['$errorMode']);
2168                         }   2158                         }
2169                 }   2159                 }
2170                 unset($this->inlineLanguageLabelFiles);   2160                 unset($this->inlineLanguageLabelFiles);
2171                 // Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:   2161                 // Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
2172                 if ($this->getCharSet() !== 'utf-8') {   2162                 if ($this->getCharSet() !== 'utf-8') {
2173                         if ($this->inlineLanguageLabels) {   2163                         if ($this->inlineLanguageLabels) {
2174                                 $this->csConvObj->convArray($this->inlineLanguageLabels, $this->getCharSet(), 'utf-8');   2164                                 $this->csConvObj->convArray($this->inlineLanguageLabels, $this->getCharSet(), 'utf-8');
2175                         }   2165                         }
2176                         if ($this->inlineSettings) {   2166                         if ($this->inlineSettings) {
2177                                 $this->csConvObj->convArray($this->inlineSettings, $this->getCharSet(), 'utf-8');   2167                                 $this->csConvObj->convArray($this->inlineSettings, $this->getCharSet(), 'utf-8');
2178                         }   2168                         }
2179                 }   2169                 }
2180                 $inlineSettings = $this->inlineLanguageLabels ? 'TYPO3.lang = ' . json_encode($this->inlineLanguageLabels) . ';' : '';   2170                 $inlineSettings = $this->inlineLanguageLabels ? 'TYPO3.lang = ' . json_encode($this->inlineLanguageLabels) . ';' : '';
2181                 $inlineSettings .= $this->inlineSettings ? 'TYPO3.settings = ' . json_encode($this->inlineSettings) . ';' : '';   2171                 $inlineSettings .= $this->inlineSettings ? 'TYPO3.settings = ' . json_encode($this->inlineSettings) . ';' : '';
2182                 if ($this->addExtCore || $this->addExtJS) {   2172                 if ($this->addExtCore || $this->addExtJS) {
2183                         // Set clear.gif, move it on top, add handler code   2173                         // Set clear.gif, move it on top, add handler code
2184                         $code = '';   2174                         $code = '';
2185                         if (count($this->extOnReadyCode)) {   2175                         if (count($this->extOnReadyCode)) {
2186                                 foreach ($this->extOnReadyCode as $block) {   2176                                 foreach ($this->extOnReadyCode as $block) {
2187                                         $code .= $block;   2177                                         $code .= $block;
2188                                 }   2178                                 }
2189                         }   2179                         }
2190                         $out .= $this->inlineJavascriptWrap[0] . '   2180                         $out .= $this->inlineJavascriptWrap[0] . '
2191                                 Ext.ns("TYPO3");   2181                                 Ext.ns("TYPO3");
2192                                 Ext.BLANK_IMAGE_URL = "' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(($this->backPath . 'gfx/clear.gif'))) . '";' . LF . $inlineSettings . 'Ext.onReady(function() {' . ($this->enableExtJSQuickTips ? 'Ext.QuickTips.init();' . LF : '') . $code . ' });' . $this->inlineJavascriptWrap[1];   2182                                 Ext.BLANK_IMAGE_URL = "' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(($this->backPath . 'gfx/clear.gif'))) . '";' . LF . $inlineSettings . 'Ext.onReady(function() {' . ($this->enableExtJSQuickTips ? 'Ext.QuickTips.init();' . LF : '') . $code . ' });' . $this->inlineJavascriptWrap[1];
2193                         unset($this->extOnReadyCode);   2183                         unset($this->extOnReadyCode);
2194                         // Include TYPO3.l10n object   2184                         // Include TYPO3.l10n object
2195                         if (TYPO3_MODE === 'BE') {   2185                         if (TYPO3_MODE === 'BE') {
2196                                 $out .= '<script src="' . $this->processJsFile(($this->backPath . 'sysext/lang/res/js/be/typo3lang.js')) . '" type="text/javascript" charset="utf-8"></script>' . LF;   2186                                 $out .= '<script src="' . $this->processJsFile(($this->backPath . 'sysext/lang/res/js/be/typo3lang.js')) . '" type="text/javascript" charset="utf-8"></script>' . LF;
2197                         }   2187                         }
2198                         if ($this->extJStheme) {   2188                         if ($this->extJStheme) {
2199                                 if (isset($GLOBALS['TBE_STYLES']['extJS']['theme'])) {   2189                                 if (isset($GLOBALS['TBE_STYLES']['extJS']['theme'])) {
2200                                         $this->addCssFile($this->backPath . $GLOBALS['TBE_STYLES']['extJS']['theme'], 'stylesheet', 'all', '', TRUE, TRUE);   2190                                         $this->addCssFile($this->backPath . $GLOBALS['TBE_STYLES']['extJS']['theme'], 'stylesheet', 'all', '', TRUE, TRUE);
2201                                 } else {   2191                                 } else {
2202                                         $this->addCssFile($this->backPath . $this->extJsPath . 'resources/css/xtheme-blue.css', 'stylesheet', 'all', '', TRUE, TRUE);   2192                                         $this->addCssFile($this->backPath . $this->extJsPath . 'resources/css/xtheme-blue.css', 'stylesheet', 'all', '', TRUE, TRUE);
2203                                 }   2193                                 }
2204                         }   2194                         }
2205                         if ($this->extJScss) {   2195                         if ($this->extJScss) {
2206                                 if (isset($GLOBALS['TBE_STYLES']['extJS']['all'])) {   2196                                 if (isset($GLOBALS['TBE_STYLES']['extJS']['all'])) {
2207                                         $this->addCssFile($this->backPath . $GLOBALS['TBE_STYLES']['extJS']['all'], 'stylesheet', 'all', '', TRUE, TRUE);   2197                                         $this->addCssFile($this->backPath . $GLOBALS['TBE_STYLES']['extJS']['all'], 'stylesheet', 'all', '', TRUE, TRUE);
2208                                 } else {   2198                                 } else {
2209                                         $this->addCssFile($this->backPath . $this->extJsPath . 'resources/css/ext-all-notheme.css', 'stylesheet', 'all', '', TRUE, TRUE);   2199                                         $this->addCssFile($this->backPath . $this->extJsPath . 'resources/css/ext-all-notheme.css', 'stylesheet', 'all', '', TRUE, TRUE);
2210                                 }   2200                                 }
2211                         }   2201                         }
2212                 } else {   2202                 } else {
2213                         // no extJS loaded, but still inline settings   2203                         // no extJS loaded, but still inline settings
2214                         if ($inlineSettings !== '') {   2204                         if ($inlineSettings !== '') {
2215                                 // make sure the global TYPO3 is available   2205                                 // make sure the global TYPO3 is available
2216                                 $inlineSettings = 'var TYPO3 = TYPO3 || {};' . CRLF . $inlineSettings;   2206                                 $inlineSettings = 'var TYPO3 = TYPO3 || {};' . CRLF . $inlineSettings;
2217                                 $out .= $this->inlineJavascriptWrap[0] . $inlineSettings . $this->inlineJavascriptWrap[1];   2207                                 $out .= $this->inlineJavascriptWrap[0] . $inlineSettings . $this->inlineJavascriptWrap[1];
2218                         }   2208                         }
2219                 }   2209                 }
2220                 return $out;   2210                 return $out;
2221         }   2211         }
2222     2212  
2223         /**   2213         /**
2224          * Renders the HTML script tag for the given jQuery version.   2214          * Renders the HTML script tag for the given jQuery version.
2225          *   2215          *
2226          * @param string $version The jQuery version that should be included, either "latest" or any available version   2216          * @param string $version The jQuery version that should be included, either "latest" or any available version
2227          * @param string $source The location of the jQuery source, can be "local", "google", "msn" or "jquery   2217          * @param string $source The location of the jQuery source, can be "local", "google", "msn" or "jquery
2228          * @param string $namespace The namespace in which the jQuery object of the specific version should be stored   2218          * @param string $namespace The namespace in which the jQuery object of the specific version should be stored
2229          * @return string   2219          * @return string
2230          */   2220          */
2231         protected function renderJqueryScriptTag($version, $source, $namespace) {   2221         protected function renderJqueryScriptTag($version, $source, $namespace) {
2232                 switch (TRUE) {   2222                 switch (TRUE) {
2233                 case isset($this->jQueryCdnUrls[$source]):   2223                 case isset($this->jQueryCdnUrls[$source]):
2234                         if ($this->enableJqueryDebug) {   2224                         if ($this->enableJqueryDebug) {
2235                                 $minifyPart = '';   2225                                 $minifyPart = '';
2236                         } else {   2226                         } else {
2237                                 $minifyPart = '.min';   2227                                 $minifyPart = '.min';
2238                         }   2228                         }
2239                         $jQueryFileName = sprintf($this->jQueryCdnUrls[$source], $version, $minifyPart);   2229                         $jQueryFileName = sprintf($this->jQueryCdnUrls[$source], $version, $minifyPart);
2240                         break;   2230                         break;
2241                 case $source === 'local':   2231                 case $source === 'local':
2242                         $jQueryFileName = $this->backPath . $this->jQueryPath . 'jquery-' . rawurlencode($version);   2232                         $jQueryFileName = $this->backPath . $this->jQueryPath . 'jquery-' . rawurlencode($version);
2243                         if ($this->enableJqueryDebug) {   2233                         if ($this->enableJqueryDebug) {
2244                                 $jQueryFileName .= '.js';   2234                                 $jQueryFileName .= '.js';
2245                         } else {   2235                         } else {
2246                                 $jQueryFileName .= '.min.js';   2236                                 $jQueryFileName .= '.min.js';
2247                         }   2237                         }
2248                         break;   2238                         break;
2249                 default:   2239                 default:
2250                         $jQueryFileName = $source;   2240                         $jQueryFileName = $source;
2251                 }   2241                 }
2252                 // Include the jQuery Core   2242                 // Include the jQuery Core
2253                 $scriptTag = '<script src="' . htmlspecialchars($jQueryFileName) . '" type="text/javascript"></script>' . LF;   2243                 $scriptTag = '<script src="' . htmlspecialchars($jQueryFileName) . '" type="text/javascript"></script>' . LF;
2254                 // Set the noConflict mode to be available via "TYPO3.jQuery" in all installations   2244                 // Set the noConflict mode to be available via "TYPO3.jQuery" in all installations
2255                 switch ($namespace) {   2245                 switch ($namespace) {
2256                 case self::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT:   2246                 case self::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT:
2257                         $scriptTag .= \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS('jQuery.noConflict();') . LF;   2247                         $scriptTag .= \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS('jQuery.noConflict();') . LF;
2258                         break;   2248                         break;
2259                 case self::JQUERY_NAMESPACE_NONE:   2249                 case self::JQUERY_NAMESPACE_NONE:
2260                         break;   2250                         break;
2261                 case self::JQUERY_NAMESPACE_DEFAULT:   2251                 case self::JQUERY_NAMESPACE_DEFAULT:
2262     2252  
2263                 default:   2253                 default:
2264                         $scriptTag .= \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS('var TYPO3 = TYPO3 || {}; TYPO3.' . $namespace . ' = jQuery.noConflict(true);') . LF;   2254                         $scriptTag .= \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS('var TYPO3 = TYPO3 || {}; TYPO3.' . $namespace . ' = jQuery.noConflict(true);') . LF;
2265                         break;   2255                         break;
2266                 }   2256                 }
2267                 return $scriptTag;   2257                 return $scriptTag;
2268         }   2258         }
2269     2259  
2270         /**   2260         /**
2271          * Render CSS files   2261          * Render CSS files
2272          *   2262          *
2273          * @return string   2263          * @return string
2274          */   2264          */
2275         protected function renderCssFiles() {   2265         protected function renderCssFiles() {
2276                 $cssFiles = '';   2266                 $cssFiles = '';
2277                 if (count($this->cssFiles)) {   2267                 if (count($this->cssFiles)) {
2278                         foreach ($this->cssFiles as $file => $properties) {   2268                         foreach ($this->cssFiles as $file => $properties) {
2279                                 $file = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($file);   2269                                 $file = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($file);
2280                                 $file = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($file);   2270                                 $file = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($file);
2281                                 $tag = '<link rel="' . htmlspecialchars($properties['rel']) . '" type="text/css" href="' . htmlspecialchars($file) . '" media="' . htmlspecialchars($properties['media']) . '"' . ($properties['title'] ? ' title="' . htmlspecialchars($properties['title']) . '"' : '') . $this->endingSlash . '>';   2271                                 $tag = '<link rel="' . htmlspecialchars($properties['rel']) . '" type="text/css" href="' . htmlspecialchars($file) . '" media="' . htmlspecialchars($properties['media']) . '"' . ($properties['title'] ? ' title="' . htmlspecialchars($properties['title']) . '"' : '') . $this->endingSlash . '>';
2282                                 if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {   2272                                 if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
2283                                         $tag = str_replace('|', $tag, $properties['allWrap']);   2273                                         $tag = str_replace('|', $tag, $properties['allWrap']);
2284                                 }   2274                                 }
2285                                 if ($properties['forceOnTop']) {   2275                                 if ($properties['forceOnTop']) {
2286                                         $cssFiles = $tag . LF . $cssFiles;   2276                                         $cssFiles = $tag . LF . $cssFiles;
2287                                 } else {   2277                                 } else {
2288                                         $cssFiles .= LF . $tag;   2278                                         $cssFiles .= LF . $tag;
2289                                 }   2279                                 }
2290                         }   2280                         }
2291                 }   2281                 }
2292                 return $cssFiles;   2282                 return $cssFiles;
2293         }   2283         }
2294     2284  
2295         /**   2285         /**
2296          * Render inline CSS   2286          * Render inline CSS
2297          *   2287          *
2298          * @return string   2288          * @return string
2299          */   2289          */
2300         protected function renderCssInline() {   2290         protected function renderCssInline() {
2301                 $cssInline = '';   2291                 $cssInline = '';
2302                 if (count($this->cssInline)) {   2292                 if (count($this->cssInline)) {
2303                         foreach ($this->cssInline as $name => $properties) {   2293                         foreach ($this->cssInline as $name => $properties) {
2304                                 if ($properties['forceOnTop']) {   2294                                 if ($properties['forceOnTop']) {
2305                                         $cssInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $cssInline;   2295                                         $cssInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $cssInline;
2306                                 } else {   2296                                 } else {
2307                                         $cssInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;   2297                                         $cssInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
2308                                 }   2298                                 }
2309                         }   2299                         }
2310                         $cssInline = $this->inlineCssWrap[0] . $cssInline . $this->inlineCssWrap[1];   2300                         $cssInline = $this->inlineCssWrap[0] . $cssInline . $this->inlineCssWrap[1];
2311                 }   2301                 }
2312                 return $cssInline;   2302                 return $cssInline;
2313         }   2303         }
2314     2304  
2315         /**   2305         /**
2316          * Render JavaScipt libraries   2306          * Render JavaScipt libraries
2317          *   2307          *
2318          * @return array<string> jsLibs and jsFooterLibs strings   2308          * @return array<string> jsLibs and jsFooterLibs strings
2319          */   2309          */
2320         protected function renderAdditionalJavaScriptLibraries() {   2310         protected function renderAdditionalJavaScriptLibraries() {
2321                 $jsLibs = '';   2311                 $jsLibs = '';
2322                 $jsFooterLibs = '';   2312                 $jsFooterLibs = '';
2323                 if (count($this->jsLibs)) {   2313                 if (count($this->jsLibs)) {
2324                         foreach ($this->jsLibs as $properties) {   2314                         foreach ($this->jsLibs as $properties) {
2325                                 $properties['file'] = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($properties['file']);   2315                                 $properties['file'] = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($properties['file']);
2326                                 $properties['file'] = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($properties['file']);   2316                                 $properties['file'] = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($properties['file']);
2327                                 $tag = '<script src="' . htmlspecialchars($properties['file']) . '" type="' . htmlspecialchars($properties['type']) . '"></script>';   2317                                 $tag = '<script src="' . htmlspecialchars($properties['file']) . '" type="' . htmlspecialchars($properties['type']) . '"></script>';
2328                                 if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {   2318                                 if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
2329                                         $tag = str_replace('|', $tag, $properties['allWrap']);   2319                                         $tag = str_replace('|', $tag, $properties['allWrap']);
2330                                 }   2320                                 }
2331                                 if ($properties['forceOnTop']) {   2321                                 if ($properties['forceOnTop']) {
2332                                         if ($properties['section'] === self::PART_HEADER) {   2322                                         if ($properties['section'] === self::PART_HEADER) {
2333                                                 $jsLibs = $tag . LF . $jsLibs;   2323                                                 $jsLibs = $tag . LF . $jsLibs;
2334                                         } else {   2324                                         } else {
2335                                                 $jsFooterLibs = $tag . LF . $jsFooterLibs;   2325                                                 $jsFooterLibs = $tag . LF . $jsFooterLibs;
2336                                         }   2326                                         }
2337                                 } else {   2327                                 } else {
2338                                         if ($properties['section'] === self::PART_HEADER) {   2328                                         if ($properties['section'] === self::PART_HEADER) {
2339                                                 $jsLibs .= LF . $tag;   2329                                                 $jsLibs .= LF . $tag;
2340                                         } else {   2330                                         } else {
2341                                                 $jsFooterLibs .= LF . $tag;   2331                                                 $jsFooterLibs .= LF . $tag;
2342                                         }   2332                                         }
2343                                 }   2333                                 }
2344                         }   2334                         }
2345                 }   2335                 }
2346                 if ($this->moveJsFromHeaderToFooter) {   2336                 if ($this->moveJsFromHeaderToFooter) {
2347                         $jsFooterLibs = $jsLibs . LF . $jsFooterLibs;   2337                         $jsFooterLibs = $jsLibs . LF . $jsFooterLibs;
2348                         $jsLibs = '';   2338                         $jsLibs = '';
2349                 }   2339                 }
2350                 return array($jsLibs, $jsFooterLibs);   2340                 return array($jsLibs, $jsFooterLibs);
2351         }   2341         }
2352     2342  
2353         /**   2343         /**
2354          * Render JavaScript files   2344          * Render JavaScript files
2355          *   2345          *
2356          * @return array<string> jsFiles and jsFooterFiles strings   2346          * @return array<string> jsFiles and jsFooterFiles strings
2357          */   2347          */
2358         protected function renderJavaScriptFiles() {   2348         protected function renderJavaScriptFiles() {
2359                 $jsFiles = '';   2349                 $jsFiles = '';
2360                 $jsFooterFiles = '';   2350                 $jsFooterFiles = '';
2361                 if (count($this->jsFiles)) {   2351                 if (count($this->jsFiles)) {
2362                         foreach ($this->jsFiles as $file => $properties) {   2352                         foreach ($this->jsFiles as $file => $properties) {
2363                                 $file = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($file);   2353                                 $file = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($file);
2364                                 $file = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($file);   2354                                 $file = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($file);
2365                                 $tag = '<script src="' . htmlspecialchars($file) . '" type="' . htmlspecialchars($properties['type']) . '"></script>';   2355                                 $tag = '<script src="' . htmlspecialchars($file) . '" type="' . htmlspecialchars($properties['type']) . '"></script>';
2366                                 if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {   2356                                 if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
2367                                         $tag = str_replace('|', $tag, $properties['allWrap']);   2357                                         $tag = str_replace('|', $tag, $properties['allWrap']);
2368                                 }   2358                                 }
2369                                 if ($properties['forceOnTop']) {   2359                                 if ($properties['forceOnTop']) {
2370                                         if ($properties['section'] === self::PART_HEADER) {   2360                                         if ($properties['section'] === self::PART_HEADER) {
2371                                                 $jsFiles = $tag . LF . $jsFiles;   2361                                                 $jsFiles = $tag . LF . $jsFiles;
2372                                         } else {   2362                                         } else {
2373                                                 $jsFooterFiles = $tag . LF . $jsFooterFiles;   2363                                                 $jsFooterFiles = $tag . LF . $jsFooterFiles;
2374                                         }   2364                                         }
2375                                 } else {   2365                                 } else {
2376                                         if ($properties['section'] === self::PART_HEADER) {   2366                                         if ($properties['section'] === self::PART_HEADER) {
2377                                                 $jsFiles .= LF . $tag;   2367                                                 $jsFiles .= LF . $tag;
2378                                         } else {   2368                                         } else {
2379                                                 $jsFooterFiles .= LF . $tag;   2369                                                 $jsFooterFiles .= LF . $tag;
2380                                         }   2370                                         }
2381                                 }   2371                                 }
2382                         }   2372                         }
2383                 }   2373                 }
2384                 if ($this->moveJsFromHeaderToFooter) {   2374                 if ($this->moveJsFromHeaderToFooter) {
2385                         $jsFooterFiles = $jsFiles . LF . $jsFooterFiles;   2375                         $jsFooterFiles = $jsFiles . LF . $jsFooterFiles;
2386                         $jsFiles = '';   2376                         $jsFiles = '';
2387                 }   2377                 }
2388                 return array($jsFiles, $jsFooterFiles);   2378                 return array($jsFiles, $jsFooterFiles);
2389         }   2379         }
2390     2380  
2391         /**   2381         /**
2392          * Render inline JavaScript   2382          * Render inline JavaScript
2393          *   2383          *
2394          * @return array<string> jsInline and jsFooterInline string   2384          * @return array<string> jsInline and jsFooterInline string
2395          */   2385          */
2396         protected function renderInlineJavaScript() {   2386         protected function renderInlineJavaScript() {
2397                 $jsInline = '';   2387                 $jsInline = '';
2398                 $jsFooterInline = '';   2388                 $jsFooterInline = '';
2399                 if (count($this->jsInline)) {   2389                 if (count($this->jsInline)) {
2400                         foreach ($this->jsInline as $name => $properties) {   2390                         foreach ($this->jsInline as $name => $properties) {
2401                                 if ($properties['forceOnTop']) {   2391                                 if ($properties['forceOnTop']) {
2402                                         if ($properties['section'] === self::PART_HEADER) {   2392                                         if ($properties['section'] === self::PART_HEADER) {
2403                                                 $jsInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsInline;   2393                                                 $jsInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsInline;
2404                                         } else {   2394                                         } else {
2405                                                 $jsFooterInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsFooterInline;   2395                                                 $jsFooterInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsFooterInline;
2406                                         }   2396                                         }
2407                                 } else {   2397                                 } else {
2408                                         if ($properties['section'] === self::PART_HEADER) {   2398                                         if ($properties['section'] === self::PART_HEADER) {
2409                                                 $jsInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;   2399                                                 $jsInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
2410                                         } else {   2400                                         } else {
2411                                                 $jsFooterInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;   2401                                                 $jsFooterInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
2412                                         }   2402                                         }
2413                                 }   2403                                 }
2414                         }   2404                         }
2415                 }   2405                 }
2416                 if ($jsInline) {   2406                 if ($jsInline) {
2417                         $jsInline = $this->inlineJavascriptWrap[0] . $jsInline . $this->inlineJavascriptWrap[1];   2407                         $jsInline = $this->inlineJavascriptWrap[0] . $jsInline . $this->inlineJavascriptWrap[1];
2418                 }   2408                 }
2419                 if ($jsFooterInline) {   2409                 if ($jsFooterInline) {
2420                         $jsFooterInline = $this->inlineJavascriptWrap[0] . $jsFooterInline . $this->inlineJavascriptWrap[1];   2410                         $jsFooterInline = $this->inlineJavascriptWrap[0] . $jsFooterInline . $this->inlineJavascriptWrap[1];
2421                 }   2411                 }
2422                 if ($this->moveJsFromHeaderToFooter) {   2412                 if ($this->moveJsFromHeaderToFooter) {
2423                         $jsFooterInline = $jsInline . LF . $jsFooterInline;   2413                         $jsFooterInline = $jsInline . LF . $jsFooterInline;
2424                         $jsInline = '';   2414                         $jsInline = '';
2425                 }   2415                 }
2426                 return array($jsInline, $jsFooterInline);   2416                 return array($jsInline, $jsFooterInline);
2427         }   2417         }
2428     2418  
2429         /**   2419         /**
2430          * Include language file for inline usage   2420          * Include language file for inline usage
2431          *   2421          *
2432          * @param string $fileRef   2422          * @param string $fileRef
2433          * @param string $selectionPrefix   2423          * @param string $selectionPrefix
2434          * @param string $stripFromSelectionName   2424          * @param string $stripFromSelectionName
2435          * @param integer $errorMode   2425          * @param integer $errorMode
2436          * @return void   2426          * @return void
2437          * @throws \RuntimeException   2427          * @throws \RuntimeException
2438          */   2428          */
2439         protected function includeLanguageFileForInline($fileRef, $selectionPrefix = '', $stripFromSelectionName = '', $errorMode = 0) {   2429         protected function includeLanguageFileForInline($fileRef, $selectionPrefix = '', $stripFromSelectionName = '', $errorMode = 0) {
2440                 if (!isset($this->lang) || !isset($this->charSet)) {   2430                 if (!isset($this->lang) || !isset($this->charSet)) {
2441                         throw new \RuntimeException('Language and character encoding are not set.', 1284906026);   2431                         throw new \RuntimeException('Language and character encoding are not set.', 1284906026);
2442                 }   2432                 }
2443                 $labelsFromFile = array();   2433                 $labelsFromFile = array();
2444                 $allLabels = $this->readLLfile($fileRef, $errorMode);   2434                 $allLabels = $this->readLLfile($fileRef, $errorMode);
2445                 // Regular expression to strip the selection prefix and possibly something from the label name:   2435                 // Regular expression to strip the selection prefix and possibly something from the label name:
2446                 $labelPattern = '#^' . preg_quote($selectionPrefix, '#') . '(' . preg_quote($stripFromSelectionName, '#') . ')?#';   2436                 $labelPattern = '#^' . preg_quote($selectionPrefix, '#') . '(' . preg_quote($stripFromSelectionName, '#') . ')?#';
2447                 if ($allLabels !== FALSE) {   2437                 if ($allLabels !== FALSE) {
2448                         // Merge language specific translations:   2438                         // Merge language specific translations:
2449                         if ($this->lang !== 'default' && isset($allLabels[$this->lang])) {   2439                         if ($this->lang !== 'default' && isset($allLabels[$this->lang])) {
2450                                 $labels = array_merge($allLabels['default'], $allLabels[$this->lang]);   2440                                 $labels = array_merge($allLabels['default'], $allLabels[$this->lang]);
2451                         } else {   2441                         } else {
2452                                 $labels = $allLabels['default'];   2442                                 $labels = $allLabels['default'];
2453                         }   2443                         }
2454                         // Iterate through all locallang labels:   2444                         // Iterate through all locallang labels:
2455                         foreach ($labels as $label => $value) {   2445                         foreach ($labels as $label => $value) {
2456                                 if ($selectionPrefix === '') {   2446                                 if ($selectionPrefix === '') {
2457                                         $labelsFromFile[$label] = $value;   2447                                         $labelsFromFile[$label] = $value;
2458                                 } elseif (strpos($label, $selectionPrefix) === 0) {   2448                                 } elseif (strpos($label, $selectionPrefix) === 0) {
2459                                         $key = preg_replace($labelPattern, '', $label);   2449                                         $key = preg_replace($labelPattern, '', $label);
2460                                         $labelsFromFile[$label] = $value;   2450                                         $labelsFromFile[$label] = $value;
2461                                 }   2451                                 }
2462                         }   2452                         }
2463                         $this->inlineLanguageLabels = array_merge($this->inlineLanguageLabels, $labelsFromFile);   2453                         $this->inlineLanguageLabels = array_merge($this->inlineLanguageLabels, $labelsFromFile);
2464                 }   2454                 }
2465         }   2455         }
2466     2456  
2467         /**   2457         /**
2468          * Reads a locallang file.   2458          * Reads a locallang file.
2469          *   2459          *
2470          * @param string $fileRef Reference to a relative filename to include.   2460          * @param string $fileRef Reference to a relative filename to include.
2471          * @param integer $errorMode Error mode (when file could not be found): 0 - syslog entry, 1 - do nothing, 2 - throw an exception   2461          * @param integer $errorMode Error mode (when file could not be found): 0 - syslog entry, 1 - do nothing, 2 - throw an exception
2472          * @return array Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array.   2462          * @return array Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array.
2473          */   2463          */
2474         protected function readLLfile($fileRef, $errorMode = 0) {   2464         protected function readLLfile($fileRef, $errorMode = 0) {
2475                 if ($this->lang !== 'default') {   2465                 if ($this->lang !== 'default') {
2476                         $languages = array_reverse($this->languageDependencies);   2466                         $languages = array_reverse($this->languageDependencies);
2477                         // At least we need to have English   2467                         // At least we need to have English
2478                         if (empty($languages)) {   2468                         if (empty($languages)) {
2479                                 $languages[] = 'default';   2469                                 $languages[] = 'default';
2480                         }   2470                         }
2481                 } else {   2471                 } else {
2482                         $languages = array('default');   2472                         $languages = array('default');
2483                 }   2473                 }
2484     2474  
2485                 $localLanguage = array();   2475                 $localLanguage = array();
2486                 foreach ($languages as $language) {   2476                 foreach ($languages as $language) {
2487                         $tempLL = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($fileRef, $language, $this->charSet, $errorMode);   2477                         $tempLL = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($fileRef, $language, $this->charSet, $errorMode);
2488                         $localLanguage['default'] = $tempLL['default'];   2478                         $localLanguage['default'] = $tempLL['default'];
2489                         if (!isset($localLanguage[$this->lang])) {   2479                         if (!isset($localLanguage[$this->lang])) {
2490                                 $localLanguage[$this->lang] = $localLanguage['default'];   2480                                 $localLanguage[$this->lang] = $localLanguage['default'];
2491                         }   2481                         }
2492                         if ($this->lang !== 'default' && isset($tempLL[$language])) {   2482                         if ($this->lang !== 'default' && isset($tempLL[$language])) {
2493                                 // Merge current language labels onto labels from previous language   2483                                 // Merge current language labels onto labels from previous language
2494                                 // This way we have a labels with fall back applied   2484                                 // This way we have a labels with fall back applied
2495                                 $localLanguage[$this->lang] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($localLanguage[$this->lang], $tempLL[$language], FALSE, FALSE);   2485                                 $localLanguage[$this->lang] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($localLanguage[$this->lang], $tempLL[$language], FALSE, FALSE);
2496                         }   2486                         }
2497                 }   2487                 }
2498     2488  
2499                 return $localLanguage;   2489                 return $localLanguage;
2500         }   2490         }
2501     2491  
2502     2492  
2503         /*****************************************************/   2493         /*****************************************************/
2504         /*                                                   */   2494         /*                                                   */
2505         /*  Tools                                            */   2495         /*  Tools                                            */
2506         /*                                                   */   2496         /*                                                   */
2507         /*****************************************************/   2497         /*****************************************************/
2508         /**   2498         /**
2509          * Concatenate files into one file   2499          * Concatenate files into one file
2510          * registered handler   2500          * registered handler
2511          *   2501          *
2512          * @return void   2502          * @return void
2513          */   2503          */
2514         protected function doConcatenate() {   2504         protected function doConcatenate() {
2515                 $this->doConcatenateCss();   2505                 $this->doConcatenateCss();
2516                 $this->doConcatenateJavaScript();   2506                 $this->doConcatenateJavaScript();
2517         }   2507         }
2518     2508  
2519         /**   2509         /**
2520          * Concatenate JavaScript files according to the configuration.   2510          * Concatenate JavaScript files according to the configuration.
2521          *   2511          *
2522          * @return void   2512          * @return void
2523          */   2513          */
2524         protected function doConcatenateJavaScript() {   2514         protected function doConcatenateJavaScript() {
2525                 if ($this->concatenateFiles || $this->concatenateJavascript) {   2515                 if ($this->concatenateFiles || $this->concatenateJavascript) {
2526                         if (!empty($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsConcatenateHandler'])) {   2516                         if (!empty($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsConcatenateHandler'])) {
2527                                 // use external concatenation routine   2517                                 // use external concatenation routine
2528                                 $params = array(   2518                                 $params = array(
2529                                         'jsLibs' => &$this->jsLibs,   2519                                         'jsLibs' => &$this->jsLibs,
2530                                         'jsFiles' => &$this->jsFiles,   2520                                         'jsFiles' => &$this->jsFiles,
2531                                         'jsFooterFiles' => &$this->jsFooterFiles,   2521                                         'jsFooterFiles' => &$this->jsFooterFiles,
2532                                         'headerData' => &$this->headerData,   2522                                         'headerData' => &$this->headerData,
2533                                         'footerData' => &$this->footerData   2523                                         'footerData' => &$this->footerData
2534                                 );   2524                                 );
2535                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsConcatenateHandler'], $params, $this);   2525                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsConcatenateHandler'], $params, $this);
2536                         } else {   2526                         } else {
2537                                 $this->jsLibs = $this->getCompressor()->concatenateJsFiles($this->jsLibs);   2527                                 $this->jsLibs = $this->getCompressor()->concatenateJsFiles($this->jsLibs);
2538                                 $this->jsFiles = $this->getCompressor()->concatenateJsFiles($this->jsFiles);   2528                                 $this->jsFiles = $this->getCompressor()->concatenateJsFiles($this->jsFiles);
2539                                 $this->jsFooterFiles = $this->getCompressor()->concatenateJsFiles($this->jsFooterFiles);   2529                                 $this->jsFooterFiles = $this->getCompressor()->concatenateJsFiles($this->jsFooterFiles);
2540                         }   2530                         }
2541                 }   2531                 }
2542         }   2532         }
2543     2533  
2544         /**   2534         /**
2545          * Concatenate CSS files according to configuration.   2535          * Concatenate CSS files according to configuration.
2546          *   2536          *
2547          * @return void   2537          * @return void
2548          */   2538          */
2549         protected function doConcatenateCss() {   2539         protected function doConcatenateCss() {
2550                 if ($this->concatenateFiles || $this->concatenateCss) {   2540                 if ($this->concatenateFiles || $this->concatenateCss) {
2551                         if (!empty($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssConcatenateHandler'])) {   2541                         if (!empty($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssConcatenateHandler'])) {
2552                                 // use external concatenation routine   2542                                 // use external concatenation routine
2553                                 $params = array(   2543                                 $params = array(
2554                                         'cssFiles' => &$this->cssFiles,   2544                                         'cssFiles' => &$this->cssFiles,
2555                                         'headerData' => &$this->headerData,   2545                                         'headerData' => &$this->headerData,
2556                                         'footerData' => &$this->footerData   2546                                         'footerData' => &$this->footerData
2557                                 );   2547                                 );
2558                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssConcatenateHandler'], $params, $this);   2548                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssConcatenateHandler'], $params, $this);
2559                         } else {   2549                         } else {
2560                                 $cssOptions = array();   2550                                 $cssOptions = array();
2561                                 if (TYPO3_MODE === 'BE') {   2551                                 if (TYPO3_MODE === 'BE') {
2562                                         $cssOptions = array('baseDirectories' => $GLOBALS['TBE_TEMPLATE']->getSkinStylesheetDirectories());   2552                                         $cssOptions = array('baseDirectories' => $GLOBALS['TBE_TEMPLATE']->getSkinStylesheetDirectories());
2563                                 }   2553                                 }
2564                                 $this->cssFiles = $this->getCompressor()->concatenateCssFiles($this->cssFiles, $cssOptions);   2554                                 $this->cssFiles = $this->getCompressor()->concatenateCssFiles($this->cssFiles, $cssOptions);
2565                         }   2555                         }
2566                 }   2556                 }
2567         }   2557         }
2568     2558  
2569         /**   2559         /**
2570          * Compresses inline code   2560          * Compresses inline code
2571          *   2561          *
2572          * @return void   2562          * @return void
2573          */   2563          */
2574         protected function doCompress() {   2564         protected function doCompress() {
2575                 $this->doCompressJavaScript();   2565                 $this->doCompressJavaScript();
2576                 $this->doCompressCss();   2566                 $this->doCompressCss();
2577         }   2567         }
2578     2568  
2579         /**   2569         /**
2580          * Compresses CSS according to configuration.   2570          * Compresses CSS according to configuration.
2581          *   2571          *
2582          * @return void   2572          * @return void
2583          */   2573          */
2584         protected function doCompressCss() {   2574         protected function doCompressCss() {
2585                 if ($this->compressCss) {   2575                 if ($this->compressCss) {
2586                         // Use external compression routine   2576                         // Use external compression routine
2587                         $params = array(   2577                         $params = array(
2588                                 'cssInline' => &$this->cssInline,   2578                                 'cssInline' => &$this->cssInline,
2589                                 'cssFiles' => &$this->cssFiles,   2579                                 'cssFiles' => &$this->cssFiles,
2590                                 'headerData' => &$this->headerData,   2580                                 'headerData' => &$this->headerData,
2591                                 'footerData' => &$this->footerData   2581                                 'footerData' => &$this->footerData
2592                         );   2582                         );
2593                         if (!empty($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssCompressHandler'])) {   2583                         if (!empty($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssCompressHandler'])) {
2594                                 // use external concatenation routine   2584                                 // use external concatenation routine
2595                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssCompressHandler'], $params, $this);   2585                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssCompressHandler'], $params, $this);
2596                         } else {   2586                         } else {
2597                                 $this->cssFiles = $this->getCompressor()->compressCssFiles($this->cssFiles);   2587                                 $this->cssFiles = $this->getCompressor()->compressCssFiles($this->cssFiles);
2598                         }   2588                         }
2599                 }   2589                 }
2600         }   2590         }
2601     2591  
2602         /**   2592         /**
2603          * Compresses JavaScript according to configuration.   2593          * Compresses JavaScript according to configuration.
2604          *   2594          *
2605          * @return void   2595          * @return void
2606          */   2596          */
2607         protected function doCompressJavaScript() {   2597         protected function doCompressJavaScript() {
2608                 if ($this->compressJavascript) {   2598                 if ($this->compressJavascript) {
2609                         if (!empty($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsCompressHandler'])) {   2599                         if (!empty($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsCompressHandler'])) {
2610                                 // Use external compression routine   2600                                 // Use external compression routine
2611                                 $params = array(   2601                                 $params = array(
2612                                         'jsInline' => &$this->jsInline,   2602                                         'jsInline' => &$this->jsInline,
2613                                         'jsFooterInline' => &$this->jsFooterInline,   2603                                         'jsFooterInline' => &$this->jsFooterInline,
2614                                         'jsLibs' => &$this->jsLibs,   2604                                         'jsLibs' => &$this->jsLibs,
2615                                         'jsFiles' => &$this->jsFiles,   2605                                         'jsFiles' => &$this->jsFiles,
2616                                         'jsFooterFiles' => &$this->jsFooterFiles,   2606                                         'jsFooterFiles' => &$this->jsFooterFiles,
2617                                         'headerData' => &$this->headerData,   2607                                         'headerData' => &$this->headerData,
2618                                         'footerData' => &$this->footerData   2608                                         'footerData' => &$this->footerData
2619                                 );   2609                                 );
2620                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsCompressHandler'], $params, $this);   2610                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsCompressHandler'], $params, $this);
2621                         } else {   2611                         } else {
2622                                 // Traverse the arrays, compress files   2612                                 // Traverse the arrays, compress files
2623                                 if (count($this->jsInline)) {   2613                                 if (count($this->jsInline)) {
2624                                         foreach ($this->jsInline as $name => $properties) {   2614                                         foreach ($this->jsInline as $name => $properties) {
2625                                                 if ($properties['compress']) {   2615                                                 if ($properties['compress']) {
2626                                                         $error = '';   2616                                                         $error = '';
2627                                                         $this->jsInline[$name]['code'] = \TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript($properties['code'], $error);   2617                                                         $this->jsInline[$name]['code'] = \TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript($properties['code'], $error);
2628                                                         if ($error) {   2618                                                         if ($error) {
2629                                                                 $this->compressError .= 'Error with minify JS Inline Block "' . $name . '": ' . $error . LF;   2619                                                                 $this->compressError .= 'Error with minify JS Inline Block "' . $name . '": ' . $error . LF;
2630                                                         }   2620                                                         }
2631                                                 }   2621                                                 }
2632                                         }   2622                                         }
2633                                 }   2623                                 }
2634                                 $this->jsLibs = $this->getCompressor()->compressJsFiles($this->jsLibs);   2624                                 $this->jsLibs = $this->getCompressor()->compressJsFiles($this->jsLibs);
2635                                 $this->jsFiles = $this->getCompressor()->compressJsFiles($this->jsFiles);   2625                                 $this->jsFiles = $this->getCompressor()->compressJsFiles($this->jsFiles);
2636                                 $this->jsFooterFiles = $this->getCompressor()->compressJsFiles($this->jsFooterFiles);   2626                                 $this->jsFooterFiles = $this->getCompressor()->compressJsFiles($this->jsFooterFiles);
2637                         }   2627                         }
2638                 }   2628                 }
2639         }   2629         }
2640     2630  
2641         /**   2631         /**
2642          * Returns instance of \TYPO3\CMS\Core\Resource\ResourceCompressor   2632          * Returns instance of \TYPO3\CMS\Core\Resource\ResourceCompressor
2643          *   2633          *
2644          * @return \TYPO3\CMS\Core\Resource\ResourceCompressor   2634          * @return \TYPO3\CMS\Core\Resource\ResourceCompressor
2645          */   2635          */
2646         protected function getCompressor() {   2636         protected function getCompressor() {
2647                 if ($this->compressor === NULL) {   2637                 if ($this->compressor === NULL) {
2648                         $this->compressor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceCompressor');   2638                         $this->compressor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceCompressor');
2649                 }   2639                 }
2650                 return $this->compressor;   2640                 return $this->compressor;
2651         }   2641         }
2652     2642  
2653         /**   2643         /**
2654          * Processes a Javascript file dependent on the current context   2644          * Processes a Javascript file dependent on the current context
2655          *   2645          *
2656          * Adds the version number for Frontend, compresses the file for Backend   2646          * Adds the version number for Frontend, compresses the file for Backend
2657          *   2647          *
2658          * @param string $filename Filename   2648          * @param string $filename Filename
2659          * @return string New filename   2649          * @return string New filename
2660          */   2650          */
2661         protected function processJsFile($filename) {   2651         protected function processJsFile($filename) {
2662                 switch (TYPO3_MODE) {   2652                 switch (TYPO3_MODE) {
2663                 case 'FE':   2653                 case 'FE':
2664                         if ($this->compressJavascript) {   2654                         if ($this->compressJavascript) {
2665                                 $filename = $this->getCompressor()->compressJsFile($filename);   2655                                 $filename = $this->getCompressor()->compressJsFile($filename);
2666                         } else {   2656                         } else {
2667                                 $filename = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($filename);   2657                                 $filename = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($filename);
2668                         }   2658                         }
2669                         break;   2659                         break;
2670                 case 'BE':   2660                 case 'BE':
2671                         if ($this->compressJavascript) {   2661                         if ($this->compressJavascript) {
2672                                 $filename = $this->getCompressor()->compressJsFile($filename);   2662                                 $filename = $this->getCompressor()->compressJsFile($filename);
2673                         }   2663                         }
2674                         break;   2664                         break;
2675                 }   2665                 }
2676                 return $filename;   2666                 return $filename;
2677         }   2667         }
2678     2668  
2679         /*****************************************************/   2669         /*****************************************************/
2680         /*                                                   */   2670         /*                                                   */
2681         /*  Hooks                                            */   2671         /*  Hooks                                            */
2682         /*                                                   */   2672         /*                                                   */
2683         /*****************************************************/   2673         /*****************************************************/
2684         /**   2674         /**
2685          * Execute PreRenderHook for possible manuipulation   2675          * Execute PreRenderHook for possible manuipulation
2686          *   2676          *
2687          * @return void   2677          * @return void
2688          */   2678          */
2689         protected function executePreRenderHook() {   2679         protected function executePreRenderHook() {
2690                 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'])) {   2680                 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'])) {
2691                         $params = array(   2681                         $params = array(
2692                                 'title' => &$this->title, +-    
2693                                 'jsLibs' => &$this->jsLibs, = 2682                                 'jsLibs' => &$this->jsLibs,
2694                                 'jsFooterLibs' => &$this->jsFooterLibs,   2683                                 'jsFooterLibs' => &$this->jsFooterLibs,
2695                                 'jsFiles' => &$this->jsFiles,   2684                                 'jsFiles' => &$this->jsFiles,
2696                                 'jsFooterFiles' => &$this->jsFooterFiles,   2685                                 'jsFooterFiles' => &$this->jsFooterFiles,
2697                                 'cssFiles' => &$this->cssFiles,   2686                                 'cssFiles' => &$this->cssFiles,
2698                                 'headerData' => &$this->headerData,   2687                                 'headerData' => &$this->headerData,
2699                                 'footerData' => &$this->footerData,   2688                                 'footerData' => &$this->footerData,
2700                                 'jsInline' => &$this->jsInline,   2689                                 'jsInline' => &$this->jsInline,
2701                                 'jsFooterInline' => &$this->jsFooterInline,   2690                                 'jsFooterInline' => &$this->jsFooterInline,
2702                                 'cssInline' => &$this->cssInline   2691                                 'cssInline' => &$this->cssInline
2703                         );   2692                         );
2704                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'] as $hook) {   2693                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'] as $hook) {
2705                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);   2694                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
2706                         }   2695                         }
2707                 }   2696                 }
2708         }   2697         }
2709     2698  
2710         /**   2699         /**
2711          * PostTransform for possible manuipulation of concatenated and compressed files   2700          * PostTransform for possible manuipulation of concatenated and compressed files
2712          *   2701          *
2713          * @return void   2702          * @return void
2714          */   2703          */
2715         protected function executeRenderPostTransformHook() {   2704         protected function executeRenderPostTransformHook() {
2716                 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postTransform'])) {   2705                 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postTransform'])) {
2717                         $params = array(   2706                         $params = array(
2718                                 'title' => &$this->title, +-    
2719                                 'jsLibs' => &$this->jsLibs, = 2707                                 'jsLibs' => &$this->jsLibs,
2720                                 'jsFooterLibs' => &$this->jsFooterLibs,   2708                                 'jsFooterLibs' => &$this->jsFooterLibs,
2721                                 'jsFiles' => &$this->jsFiles,   2709                                 'jsFiles' => &$this->jsFiles,
2722                                 'jsFooterFiles' => &$this->jsFooterFiles,   2710                                 'jsFooterFiles' => &$this->jsFooterFiles,
2723                                 'cssFiles' => &$this->cssFiles,   2711                                 'cssFiles' => &$this->cssFiles,
2724                                 'headerData' => &$this->headerData,   2712                                 'headerData' => &$this->headerData,
2725                                 'footerData' => &$this->footerData,   2713                                 'footerData' => &$this->footerData,
2726                                 'jsInline' => &$this->jsInline,   2714                                 'jsInline' => &$this->jsInline,
2727                                 'jsFooterInline' => &$this->jsFooterInline,   2715                                 'jsFooterInline' => &$this->jsFooterInline,
2728                                 'cssInline' => &$this->cssInline   2716                                 'cssInline' => &$this->cssInline
2729                         );   2717                         );
2730                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postTransform'] as $hook) {   2718                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postTransform'] as $hook) {
2731                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);   2719                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
2732                         }   2720                         }
2733                 }   2721                 }
2734         }   2722         }
2735     2723  
2736         /**   2724         /**
2737          * Execute postRenderHook for possible manipulation   2725          * Execute postRenderHook for possible manipulation
2738          *   2726          *
2739          * @param $jsLibs string   2727          * @param $jsLibs string
2740          * @param $jsFiles string   2728          * @param $jsFiles string
2741          * @param $jsFooterFiles string   2729          * @param $jsFooterFiles string
2742          * @param $cssFiles string   2730          * @param $cssFiles string
2743          * @param $jsInline string   2731          * @param $jsInline string
2744          * @param $cssInline string   2732          * @param $cssInline string
2745          * @param $jsFooterInline string   2733          * @param $jsFooterInline string
2746          * @param $jsFooterLibs string   2734          * @param $jsFooterLibs string
2747          * @return void   2735          * @return void
2748          */   2736          */
2749         protected function executePostRenderHook(&$jsLibs, &$jsFiles, &$jsFooterFiles, &$cssFiles, &$jsInline, &$cssInline, &$jsFooterInline, &$jsFooterLibs) {   2737         protected function executePostRenderHook(&$jsLibs, &$jsFiles, &$jsFooterFiles, &$cssFiles, &$jsInline, &$cssInline, &$jsFooterInline, &$jsFooterLibs) {
2750                 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postProcess'])) {   2738                 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postProcess'])) {
2751                         $params = array(   2739                         $params = array(
2752                                 'jsLibs' => &$jsLibs,   2740                                 'jsLibs' => &$jsLibs,
2753                                 'jsFiles' => &$jsFiles,   2741                                 'jsFiles' => &$jsFiles,
2754                                 'jsFooterFiles' => &$jsFooterFiles,   2742                                 'jsFooterFiles' => &$jsFooterFiles,
2755                                 'cssFiles' => &$cssFiles,   2743                                 'cssFiles' => &$cssFiles,
2756                                 'headerData' => &$this->headerData,   2744                                 'headerData' => &$this->headerData,
2757                                 'footerData' => &$this->footerData,   2745                                 'footerData' => &$this->footerData,
2758                                 'jsInline' => &$jsInline,   2746                                 'jsInline' => &$jsInline,
2759                                 'cssInline' => &$cssInline,   2747                                 'cssInline' => &$cssInline,
2760                                 'xmlPrologAndDocType' => &$this->xmlPrologAndDocType,   2748                                 'xmlPrologAndDocType' => &$this->xmlPrologAndDocType,
2761                                 'htmlTag' => &$this->htmlTag,   2749                                 'htmlTag' => &$this->htmlTag,
2762                                 'headTag' => &$this->headTag,   2750                                 'headTag' => &$this->headTag,
2763                                 'charSet' => &$this->charSet,   2751                                 'charSet' => &$this->charSet,
2764                                 'metaCharsetTag' => &$this->metaCharsetTag,   2752                                 'metaCharsetTag' => &$this->metaCharsetTag,
2765                                 'shortcutTag' => &$this->shortcutTag,   2753                                 'shortcutTag' => &$this->shortcutTag,
2766                                 'inlineComments' => &$this->inlineComments,   2754                                 'inlineComments' => &$this->inlineComments,
2767                                 'baseUrl' => &$this->baseUrl,   2755                                 'baseUrl' => &$this->baseUrl,
2768                                 'baseUrlTag' => &$this->baseUrlTag,   2756                                 'baseUrlTag' => &$this->baseUrlTag,
2769                                 'favIcon' => &$this->favIcon,   2757                                 'favIcon' => &$this->favIcon,
2770                                 'iconMimeType' => &$this->iconMimeType,   2758                                 'iconMimeType' => &$this->iconMimeType,
2771                                 'titleTag' => &$this->titleTag,   2759                                 'titleTag' => &$this->titleTag,
2772                                 'title' => &$this->title,   2760                                 'title' => &$this->title,
2773                                 'metaTags' => &$this->metaTags,   2761                                 'metaTags' => &$this->metaTags,
2774                                 'jsFooterInline' => &$jsFooterInline,   2762                                 'jsFooterInline' => &$jsFooterInline,
2775                                 'jsFooterLibs' => &$jsFooterLibs,   2763                                 'jsFooterLibs' => &$jsFooterLibs,
2776                                 'bodyContent' => &$this->bodyContent   2764                                 'bodyContent' => &$this->bodyContent
2777                         );   2765                         );
2778                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postProcess'] as $hook) {   2766                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postProcess'] as $hook) {
2779                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);   2767                                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
2780                         }   2768                         }
2781                 }   2769                 }
2782         }   2770         }
2783     2771  
2784 }   2772 }
2785     2773  
2786     2774  
2787 ?>   2775 ?>