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