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