Text Compare
Produced: 1/13/2014 16:31:17
   
Mode:  All  
Left file: C:\Users\lei.bi\Desktop\typo3.updated\sysext\frontend\Classes\Page\PageGenerator.php  
Right file: C:\Users\lei.bi\Desktop\typo3\sysext\frontend\Classes\Page\PageGenerator.php  
1 <?php = 1 <?php
2 namespace TYPO3\CMS\Frontend\Page;   2 namespace TYPO3\CMS\Frontend\Page;
3     3  
4 /***************************************************************   4 /***************************************************************
5 *  Copyright notice   5 *  Copyright notice
6 *   6 *
7 *  (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)   7 *  (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 *  All rights reserved   8 *  All rights reserved
9 *   9 *
10 *  This script is part of the TYPO3 project. The TYPO3 project is   10 *  This script is part of the TYPO3 project. The TYPO3 project is
11 *  free software; you can redistribute it and/or modify   11 *  free software; you can redistribute it and/or modify
12 *  it under the terms of the GNU General Public License as published by   12 *  it under the terms of the GNU General Public License as published by
13 *  the Free Software Foundation; either version 2 of the License, or   13 *  the Free Software Foundation; either version 2 of the License, or
14 *  (at your option) any later version.   14 *  (at your option) any later version.
15 *   15 *
16 *  The GNU General Public License can be found at   16 *  The GNU General Public License can be found at
17 *  http://www.gnu.org/copyleft/gpl.html.   17 *  http://www.gnu.org/copyleft/gpl.html.
18 *  A copy is found in the textfile GPL.txt and important notices to the license   18 *  A copy is found in the textfile GPL.txt and important notices to the license
19 *  from the author is found in LICENSE.txt distributed with these scripts.   19 *  from the author is found in LICENSE.txt distributed with these scripts.
20 *   20 *
21 *   21 *
22 *  This script is distributed in the hope that it will be useful,   22 *  This script is distributed in the hope that it will be useful,
23 *  but WITHOUT ANY WARRANTY; without even the implied warranty of   23 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
24 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   24 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 *  GNU General Public License for more details.   25 *  GNU General Public License for more details.
26 *   26 *
27 *  This copyright notice MUST APPEAR in all copies of the script!   27 *  This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/   28 ***************************************************************/
29 /**   29 /**
30 * Libraries for pagegen.php   30 * Libraries for pagegen.php
31 * The script "pagegen.php" is included by "index_ts.php" when a page is not cached but needs to be rendered.   31 * The script "pagegen.php" is included by "index_ts.php" when a page is not cached but needs to be rendered.
32 *   32 *
33 * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj   33 * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj
34 * XHTML compliant   34 * XHTML compliant
35 *   35 *
36 * @author Kasper Skårhøj <kasperYYYY@typo3.com>   36 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
37 */   37 */
38 /**   38 /**
39 * Class for starting TypoScript page generation   39 * Class for starting TypoScript page generation
40 *   40 *
41 * The class is not instantiated as an objects but called directly with the "::" operator.   41 * The class is not instantiated as an objects but called directly with the "::" operator.
42 * eg: TSpagegen::pagegenInit()   42 * eg: TSpagegen::pagegenInit()
43 *   43 *
44 * @author Kasper Skårhøj <kasperYYYY@typo3.com>   44 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
45 */   45 */
46 class PageGenerator {   46 class PageGenerator {
47     47  
48         /**   48         /**
49          * Setting some vars in TSFE, primarily based on TypoScript config settings.   49          * Setting some vars in TSFE, primarily based on TypoScript config settings.
50          *   50          *
51          * @return void   51          * @return void
52          */   52          */
53         static public function pagegenInit() {   53         static public function pagegenInit() {
54                 if ($GLOBALS['TSFE']->page['content_from_pid'] > 0) {   54                 if ($GLOBALS['TSFE']->page['content_from_pid'] > 0) {
55                         // make REAL copy of TSFE object - not reference!   55                         // make REAL copy of TSFE object - not reference!
56                         $temp_copy_TSFE = clone $GLOBALS['TSFE'];   56                         $temp_copy_TSFE = clone $GLOBALS['TSFE'];
57                         // Set ->id to the content_from_pid value - we are going to evaluate this pid as was it a given id for a page-display!   57                         // Set ->id to the content_from_pid value - we are going to evaluate this pid as was it a given id for a page-display!
58                         $temp_copy_TSFE->id = $GLOBALS['TSFE']->page['content_from_pid'];   58                         $temp_copy_TSFE->id = $GLOBALS['TSFE']->page['content_from_pid'];
59                         $temp_copy_TSFE->MP = '';   59                         $temp_copy_TSFE->MP = '';
60                         $temp_copy_TSFE->getPageAndRootlineWithDomain($GLOBALS['TSFE']->config['config']['content_from_pid_allowOutsideDomain'] ? 0 : $GLOBALS['TSFE']->domainStartPage);   60                         $temp_copy_TSFE->getPageAndRootlineWithDomain($GLOBALS['TSFE']->config['config']['content_from_pid_allowOutsideDomain'] ? 0 : $GLOBALS['TSFE']->domainStartPage);
61                         $GLOBALS['TSFE']->contentPid = intval($temp_copy_TSFE->id);   61                         $GLOBALS['TSFE']->contentPid = intval($temp_copy_TSFE->id);
62                         unset($temp_copy_TSFE);   62                         unset($temp_copy_TSFE);
63                 }   63                 }
64                 if ($GLOBALS['TSFE']->config['config']['MP_defaults']) {   64                 if ($GLOBALS['TSFE']->config['config']['MP_defaults']) {
65                         $temp_parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $GLOBALS['TSFE']->config['config']['MP_defaults'], 1);   65                         $temp_parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $GLOBALS['TSFE']->config['config']['MP_defaults'], 1);
66                         foreach ($temp_parts as $temp_p) {   66                         foreach ($temp_parts as $temp_p) {
67                                 list($temp_idP, $temp_MPp) = explode(':', $temp_p, 2);   67                                 list($temp_idP, $temp_MPp) = explode(':', $temp_p, 2);
68                                 $temp_ids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $temp_idP);   68                                 $temp_ids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $temp_idP);
69                                 foreach ($temp_ids as $temp_id) {   69                                 foreach ($temp_ids as $temp_id) {
70                                         $GLOBALS['TSFE']->MP_defaults[$temp_id] = $temp_MPp;   70                                         $GLOBALS['TSFE']->MP_defaults[$temp_id] = $temp_MPp;
71                                 }   71                                 }
72                         }   72                         }
73                 }   73                 }
74                 // Global vars...   74                 // Global vars...
75                 $GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title'];   75                 $GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title'];
76                 $GLOBALS['TSFE']->debug = '' . $GLOBALS['TSFE']->config['config']['debug'];   76                 $GLOBALS['TSFE']->debug = '' . $GLOBALS['TSFE']->config['config']['debug'];
77                 // Base url:   77                 // Base url:
78                 if (isset($GLOBALS['TSFE']->config['config']['baseURL'])) {   78                 if (isset($GLOBALS['TSFE']->config['config']['baseURL'])) {
79                         $GLOBALS['TSFE']->baseUrl = $GLOBALS['TSFE']->config['config']['baseURL'];   79                         $GLOBALS['TSFE']->baseUrl = $GLOBALS['TSFE']->config['config']['baseURL'];
80                         $GLOBALS['TSFE']->anchorPrefix = substr(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), strlen(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')));   80                         $GLOBALS['TSFE']->anchorPrefix = substr(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), strlen(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')));
81                 }   81                 }
82                 // Internal and External target defaults   82                 // Internal and External target defaults
83                 $GLOBALS['TSFE']->intTarget = '' . $GLOBALS['TSFE']->config['config']['intTarget'];   83                 $GLOBALS['TSFE']->intTarget = '' . $GLOBALS['TSFE']->config['config']['intTarget'];
84                 $GLOBALS['TSFE']->extTarget = '' . $GLOBALS['TSFE']->config['config']['extTarget'];   84                 $GLOBALS['TSFE']->extTarget = '' . $GLOBALS['TSFE']->config['config']['extTarget'];
85                 $GLOBALS['TSFE']->fileTarget = '' . $GLOBALS['TSFE']->config['config']['fileTarget'];   85                 $GLOBALS['TSFE']->fileTarget = '' . $GLOBALS['TSFE']->config['config']['fileTarget'];
86                 if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] === 'ascii') {   86                 if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] === 'ascii') {
87                         $GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';   87                         $GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';
88                 } else {   88                 } else {
89                         $GLOBALS['TSFE']->spamProtectEmailAddresses = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'], -10, 10, 0);   89                         $GLOBALS['TSFE']->spamProtectEmailAddresses = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'], -10, 10, 0);
90                 }   90                 }
91                 $GLOBALS['TSFE']->absRefPrefix = $GLOBALS['TSFE']->config['config']['absRefPrefix'] ? trim($GLOBALS['TSFE']->config['config']['absRefPrefix']) : '';   91                 $GLOBALS['TSFE']->absRefPrefix = $GLOBALS['TSFE']->config['config']['absRefPrefix'] ? trim($GLOBALS['TSFE']->config['config']['absRefPrefix']) : '';
92                 if ($GLOBALS['TSFE']->type && $GLOBALS['TSFE']->config['config']['frameReloadIfNotInFrameset']) {   92                 if ($GLOBALS['TSFE']->type && $GLOBALS['TSFE']->config['config']['frameReloadIfNotInFrameset']) {
93                         $tdlLD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page, '_top', $GLOBALS['TSFE']->no_cache, '');   93                         $tdlLD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page, '_top', $GLOBALS['TSFE']->no_cache, '');
94                         $GLOBALS['TSFE']->additionalJavaScript['JSCode'] .= 'if(!parent.' . trim($GLOBALS['TSFE']->sPre) . ' && !parent.view_frame) top.location.href="' . $GLOBALS['TSFE']->baseUrlWrap($tdlLD['totalURL']) . '"';   94                         $GLOBALS['TSFE']->additionalJavaScript['JSCode'] .= 'if(!parent.' . trim($GLOBALS['TSFE']->sPre) . ' && !parent.view_frame) top.location.href="' . $GLOBALS['TSFE']->baseUrlWrap($tdlLD['totalURL']) . '"';
95                 }   95                 }
96                 $GLOBALS['TSFE']->compensateFieldWidth = '' . $GLOBALS['TSFE']->config['config']['compensateFieldWidth'];   96                 $GLOBALS['TSFE']->compensateFieldWidth = '' . $GLOBALS['TSFE']->config['config']['compensateFieldWidth'];
97                 $GLOBALS['TSFE']->lockFilePath = '' . $GLOBALS['TSFE']->config['config']['lockFilePath'];   97                 $GLOBALS['TSFE']->lockFilePath = '' . $GLOBALS['TSFE']->config['config']['lockFilePath'];
98                 $GLOBALS['TSFE']->lockFilePath = $GLOBALS['TSFE']->lockFilePath ? $GLOBALS['TSFE']->lockFilePath : $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'];   98                 $GLOBALS['TSFE']->lockFilePath = $GLOBALS['TSFE']->lockFilePath ? $GLOBALS['TSFE']->lockFilePath : $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'];
99                 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'] = isset($GLOBALS['TSFE']->config['config']['noScaleUp']) ? '' . $GLOBALS['TSFE']->config['config']['noScaleUp'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];   99                 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'] = isset($GLOBALS['TSFE']->config['config']['noScaleUp']) ? '' . $GLOBALS['TSFE']->config['config']['noScaleUp'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
100                 $GLOBALS['TSFE']->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];   100                 $GLOBALS['TSFE']->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
101                 $GLOBALS['TSFE']->ATagParams = trim($GLOBALS['TSFE']->config['config']['ATagParams']) ? ' ' . trim($GLOBALS['TSFE']->config['config']['ATagParams']) : '';   101                 $GLOBALS['TSFE']->ATagParams = trim($GLOBALS['TSFE']->config['config']['ATagParams']) ? ' ' . trim($GLOBALS['TSFE']->config['config']['ATagParams']) : '';
102                 if ($GLOBALS['TSFE']->config['config']['setJS_mouseOver']) {   102                 if ($GLOBALS['TSFE']->config['config']['setJS_mouseOver']) {
103                         $GLOBALS['TSFE']->setJS('mouseOver');   103                         $GLOBALS['TSFE']->setJS('mouseOver');
104                 }   104                 }
105                 if ($GLOBALS['TSFE']->config['config']['setJS_openPic']) {   105                 if ($GLOBALS['TSFE']->config['config']['setJS_openPic']) {
106                         $GLOBALS['TSFE']->setJS('openPic');   106                         $GLOBALS['TSFE']->setJS('openPic');
107                 }   107                 }
108                 $GLOBALS['TSFE']->sWordRegEx = '';   108                 $GLOBALS['TSFE']->sWordRegEx = '';
109                 $GLOBALS['TSFE']->sWordList = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('sword_list');   109                 $GLOBALS['TSFE']->sWordList = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('sword_list');
110                 if (is_array($GLOBALS['TSFE']->sWordList)) {   110                 if (is_array($GLOBALS['TSFE']->sWordList)) {
111                         $space = !empty($GLOBALS['TSFE']->config['config']['sword_standAlone']) ? '[[:space:]]' : '';   111                         $space = !empty($GLOBALS['TSFE']->config['config']['sword_standAlone']) ? '[[:space:]]' : '';
112                         foreach ($GLOBALS['TSFE']->sWordList as $val) {   112                         foreach ($GLOBALS['TSFE']->sWordList as $val) {
113                                 if (strlen(trim($val)) > 0) {   113                                 if (strlen(trim($val)) > 0) {
114                                         $GLOBALS['TSFE']->sWordRegEx .= $space . quotemeta($val) . $space . '|';   114                                         $GLOBALS['TSFE']->sWordRegEx .= $space . quotemeta($val) . $space . '|';
115                                 }   115                                 }
116                         }   116                         }
117                         $GLOBALS['TSFE']->sWordRegEx = preg_replace('/\\|$/', '', $GLOBALS['TSFE']->sWordRegEx);   117                         $GLOBALS['TSFE']->sWordRegEx = preg_replace('/\\|$/', '', $GLOBALS['TSFE']->sWordRegEx);
118                 }   118                 }
119                 // linkVars   119                 // linkVars
120                 $GLOBALS['TSFE']->calculateLinkVars();   120                 $GLOBALS['TSFE']->calculateLinkVars();
121                 // dtdAllowsFrames indicates whether to use the target attribute in links   121                 // dtdAllowsFrames indicates whether to use the target attribute in links
122                 $GLOBALS['TSFE']->dtdAllowsFrames = FALSE;   122                 $GLOBALS['TSFE']->dtdAllowsFrames = FALSE;
123                 if ($GLOBALS['TSFE']->config['config']['doctype']) {   123                 if ($GLOBALS['TSFE']->config['config']['doctype']) {
124                         if (in_array(   124                         if (in_array(
125                                 (string) $GLOBALS['TSFE']->config['config']['doctype'],   125                                 (string) $GLOBALS['TSFE']->config['config']['doctype'],
126                                 array('xhtml_trans', 'xhtml_frames', 'xhtml_basic', 'xhtml_2', 'html5'),   126                                 array('xhtml_trans', 'xhtml_frames', 'xhtml_basic', 'xhtml_2', 'html5'),
127                                 TRUE)   127                                 TRUE)
128                         ) {   128                         ) {
129                                 $GLOBALS['TSFE']->dtdAllowsFrames = TRUE;   129                                 $GLOBALS['TSFE']->dtdAllowsFrames = TRUE;
130                         }   130                         }
131                 } else {   131                 } else {
132                         $GLOBALS['TSFE']->dtdAllowsFrames = TRUE;   132                         $GLOBALS['TSFE']->dtdAllowsFrames = TRUE;
133                 }   133                 }
134                 // Setting XHTML-doctype from doctype   134                 // Setting XHTML-doctype from doctype
135                 if (!$GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {   135                 if (!$GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {
136                         $GLOBALS['TSFE']->config['config']['xhtmlDoctype'] = $GLOBALS['TSFE']->config['config']['doctype'];   136                         $GLOBALS['TSFE']->config['config']['xhtmlDoctype'] = $GLOBALS['TSFE']->config['config']['doctype'];
137                 }   137                 }
138                 if ($GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {   138                 if ($GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {
139                         $GLOBALS['TSFE']->xhtmlDoctype = $GLOBALS['TSFE']->config['config']['xhtmlDoctype'];   139                         $GLOBALS['TSFE']->xhtmlDoctype = $GLOBALS['TSFE']->config['config']['xhtmlDoctype'];
140                         // Checking XHTML-docytpe   140                         // Checking XHTML-docytpe
141                         switch ((string) $GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {   141                         switch ((string) $GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {
142                         case 'xhtml_trans':   142                         case 'xhtml_trans':
143     143  
144                         case 'xhtml_strict':   144                         case 'xhtml_strict':
145     145  
146                         case 'xhtml_frames':   146                         case 'xhtml_frames':
147                                 $GLOBALS['TSFE']->xhtmlVersion = 100;   147                                 $GLOBALS['TSFE']->xhtmlVersion = 100;
148                                 break;   148                                 break;
149                         case 'xhtml_basic':   149                         case 'xhtml_basic':
150                                 $GLOBALS['TSFE']->xhtmlVersion = 105;   150                                 $GLOBALS['TSFE']->xhtmlVersion = 105;
151                                 break;   151                                 break;
152                         case 'xhtml_11':   152                         case 'xhtml_11':
153     153  
154                         case 'xhtml+rdfa_10':   154                         case 'xhtml+rdfa_10':
155                                 $GLOBALS['TSFE']->xhtmlVersion = 110;   155                                 $GLOBALS['TSFE']->xhtmlVersion = 110;
156                                 break;   156                                 break;
157                         case 'xhtml_2':   157                         case 'xhtml_2':
158                                 $GLOBALS['TSFE']->xhtmlVersion = 200;   158                                 $GLOBALS['TSFE']->xhtmlVersion = 200;
159                                 break;   159                                 break;
160                         default:   160                         default:
161                                 $GLOBALS['TSFE']->getPageRenderer()->setRenderXhtml(FALSE);   161                                 $GLOBALS['TSFE']->getPageRenderer()->setRenderXhtml(FALSE);
162                                 $GLOBALS['TSFE']->xhtmlDoctype = '';   162                                 $GLOBALS['TSFE']->xhtmlDoctype = '';
163                                 $GLOBALS['TSFE']->xhtmlVersion = 0;   163                                 $GLOBALS['TSFE']->xhtmlVersion = 0;
164                         }   164                         }
165                 } else {   165                 } else {
166                         $GLOBALS['TSFE']->getPageRenderer()->setRenderXhtml(FALSE);   166                         $GLOBALS['TSFE']->getPageRenderer()->setRenderXhtml(FALSE);
167                 }   167                 }
168         }   168         }
169     169  
170         /**   170         /**
171          * Returns an array with files to include. These files are the ones set up in TypoScript config.   171          * Returns an array with files to include. These files are the ones set up in TypoScript config.
172          *   172          *
173          * @return array Files to include. Paths are relative to PATH_site.   173          * @return array Files to include. Paths are relative to PATH_site.
174          */   174          */
175         static public function getIncFiles() {   175         static public function getIncFiles() {
176                 $incFilesArray = array();   176                 $incFilesArray = array();
177                 // Get files from config.includeLibrary   177                 // Get files from config.includeLibrary
178                 $includeLibrary = trim('' . $GLOBALS['TSFE']->config['config']['includeLibrary']);   178                 $includeLibrary = trim('' . $GLOBALS['TSFE']->config['config']['includeLibrary']);
179                 if ($includeLibrary) {   179                 if ($includeLibrary) {
180                         $incFile = $GLOBALS['TSFE']->tmpl->getFileName($includeLibrary);   180                         $incFile = $GLOBALS['TSFE']->tmpl->getFileName($includeLibrary);
181                         if ($incFile) {   181                         if ($incFile) {
182                                 $incFilesArray[] = $incFile;   182                                 $incFilesArray[] = $incFile;
183                         }   183                         }
184                 }   184                 }
185                 if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.'])) {   185                 if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.'])) {
186                         $incLibs = $GLOBALS['TSFE']->pSetup['includeLibs.'];   186                         $incLibs = $GLOBALS['TSFE']->pSetup['includeLibs.'];
187                 } else {   187                 } else {
188                         $incLibs = array();   188                         $incLibs = array();
189                 }   189                 }
190                 if (is_array($GLOBALS['TSFE']->tmpl->setup['includeLibs.'])) {   190                 if (is_array($GLOBALS['TSFE']->tmpl->setup['includeLibs.'])) {
191                         // toplevel 'includeLibs' is added to the PAGE.includeLibs. In that way, PAGE-libs get first priority, because if the key already exist, it's not altered. (Due to investigation by me)   191                         // toplevel 'includeLibs' is added to the PAGE.includeLibs. In that way, PAGE-libs get first priority, because if the key already exist, it's not altered. (Due to investigation by me)
192                         $incLibs += $GLOBALS['TSFE']->tmpl->setup['includeLibs.'];   192                         $incLibs += $GLOBALS['TSFE']->tmpl->setup['includeLibs.'];
193                 }   193                 }
194                 if (count($incLibs)) {   194                 if (count($incLibs)) {
195                         foreach ($incLibs as $theLib) {   195                         foreach ($incLibs as $theLib) {
196                                 if (!is_array($theLib) && ($incFile = $GLOBALS['TSFE']->tmpl->getFileName($theLib))) {   196                                 if (!is_array($theLib) && ($incFile = $GLOBALS['TSFE']->tmpl->getFileName($theLib))) {
197                                         $incFilesArray[] = $incFile;   197                                         $incFilesArray[] = $incFile;
198                                 }   198                                 }
199                         }   199                         }
200                 }   200                 }
201                 return $incFilesArray;   201                 return $incFilesArray;
202         }   202         }
203     203  
204         /**   204         /**
205          * Processing JavaScript handlers   205          * Processing JavaScript handlers
206          *   206          *
207          * @return array Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag.   207          * @return array Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag.
208          */   208          */
209         static public function JSeventFunctions() {   209         static public function JSeventFunctions() {
210                 $functions = array();   210                 $functions = array();
211                 $setEvents = array();   211                 $setEvents = array();
212                 $setBody = array();   212                 $setBody = array();
213                 foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers) {   213                 foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers) {
214                         if (count($handlers)) {   214                         if (count($handlers)) {
215                                 $functions[] = '        function T3_' . $event . 'Wrapper(e) {        ' . implode('   ', $handlers) . '        }';   215                                 $functions[] = '        function T3_' . $event . 'Wrapper(e) {        ' . implode('   ', $handlers) . '        }';
216                                 $setEvents[] = '        document.' . $event . '=T3_' . $event . 'Wrapper;';   216                                 $setEvents[] = '        document.' . $event . '=T3_' . $event . 'Wrapper;';
217                                 if ($event == 'onload') {   217                                 if ($event == 'onload') {
218                                         // Dubiuos double setting breaks on some browser - do we need it?   218                                         // Dubiuos double setting breaks on some browser - do we need it?
219                                         $setBody[] = 'onload="T3_onloadWrapper();"';   219                                         $setBody[] = 'onload="T3_onloadWrapper();"';
220                                 }   220                                 }
221                         }   221                         }
222                 }   222                 }
223                 return array(count($functions) ? implode(LF, $functions) . LF . implode(LF, $setEvents) : '', $setBody);   223                 return array(count($functions) ? implode(LF, $functions) . LF . implode(LF, $setEvents) : '', $setBody);
224         }   224         }
225     225  
226         /**   226         /**
227          * Rendering the page content   227          * Rendering the page content
228          *   228          *
229          * @return void   229          * @return void
230          */   230          */
231         static public function renderContent() {   231         static public function renderContent() {
232                 // PAGE CONTENT   232                 // PAGE CONTENT
233                 $GLOBALS['TT']->incStackPointer();   233                 $GLOBALS['TT']->incStackPointer();
234                 $GLOBALS['TT']->push($GLOBALS['TSFE']->sPre, 'PAGE');   234                 $GLOBALS['TT']->push($GLOBALS['TSFE']->sPre, 'PAGE');
235                 $pageContent = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup);   235                 $pageContent = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup);
236                 if ($GLOBALS['TSFE']->pSetup['wrap']) {   236                 if ($GLOBALS['TSFE']->pSetup['wrap']) {
237                         $pageContent = $GLOBALS['TSFE']->cObj->wrap($pageContent, $GLOBALS['TSFE']->pSetup['wrap']);   237                         $pageContent = $GLOBALS['TSFE']->cObj->wrap($pageContent, $GLOBALS['TSFE']->pSetup['wrap']);
238                 }   238                 }
239                 if ($GLOBALS['TSFE']->pSetup['stdWrap.']) {   239                 if ($GLOBALS['TSFE']->pSetup['stdWrap.']) {
240                         $pageContent = $GLOBALS['TSFE']->cObj->stdWrap($pageContent, $GLOBALS['TSFE']->pSetup['stdWrap.']);   240                         $pageContent = $GLOBALS['TSFE']->cObj->stdWrap($pageContent, $GLOBALS['TSFE']->pSetup['stdWrap.']);
241                 }   241                 }
242                 // PAGE HEADER (after content - maybe JS is inserted!   242                 // PAGE HEADER (after content - maybe JS is inserted!
243                 // if 'disableAllHeaderCode' is set, all the header-code is discarded!   243                 // if 'disableAllHeaderCode' is set, all the header-code is discarded!
244                 if ($GLOBALS['TSFE']->config['config']['disableAllHeaderCode']) {   244                 if ($GLOBALS['TSFE']->config['config']['disableAllHeaderCode']) {
245                         $GLOBALS['TSFE']->content = $pageContent;   245                         $GLOBALS['TSFE']->content = $pageContent;
246                 } else {   246                 } else {
247                         self::renderContentWithHeader($pageContent);   247                         self::renderContentWithHeader($pageContent);
248                 }   248                 }
249                 $GLOBALS['TT']->pull($GLOBALS['TT']->LR ? $GLOBALS['TSFE']->content : '');   249                 $GLOBALS['TT']->pull($GLOBALS['TT']->LR ? $GLOBALS['TSFE']->content : '');
250                 $GLOBALS['TT']->decStackPointer();   250                 $GLOBALS['TT']->decStackPointer();
251         }   251         }
252     252  
253         /**   253         /**
254          * Rendering normal HTML-page with header by wrapping the generated content ($pageContent) in body-tags and setting the header accordingly.   254          * Rendering normal HTML-page with header by wrapping the generated content ($pageContent) in body-tags and setting the header accordingly.
255          *   255          *
256          * @param string $pageContent The page content which TypoScript objects has generated   256          * @param string $pageContent The page content which TypoScript objects has generated
257          * @return void   257          * @return void
258          */   258          */
259         static public function renderContentWithHeader($pageContent) {   259         static public function renderContentWithHeader($pageContent) {
260                 /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */   260                 /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
261                 $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();   261                 $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
262                 if ($GLOBALS['TSFE']->config['config']['moveJsFromHeaderToFooter']) {   262                 if ($GLOBALS['TSFE']->config['config']['moveJsFromHeaderToFooter']) {
263                         $pageRenderer->enableMoveJsFromHeaderToFooter();   263                         $pageRenderer->enableMoveJsFromHeaderToFooter();
264                 }   264                 }
265                 if ($GLOBALS['TSFE']->config['config']['pageRendererTemplateFile']) {   265                 if ($GLOBALS['TSFE']->config['config']['pageRendererTemplateFile']) {
266                         $file = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->config['config']['pageRendererTemplateFile']);   266                         $file = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->config['config']['pageRendererTemplateFile']);
267                         if ($file) {   267                         if ($file) {
268                                 $pageRenderer->setTemplateFile($file);   268                                 $pageRenderer->setTemplateFile($file);
269                         }   269                         }
270                 }   270                 }
271                 $headerComment = $GLOBALS['TSFE']->config['config']['headerComment'];   271                 $headerComment = $GLOBALS['TSFE']->config['config']['headerComment'];
272                 if (trim($headerComment)) {   272                 if (trim($headerComment)) {
273                         $pageRenderer->addInlineComment(TAB . str_replace(LF, (LF . TAB), trim($headerComment)) . LF);   273                         $pageRenderer->addInlineComment(TAB . str_replace(LF, (LF . TAB), trim($headerComment)) . LF);
274                 }   274                 }
275                 // Setting charset:   275                 // Setting charset:
276                 $theCharset = $GLOBALS['TSFE']->metaCharset;   276                 $theCharset = $GLOBALS['TSFE']->metaCharset;
277                 // Reset the content variables:   277                 // Reset the content variables:
278                 $GLOBALS['TSFE']->content = '';   278                 $GLOBALS['TSFE']->content = '';
279                 $htmlTagAttributes = array();   279                 $htmlTagAttributes = array();
280                 $htmlLang = $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] ? $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] : 'en';   280                 $htmlLang = $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] ? $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] : 'en';
281                 // Set content direction: (More info: http://www.tau.ac.il/~danon/Hebrew/HTML_and_Hebrew.html)   281                 // Set content direction: (More info: http://www.tau.ac.il/~danon/Hebrew/HTML_and_Hebrew.html)
282                 if ($GLOBALS['TSFE']->config['config']['htmlTag_dir']) {   282                 if ($GLOBALS['TSFE']->config['config']['htmlTag_dir']) {
283                         $htmlTagAttributes['dir'] = htmlspecialchars($GLOBALS['TSFE']->config['config']['htmlTag_dir']);   283                         $htmlTagAttributes['dir'] = htmlspecialchars($GLOBALS['TSFE']->config['config']['htmlTag_dir']);
284                 }   284                 }
285                 // Setting document type:   285                 // Setting document type:
286                 $docTypeParts = array();   286                 $docTypeParts = array();
287                 $xmlDocument = TRUE;   287                 $xmlDocument = TRUE;
288                 // Part 1: XML prologue   288                 // Part 1: XML prologue
289                 switch ((string) $GLOBALS['TSFE']->config['config']['xmlprologue']) {   289                 switch ((string) $GLOBALS['TSFE']->config['config']['xmlprologue']) {
290                 case 'none':   290                 case 'none':
291                         $xmlDocument = FALSE;   291                         $xmlDocument = FALSE;
292                         $GLOBALS['TSFE']->config['config']['xhtml_cleaning'] = 'none';   292                         $GLOBALS['TSFE']->config['config']['xhtml_cleaning'] = 'none';
293                         break;   293                         break;
294                 case 'xml_10':   294                 case 'xml_10':
295                         $docTypeParts[] = '<?xml version="1.0" encoding="' . $theCharset . '"?>';   295                         $docTypeParts[] = '<?xml version="1.0" encoding="' . $theCharset . '"?>';
296                         break;   296                         break;
297                 case 'xml_11':   297                 case 'xml_11':
298                         $docTypeParts[] = '<?xml version="1.1" encoding="' . $theCharset . '"?>';   298                         $docTypeParts[] = '<?xml version="1.1" encoding="' . $theCharset . '"?>';
299                         break;   299                         break;
300                 case '':   300                 case '':
301                         if ($GLOBALS['TSFE']->xhtmlVersion) {   301                         if ($GLOBALS['TSFE']->xhtmlVersion) {
302                                 $docTypeParts[] = '<?xml version="1.0" encoding="' . $theCharset . '"?>';   302                                 $docTypeParts[] = '<?xml version="1.0" encoding="' . $theCharset . '"?>';
303                         }   303                         }
304                         break;   304                         break;
305                 default:   305                 default:
306                         $docTypeParts[] = $GLOBALS['TSFE']->config['config']['xmlprologue'];   306                         $docTypeParts[] = $GLOBALS['TSFE']->config['config']['xmlprologue'];
307                 }   307                 }
308                 // Part 2: DTD   308                 // Part 2: DTD
309                 $doctype = $GLOBALS['TSFE']->config['config']['doctype'];   309                 $doctype = $GLOBALS['TSFE']->config['config']['doctype'];
310                 if ($doctype) {   310                 if ($doctype) {
311                         switch ($doctype) {   311                         switch ($doctype) {
312                         case 'xhtml_trans':   312                         case 'xhtml_trans':
313                                 $docTypeParts[] = '<!DOCTYPE html   313                                 $docTypeParts[] = '<!DOCTYPE html
314                 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <> 314      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
315                 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';   315      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
316                                 break; = 316                                 break;
317                         case 'xhtml_strict':   317                         case 'xhtml_strict':
318                                 $docTypeParts[] = '<!DOCTYPE html   318                                 $docTypeParts[] = '<!DOCTYPE html
319                 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <> 319      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
320                 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';   320      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
321                                 break; = 321                                 break;
322                         case 'xhtml_frames':   322                         case 'xhtml_frames':
323                                 $docTypeParts[] = '<!DOCTYPE html   323                                 $docTypeParts[] = '<!DOCTYPE html
324                 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" <> 324      PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
325                 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';   325      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
326                                 break; = 326                                 break;
327                         case 'xhtml_basic':   327                         case 'xhtml_basic':
328                                 $docTypeParts[] = '<!DOCTYPE html   328                                 $docTypeParts[] = '<!DOCTYPE html
329                 PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" <> 329     PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
330                 "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';   330     "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';
331                                 break; = 331                                 break;
332                         case 'xhtml_11':   332                         case 'xhtml_11':
333                                 $docTypeParts[] = '<!DOCTYPE html   333                                 $docTypeParts[] = '<!DOCTYPE html
334                 PUBLIC "-//W3C//DTD XHTML 1.1//EN" <> 334      PUBLIC "-//W3C//DTD XHTML 1.1//EN"
335                 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';   335      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
336                                 break; = 336                                 break;
337                         case 'xhtml_2':   337                         case 'xhtml_2':
338                                 $docTypeParts[] = '<!DOCTYPE html   338                                 $docTypeParts[] = '<!DOCTYPE html
339         PUBLIC "-//W3C//DTD XHTML 2.0//EN"   339         PUBLIC "-//W3C//DTD XHTML 2.0//EN"
340         "http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd">';   340         "http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd">';
341                                 break;   341                                 break;
342                         case 'xhtml+rdfa_10':   342                         case 'xhtml+rdfa_10':
343                                 $docTypeParts[] = '<!DOCTYPE html   343                                 $docTypeParts[] = '<!DOCTYPE html
344         PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"   344         PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
345         "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">';   345         "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">';
346                                 break;   346                                 break;
347                         case 'html5':   347                         case 'html5':
348                                 $docTypeParts[] = '<!DOCTYPE html>';   348                                 $docTypeParts[] = '<!DOCTYPE html>';
349                                 if ($xmlDocument) {   349                                 if ($xmlDocument) {
350                                         $pageRenderer->setMetaCharsetTag('<meta charset="|" />');   350                                         $pageRenderer->setMetaCharsetTag('<meta charset="|" />');
351                                 } else {   351                                 } else {
352                                         $pageRenderer->setMetaCharsetTag('<meta charset="|">');   352                                         $pageRenderer->setMetaCharsetTag('<meta charset="|">');
353                                 }   353                                 }
354                                 break;   354                                 break;
355                         case 'none':   355                         case 'none':
356                                 break;   356                                 break;
357                         default:   357                         default:
358                                 $docTypeParts[] = $doctype;   358                                 $docTypeParts[] = $doctype;
359                         }   359                         }
360                 } else {   360                 } else {
361                         $docTypeParts[] = '<!DOCTYPE html>';   361                         $docTypeParts[] = '<!DOCTYPE html>';
362                         if ($xmlDocument){   362                         if ($xmlDocument){
363                                 $pageRenderer->setMetaCharsetTag('<meta charset="|" />');   363                                 $pageRenderer->setMetaCharsetTag('<meta charset="|" />');
364                         } else {   364                         } else {
365                                 $pageRenderer->setMetaCharsetTag('<meta charset="|">');   365                                 $pageRenderer->setMetaCharsetTag('<meta charset="|">');
366                         }   366                         }
367                 }   367                 }
368                 if ($GLOBALS['TSFE']->xhtmlVersion) {   368                 if ($GLOBALS['TSFE']->xhtmlVersion) {
369                         $htmlTagAttributes['xml:lang'] = $htmlLang;   369                         $htmlTagAttributes['xml:lang'] = $htmlLang;
370                 }   370                 }
371                 if ($GLOBALS['TSFE']->xhtmlVersion < 110 || $doctype === 'html5') {   371                 if ($GLOBALS['TSFE']->xhtmlVersion < 110 || $doctype === 'html5') {
372                         $htmlTagAttributes['lang'] = $htmlLang;   372                         $htmlTagAttributes['lang'] = $htmlLang;
373                 }   373                 }
374                 if ($GLOBALS['TSFE']->xhtmlVersion || $doctype === 'html5' && $xmlDocument) {   374                 if ($GLOBALS['TSFE']->xhtmlVersion || $doctype === 'html5' && $xmlDocument) {
375                         // We add this to HTML5 to achieve a slightly better backwards compatibility   375                         // We add this to HTML5 to achieve a slightly better backwards compatibility
376                         $htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';   376                         $htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';
377                         if (is_array($GLOBALS['TSFE']->config['config']['namespaces.'])) {   377                         if (is_array($GLOBALS['TSFE']->config['config']['namespaces.'])) {
378                                 foreach ($GLOBALS['TSFE']->config['config']['namespaces.'] as $prefix => $uri) {   378                                 foreach ($GLOBALS['TSFE']->config['config']['namespaces.'] as $prefix => $uri) {
379                                         // $uri gets htmlspecialchared later   379                                         // $uri gets htmlspecialchared later
380                                         $htmlTagAttributes['xmlns:' . htmlspecialchars($prefix)] = $uri;   380                                         $htmlTagAttributes['xmlns:' . htmlspecialchars($prefix)] = $uri;
381                                 }   381                                 }
382                         }   382                         }
383                 }   383                 }
384                 // Swap XML and doctype order around (for MSIE / Opera standards compliance)   384                 // Swap XML and doctype order around (for MSIE / Opera standards compliance)
385                 if ($GLOBALS['TSFE']->config['config']['doctypeSwitch']) {   385                 if ($GLOBALS['TSFE']->config['config']['doctypeSwitch']) {
386                         $docTypeParts = array_reverse($docTypeParts);   386                         $docTypeParts = array_reverse($docTypeParts);
387                 }   387                 }
388                 // Adding doctype parts:   388                 // Adding doctype parts:
389                 if (count($docTypeParts)) {   389                 if (count($docTypeParts)) {
390                         $pageRenderer->setXmlPrologAndDocType(implode(LF, $docTypeParts));   390                         $pageRenderer->setXmlPrologAndDocType(implode(LF, $docTypeParts));
391                 }   391                 }
392                 // Begin header section:   392                 // Begin header section:
393                 if (strcmp($GLOBALS['TSFE']->config['config']['htmlTag_setParams'], 'none')) {   393                 if (strcmp($GLOBALS['TSFE']->config['config']['htmlTag_setParams'], 'none')) {
394                         $_attr = $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] ? $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] : \TYPO3\CMS\Core\Utility\GeneralUtility::implodeAttributes($htmlTagAttributes);   394                         $_attr = $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] ? $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] : \TYPO3\CMS\Core\Utility\GeneralUtility::implodeAttributes($htmlTagAttributes);
395                 } else {   395                 } else {
396                         $_attr = '';   396                         $_attr = '';
397                 }   397                 }
398                 $htmlTag = '<html' . ($_attr ? ' ' . $_attr : '') . '>';   398                 $htmlTag = '<html' . ($_attr ? ' ' . $_attr : '') . '>';
399                 if (isset($GLOBALS['TSFE']->config['config']['htmlTag_stdWrap.'])) {   399                 if (isset($GLOBALS['TSFE']->config['config']['htmlTag_stdWrap.'])) {
400                         $htmlTag = $GLOBALS['TSFE']->cObj->stdWrap($htmlTag, $GLOBALS['TSFE']->config['config']['htmlTag_stdWrap.']);   400                         $htmlTag = $GLOBALS['TSFE']->cObj->stdWrap($htmlTag, $GLOBALS['TSFE']->config['config']['htmlTag_stdWrap.']);
401                 }   401                 }
402                 $pageRenderer->setHtmlTag($htmlTag);   402                 $pageRenderer->setHtmlTag($htmlTag);
403                 // Head tag:   403                 // Head tag:
404                 $headTag = $GLOBALS['TSFE']->pSetup['headTag'] ? $GLOBALS['TSFE']->pSetup['headTag'] : '<head>';   404                 $headTag = $GLOBALS['TSFE']->pSetup['headTag'] ? $GLOBALS['TSFE']->pSetup['headTag'] : '<head>';
405                 $pageRenderer->setHeadTag($headTag);   405                 $pageRenderer->setHeadTag($headTag);
406                 // Setting charset meta tag:   406                 // Setting charset meta tag:
407                 $pageRenderer->setCharSet($theCharset);   407                 $pageRenderer->setCharSet($theCharset);
408                 $pageRenderer->addInlineComment('        This website is powered by TYPO3 - inspiring people to share!   408                 $pageRenderer->addInlineComment('        This website is powered by TYPO3 - inspiring people to share!
409         TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.   409         TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
410         TYPO3 is copyright ' . TYPO3_copyright_year . ' of Kasper Skaarhoj. Extensions are copyright of their respective owners.   410         TYPO3 is copyright ' . TYPO3_copyright_year . ' of Kasper Skaarhoj. Extensions are copyright of their respective owners.
411         Information and contribution at ' . TYPO3_URL_ORG . '   411         Information and contribution at ' . TYPO3_URL_ORG . '
412 ');   412 ');
413                 if ($GLOBALS['TSFE']->baseUrl) {   413                 if ($GLOBALS['TSFE']->baseUrl) {
414                         $pageRenderer->setBaseUrl($GLOBALS['TSFE']->baseUrl);   414                         $pageRenderer->setBaseUrl($GLOBALS['TSFE']->baseUrl);
415                 }   415                 }
416                 if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {   416                 if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {
417                         $favIcon = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['shortcutIcon']);   417                         $favIcon = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['shortcutIcon']);
418                         $iconMimeType = '';   418                         $iconMimeType = '';
419                         if (function_exists('finfo_open')) {   419                         if (function_exists('finfo_open')) {
420                                 if ($finfo = @finfo_open(FILEINFO_MIME)) {   420                                 if ($finfo = @finfo_open(FILEINFO_MIME)) {
421                                         $iconMimeType = ' type="' . finfo_file($finfo, (PATH_site . $favIcon)) . '"';   421                                         $iconMimeType = ' type="' . finfo_file($finfo, (PATH_site . $favIcon)) . '"';
422                                         finfo_close($finfo);   422                                         finfo_close($finfo);
423                                         $pageRenderer->setIconMimeType($iconMimeType);   423                                         $pageRenderer->setIconMimeType($iconMimeType);
424                                 }   424                                 }
425                         }   425                         }
426                         $pageRenderer->setFavIcon(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $favIcon);   426                         $pageRenderer->setFavIcon(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $favIcon);
427                 }   427                 }
428                 // Including CSS files   428                 // Including CSS files
429                 if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'])) {   429                 if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'])) {
430                         $temp_styleLines = array();   430                         $temp_styleLines = array();
431                         foreach ($GLOBALS['TSFE']->tmpl->setup['plugin.'] as $key => $iCSScode) {   431                         foreach ($GLOBALS['TSFE']->tmpl->setup['plugin.'] as $key => $iCSScode) {
432                                 if (is_array($iCSScode)) {   432                                 if (is_array($iCSScode)) {
433                                         if ($iCSScode['_CSS_DEFAULT_STYLE'] && empty($GLOBALS['TSFE']->config['config']['removeDefaultCss'])) {   433                                         if ($iCSScode['_CSS_DEFAULT_STYLE'] && empty($GLOBALS['TSFE']->config['config']['removeDefaultCss'])) {
434                                                 $temp_styleLines[] = '/* default styles for extension "' . substr($key, 0, -1) . '" */' . LF . $iCSScode['_CSS_DEFAULT_STYLE'];   434                                                 $temp_styleLines[] = '/* default styles for extension "' . substr($key, 0, -1) . '" */' . LF . $iCSScode['_CSS_DEFAULT_STYLE'];
435                                         }   435                                         }
436                                         if ($iCSScode['_CSS_PAGE_STYLE'] && empty($GLOBALS['TSFE']->config['config']['removePageCss'])) {   436                                         if ($iCSScode['_CSS_PAGE_STYLE'] && empty($GLOBALS['TSFE']->config['config']['removePageCss'])) {
437                                                 $temp_styleLines[] = '/* specific page styles for extension "' . substr($key, 0, -1) . '" */' . LF . implode(LF, $iCSScode['_CSS_PAGE_STYLE']);   437                                                 $temp_styleLines[] = '/* specific page styles for extension "' . substr($key, 0, -1) . '" */' . LF . implode(LF, $iCSScode['_CSS_PAGE_STYLE']);
438                                         }   438                                         }
439                                 }   439                                 }
440                         }   440                         }
441                         if (count($temp_styleLines)) {   441                         if (count($temp_styleLines)) {
442                                 if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {   442                                 if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
443                                         $pageRenderer->addCssFile(self::inline2TempFile(implode(LF, $temp_styleLines), 'css'));   443                                         $pageRenderer->addCssFile(self::inline2TempFile(implode(LF, $temp_styleLines), 'css'));
444                                 } else {   444                                 } else {
445                                         $pageRenderer->addCssInlineBlock('TSFEinlineStyle', implode(LF, $temp_styleLines));   445                                         $pageRenderer->addCssInlineBlock('TSFEinlineStyle', implode(LF, $temp_styleLines));
446                                 }   446                                 }
447                         }   447                         }
448                 }   448                 }
449                 if ($GLOBALS['TSFE']->pSetup['stylesheet']) {   449                 if ($GLOBALS['TSFE']->pSetup['stylesheet']) {
450                         $ss = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);   450                         $ss = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);
451                         if ($ss) {   451                         if ($ss) {
452                                 $pageRenderer->addCssFile($ss);   452                                 $pageRenderer->addCssFile($ss);
453                         }   453                         }
454                 }   454                 }
455                 /**********************************************************************/   455                 /**********************************************************************/
456                 /* includeCSS   456                 /* includeCSS
457                 /* config.includeCSS {   457                 /* config.includeCSS {
458                 /*   458                 /*
459                 /* }   459                 /* }
460                 /**********************************************************************/   460                 /**********************************************************************/
461                 if (is_array($GLOBALS['TSFE']->pSetup['includeCSS.'])) {   461                 if (is_array($GLOBALS['TSFE']->pSetup['includeCSS.'])) {
462                         foreach ($GLOBALS['TSFE']->pSetup['includeCSS.'] as $key => $CSSfile) {   462                         foreach ($GLOBALS['TSFE']->pSetup['includeCSS.'] as $key => $CSSfile) {
463                                 if (!is_array($CSSfile)) {   463                                 if (!is_array($CSSfile)) {
464                                         $ss = $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['external'] ? $CSSfile : $GLOBALS['TSFE']->tmpl->getFileName($CSSfile);   464                                         $ss = $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['external'] ? $CSSfile : $GLOBALS['TSFE']->tmpl->getFileName($CSSfile);
465                                         if (isset($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeCSS.'][($key . '.')]['if.'])) {   465                                         if (isset($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeCSS.'][($key . '.')]['if.'])) {
466                                                 continue;   466                                                 continue;
467                                         }   467                                         }
468                                         if ($ss) {   468                                         if ($ss) {
469                                                 if ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['import']) {   469                                                 if ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['import']) {
470                                                         if (!$GLOBALS['TSFE']->pSetup['includeCSS.'][($key . '.')]['external'] && substr($ss, 0, 1) != '/') {   470                                                         if (!$GLOBALS['TSFE']->pSetup['includeCSS.'][($key . '.')]['external'] && substr($ss, 0, 1) != '/') {
471                                                                 // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)   471                                                                 // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
472                                                                 $ss = \TYPO3\CMS\Core\Utility\GeneralUtility::dirname(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;   472                                                                 $ss = \TYPO3\CMS\Core\Utility\GeneralUtility::dirname(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;
473                                                         }   473                                                         }
474                                                         $pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][($key . '.')]['media']) . ';', empty($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, '');   474                                                         $pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][($key . '.')]['media']) . ';', empty($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, '');
475                                                 } else {   475                                                 } else {
476                                                         $pageRenderer->addCssFile($ss, $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['alternate'] ? 'alternate stylesheet' : 'stylesheet', $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] ? $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] : 'all', $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['title'] ? $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['title'] : '', empty($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);   476                                                         $pageRenderer->addCssFile($ss, $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['alternate'] ? 'alternate stylesheet' : 'stylesheet', $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] ? $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] : 'all', $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['title'] ? $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['title'] : '', empty($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);
477                                                 }   477                                                 }
478                                         }   478                                         }
479                                 }   479                                 }
480                         }   480                         }
481                 }   481                 }
482                 // Stylesheets   482                 // Stylesheets
483                 $style = '';   483                 $style = '';
484                 if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE']) {   484                 if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE']) {
485                         $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();   485                         $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
486                         $RTEclasses = $pageTSConfig['RTE.']['classes.'];   486                         $RTEclasses = $pageTSConfig['RTE.']['classes.'];
487                         if (is_array($RTEclasses)) {   487                         if (is_array($RTEclasses)) {
488                                 foreach ($RTEclasses as $RTEclassName => $RTEvalueArray) {   488                                 foreach ($RTEclasses as $RTEclassName => $RTEvalueArray) {
489                                         if ($RTEvalueArray['value']) {   489                                         if ($RTEvalueArray['value']) {
490                                                 $style .= '   490                                                 $style .= '
491 .' . substr($RTEclassName, 0, -1) . ' {' . $RTEvalueArray['value'] . '}';   491 .' . substr($RTEclassName, 0, -1) . ' {' . $RTEvalueArray['value'] . '}';
492                                         }   492                                         }
493                                 }   493                                 }
494                         }   494                         }
495                         if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'])) {   495                         if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'])) {
496                                 $mSOa_tList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', strtoupper($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs']), 1);   496                                 $mSOa_tList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', strtoupper($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs']), 1);
497                                 foreach ($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'] as $mSOa_key => $mSOa_value) {   497                                 foreach ($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'] as $mSOa_key => $mSOa_value) {
498                                         if (!is_array($mSOa_value) && (in_array('*', $mSOa_tList) || in_array($mSOa_key, $mSOa_tList))) {   498                                         if (!is_array($mSOa_value) && (in_array('*', $mSOa_tList) || in_array($mSOa_key, $mSOa_tList))) {
499                                                 $style .= '   499                                                 $style .= '
500 ' . $mSOa_key . ' {' . $mSOa_value . '}';   500 ' . $mSOa_key . ' {' . $mSOa_value . '}';
501                                         }   501                                         }
502                                 }   502                                 }
503                         }   503                         }
504                 }   504                 }
505                 // Setting body tag margins in CSS:   505                 // Setting body tag margins in CSS:
506                 if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {   506                 if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
507                         $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);   507                         $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
508                         $style .= '   508                         $style .= '
509         BODY {margin: ' . $margins . 'px ' . $margins . 'px ' . $margins . 'px ' . $margins . 'px;}';   509         BODY {margin: ' . $margins . 'px ' . $margins . 'px ' . $margins . 'px ' . $margins . 'px;}';
510                 }   510                 }
511                 if ($GLOBALS['TSFE']->pSetup['adminPanelStyles']) {   511                 if ($GLOBALS['TSFE']->pSetup['adminPanelStyles']) {
512                         $style .= '   512                         $style .= '
513     513  
514         /* Default styles for the Admin Panel */   514         /* Default styles for the Admin Panel */
515         TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }   515         TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }
516         TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }   516         TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }
517         TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }   517         TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }
518         TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }   518         TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }
519         TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }   519         TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }
520         TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }   520         TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }
521         TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }   521         TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }
522         TABLE.typo3-editPanel TD { border: 0px; }   522         TABLE.typo3-editPanel TD { border: 0px; }
523                         ';   523                         ';
524                 }   524                 }
525                 // CSS_inlineStyle from TS   525                 // CSS_inlineStyle from TS
526                 $style .= trim($GLOBALS['TSFE']->pSetup['CSS_inlineStyle']);   526                 $style .= trim($GLOBALS['TSFE']->pSetup['CSS_inlineStyle']);
527                 $style .= $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['cssInline.'], 'cssInline.');   527                 $style .= $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['cssInline.'], 'cssInline.');
528                 if (trim($style)) {   528                 if (trim($style)) {
529                         if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {   529                         if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
530                                 $pageRenderer->addCssFile(self::inline2TempFile($style, 'css'));   530                                 $pageRenderer->addCssFile(self::inline2TempFile($style, 'css'));
531                         } else {   531                         } else {
532                                 $pageRenderer->addCssInlineBlock('additionalTSFEInlineStyle', $style);   532                                 $pageRenderer->addCssInlineBlock('additionalTSFEInlineStyle', $style);
533                         }   533                         }
534                 }   534                 }
535                 // Javascript Libraries   535                 // Javascript Libraries
536                 if (is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.'])) {   536                 if (is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.'])) {
537                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG']) {   537                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG']) {
538                                 $pageRenderer->loadSvg();   538                                 $pageRenderer->loadSvg();
539                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG.']['debug']) {   539                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG.']['debug']) {
540                                         $pageRenderer->enableSvgDebug();   540                                         $pageRenderer->enableSvgDebug();
541                                 }   541                                 }
542                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG.']['forceFlash']) {   542                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG.']['forceFlash']) {
543                                         $pageRenderer->svgForceFlash();   543                                         $pageRenderer->svgForceFlash();
544                                 }   544                                 }
545                         }   545                         }
546                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Prototype']) {   546                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Prototype']) {
547                                 $pageRenderer->loadPrototype();   547                                 $pageRenderer->loadPrototype();
548                         }   548                         }
549                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous']) {   549                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous']) {
550                                 $modules = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] : '';   550                                 $modules = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] : '';
551                                 $pageRenderer->loadScriptaculous($modules);   551                                 $pageRenderer->loadScriptaculous($modules);
552                         }   552                         }
553                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore']) {   553                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore']) {
554                                 $pageRenderer->loadExtCore();   554                                 $pageRenderer->loadExtCore();
555                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore.']['debug']) {   555                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore.']['debug']) {
556                                         $pageRenderer->enableExtCoreDebug();   556                                         $pageRenderer->enableExtCoreDebug();
557                                 }   557                                 }
558                         }   558                         }
559                         // Include jQuery into the page renderer   559                         // Include jQuery into the page renderer
560                         if (!empty($GLOBALS['TSFE']->pSetup['javascriptLibs.']['jQuery'])) {   560                         if (!empty($GLOBALS['TSFE']->pSetup['javascriptLibs.']['jQuery'])) {
561                                 $jQueryTS = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['jQuery.'];   561                                 $jQueryTS = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['jQuery.'];
562                                 // Check if version / source is set, if not set variable to "NULL" to use the default of the page renderer   562                                 // Check if version / source is set, if not set variable to "NULL" to use the default of the page renderer
563                                 $version = isset($jQueryTS['version']) ? $jQueryTS['version'] : NULL;   563                                 $version = isset($jQueryTS['version']) ? $jQueryTS['version'] : NULL;
564                                 $source = isset($jQueryTS['source']) ? $jQueryTS['source'] : NULL;   564                                 $source = isset($jQueryTS['source']) ? $jQueryTS['source'] : NULL;
565                                 // When "noConflict" is not set or "1" enable the default jQuery noConflict mode, otherwise disable the namespace   565                                 // When "noConflict" is not set or "1" enable the default jQuery noConflict mode, otherwise disable the namespace
566                                 if (!isset($jQueryTS['noConflict']) || !empty($jQueryTS['noConflict'])) {   566                                 if (!isset($jQueryTS['noConflict']) || !empty($jQueryTS['noConflict'])) {
567                                         // Set namespace to the "noConflict.namespace" value if "noConflict.namespace" has a value   567                                         // Set namespace to the "noConflict.namespace" value if "noConflict.namespace" has a value
568                                         if (!empty($jQueryTS['noConflict.']['namespace'])) {   568                                         if (!empty($jQueryTS['noConflict.']['namespace'])) {
569                                                 $namespace = $jQueryTS['noConflict.']['namespace'];   569                                                 $namespace = $jQueryTS['noConflict.']['namespace'];
570                                         } else {   570                                         } else {
571                                                 $namespace = \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT;   571                                                 $namespace = \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT;
572                                         }   572                                         }
573                                 } else {   573                                 } else {
574                                         $namespace = \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_NAMESPACE_NONE;   574                                         $namespace = \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_NAMESPACE_NONE;
575                                 }   575                                 }
576                                 $pageRenderer->loadJQuery($version, $source, $namespace);   576                                 $pageRenderer->loadJQuery($version, $source, $namespace);
577                         }   577                         }
578                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs']) {   578                         if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs']) {
579                                 $css = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['css'] ? TRUE : FALSE;   579                                 $css = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['css'] ? TRUE : FALSE;
580                                 $theme = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['theme'] ? TRUE : FALSE;   580                                 $theme = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['theme'] ? TRUE : FALSE;
581                                 $adapter = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] : '';   581                                 $adapter = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] : '';
582                                 $pageRenderer->loadExtJs($css, $theme, $adapter);   582                                 $pageRenderer->loadExtJs($css, $theme, $adapter);
583                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['debug']) {   583                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['debug']) {
584                                         $pageRenderer->enableExtJsDebug();   584                                         $pageRenderer->enableExtJsDebug();
585                                 }   585                                 }
586                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['quickTips']) {   586                                 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['quickTips']) {
587                                         $pageRenderer->enableExtJSQuickTips();   587                                         $pageRenderer->enableExtJSQuickTips();
588                                 }   588                                 }
589                         }   589                         }
590                 }   590                 }
591                 // JavaScript library files   591                 // JavaScript library files
592                 if (is_array($GLOBALS['TSFE']->pSetup['includeJSlibs.'])) {   592                 if (is_array($GLOBALS['TSFE']->pSetup['includeJSlibs.'])) {
593                         foreach ($GLOBALS['TSFE']->pSetup['includeJSlibs.'] as $key => $JSfile) {   593                         foreach ($GLOBALS['TSFE']->pSetup['includeJSlibs.'] as $key => $JSfile) {
594                                 if (!is_array($JSfile)) {   594                                 if (!is_array($JSfile)) {
595                                         if (isset($GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeJSlibs.'][($key . '.')]['if.'])) {   595                                         if (isset($GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeJSlibs.'][($key . '.')]['if.'])) {
596                                                 continue;   596                                                 continue;
597                                         }   597                                         }
598                                         $ss = $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);   598                                         $ss = $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
599                                         if ($ss) {   599                                         if ($ss) {
600                                                 $type = $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['type'];   600                                                 $type = $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['type'];
601                                                 if (!$type) {   601                                                 if (!$type) {
602                                                         $type = 'text/javascript';   602                                                         $type = 'text/javascript';
603                                                 }   603                                                 }
604                                                 $pageRenderer->addJsLibrary($key, $ss, $type, empty($GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);   604                                                 $pageRenderer->addJsLibrary($key, $ss, $type, empty($GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);
605                                         }   605                                         }
606                                 }   606                                 }
607                         }   607                         }
608                 }   608                 }
609                 if (is_array($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'])) {   609                 if (is_array($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'])) {
610                         foreach ($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'] as $key => $JSfile) {   610                         foreach ($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'] as $key => $JSfile) {
611                                 if (!is_array($JSfile)) {   611                                 if (!is_array($JSfile)) {
612                                         if (isset($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][($key . '.')]['if.'])) {   612                                         if (isset($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][($key . '.')]['if.'])) {
613                                                 continue;   613                                                 continue;
614                                         }   614                                         }
615                                         $ss = $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);   615                                         $ss = $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
616                                         if ($ss) {   616                                         if ($ss) {
617                                                 $type = $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['type'];   617                                                 $type = $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['type'];
618                                                 if (!$type) {   618                                                 if (!$type) {
619                                                         $type = 'text/javascript';   619                                                         $type = 'text/javascript';
620                                                 }   620                                                 }
621                                                 $pageRenderer->addJsFooterLibrary($key, $ss, $type, empty($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);   621                                                 $pageRenderer->addJsFooterLibrary($key, $ss, $type, empty($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);
622                                         }   622                                         }
623                                 }   623                                 }
624                         }   624                         }
625                 }   625                 }
626                 // JavaScript files   626                 // JavaScript files
627                 if (is_array($GLOBALS['TSFE']->pSetup['includeJS.'])) {   627                 if (is_array($GLOBALS['TSFE']->pSetup['includeJS.'])) {
628                         foreach ($GLOBALS['TSFE']->pSetup['includeJS.'] as $key => $JSfile) {   628                         foreach ($GLOBALS['TSFE']->pSetup['includeJS.'] as $key => $JSfile) {
629                                 if (!is_array($JSfile)) {   629                                 if (!is_array($JSfile)) {
630                                         if (isset($GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeJS.'][($key . '.')]['if.'])) {   630                                         if (isset($GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeJS.'][($key . '.')]['if.'])) {
631                                                 continue;   631                                                 continue;
632                                         }   632                                         }
633                                         $ss = $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);   633                                         $ss = $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
634                                         if ($ss) {   634                                         if ($ss) {
635                                                 $type = $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['type'];   635                                                 $type = $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['type'];
636                                                 if (!$type) {   636                                                 if (!$type) {
637                                                         $type = 'text/javascript';   637                                                         $type = 'text/javascript';
638                                                 }   638                                                 }
639                                                 $pageRenderer->addJsFile($ss, $type, empty($GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);   639                                                 $pageRenderer->addJsFile($ss, $type, empty($GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);
640                                         }   640                                         }
641                                 }   641                                 }
642                         }   642                         }
643                 }   643                 }
644                 if (is_array($GLOBALS['TSFE']->pSetup['includeJSFooter.'])) {   644                 if (is_array($GLOBALS['TSFE']->pSetup['includeJSFooter.'])) {
645                         foreach ($GLOBALS['TSFE']->pSetup['includeJSFooter.'] as $key => $JSfile) {   645                         foreach ($GLOBALS['TSFE']->pSetup['includeJSFooter.'] as $key => $JSfile) {
646                                 if (!is_array($JSfile)) {   646                                 if (!is_array($JSfile)) {
647                                         if (isset($GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeJSFooter.'][($key . '.')]['if.'])) {   647                                         if (isset($GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['if.']) && !$GLOBALS['TSFE']->cObj->checkIf($GLOBALS['TSFE']->pSetup['includeJSFooter.'][($key . '.')]['if.'])) {
648                                                 continue;   648                                                 continue;
649                                         }   649                                         }
650                                         $ss = $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);   650                                         $ss = $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
651                                         if ($ss) {   651                                         if ($ss) {
652                                                 $type = $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['type'];   652                                                 $type = $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['type'];
653                                                 if (!$type) {   653                                                 if (!$type) {
654                                                         $type = 'text/javascript';   654                                                         $type = 'text/javascript';
655                                                 }   655                                                 }
656                                                 $pageRenderer->addJsFooterFile($ss, $type, empty($GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);   656                                                 $pageRenderer->addJsFooterFile($ss, $type, empty($GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['disableCompression']), $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);
657                                         }   657                                         }
658                                 }   658                                 }
659                         }   659                         }
660                 }   660                 }
661                 // Headerdata   661                 // Headerdata
662                 if (is_array($GLOBALS['TSFE']->pSetup['headerData.'])) {   662                 if (is_array($GLOBALS['TSFE']->pSetup['headerData.'])) {
663                         $pageRenderer->addHeaderData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'], 'headerData.'));   663                         $pageRenderer->addHeaderData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'], 'headerData.'));
664                 }   664                 }
665                 // Footerdata   665                 // Footerdata
666                 if (is_array($GLOBALS['TSFE']->pSetup['footerData.'])) {   666                 if (is_array($GLOBALS['TSFE']->pSetup['footerData.'])) {
667                         $pageRenderer->addFooterData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['footerData.'], 'footerData.'));   667                         $pageRenderer->addFooterData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['footerData.'], 'footerData.'));
668                 }   668                 }
    -+ 669                 // Title
      670                 $titleTagContent = $GLOBALS['TSFE']->tmpl->printTitle($GLOBALS['TSFE']->altPageTitle ? $GLOBALS['TSFE']->altPageTitle : $GLOBALS['TSFE']->page['title'], $GLOBALS['TSFE']->config['config']['noPageTitle'], $GLOBALS['TSFE']->config['config']['pageTitleFirst']);
      671                 if ($GLOBALS['TSFE']->config['config']['titleTagFunction']) {
      672                         $titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction($GLOBALS['TSFE']->config['config']['titleTagFunction'], array(), $titleTagContent);
      673                 }
      674                 if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config['config']['noPageTitle']) !== 2) {
      675                         $pageRenderer->setTitle($titleTagContent);
      676                 }
669                 // Add ending slash only to documents rendered as xhtml = 677                 // Add ending slash only to documents rendered as xhtml
670                 $endingSlash = $GLOBALS['TSFE']->xhtmlVersion ? ' /' : '';   678                 $endingSlash = $GLOBALS['TSFE']->xhtmlVersion ? ' /' : '';
671                 $pageRenderer->addMetaTag('<meta name="generator" content="TYPO3 ' . TYPO3_branch . ' CMS"' . $endingSlash . '>');   679                 $pageRenderer->addMetaTag('<meta name="generator" content="TYPO3 ' . TYPO3_branch . ' CMS"' . $endingSlash . '>');
672                 $conf = $GLOBALS['TSFE']->pSetup['meta.'];   680                 $conf = $GLOBALS['TSFE']->pSetup['meta.'];
673                 if (is_array($conf)) {   681                 if (is_array($conf)) {
674                         foreach ($conf as $theKey => $theValue) {   682                         foreach ($conf as $theKey => $theValue) {
675                                 // Only if 1) the property is set but not the value itself, 2) the value and/or any property   683                                 // Only if 1) the property is set but not the value itself, 2) the value and/or any property
676                                 if (!strstr($theKey, '.') || !isset($conf[substr($theKey, 0, -1)])) {   684                                 if (!strstr($theKey, '.') || !isset($conf[substr($theKey, 0, -1)])) {
677                                         if (strstr($theKey, '.')) {   685                                         if (strstr($theKey, '.')) {
678                                                 $theKey = substr($theKey, 0, -1);   686                                                 $theKey = substr($theKey, 0, -1);
679                                         }   687                                         }
680                                         $val = $GLOBALS['TSFE']->cObj->stdWrap($conf[$theKey], $conf[$theKey . '.']);   688                                         $val = $GLOBALS['TSFE']->cObj->stdWrap($conf[$theKey], $conf[$theKey . '.']);
681                                         $key = $theKey;   689                                         $key = $theKey;
682                                         if (trim($val)) {   690                                         if (trim($val)) {
683                                                 $a = 'name';   691                                                 $a = 'name';
684                                                 if (strtolower($key) === 'refresh' || !empty($conf[($theKey . '.')]['httpEquivalent'])) {   692                                                 if (strtolower($key) === 'refresh' || !empty($conf[($theKey . '.')]['httpEquivalent'])) {
685                                                         $a = 'http-equiv';   693                                                         $a = 'http-equiv';
686                                                 }   694                                                 }
687                                                 $pageRenderer->addMetaTag('<meta ' . $a . '="' . $key . '" content="' . htmlspecialchars(trim($val)) . '"' . $endingSlash . '>');   695                                                 $pageRenderer->addMetaTag('<meta ' . $a . '="' . $key . '" content="' . htmlspecialchars(trim($val)) . '"' . $endingSlash . '>');
688                                         }   696                                         }
689                                 }   697                                 }
690                         }   698                         }
691                 }   699                 }
692                 unset($GLOBALS['TSFE']->additionalHeaderData['JSCode']);   700                 unset($GLOBALS['TSFE']->additionalHeaderData['JSCode']);
693                 unset($GLOBALS['TSFE']->additionalHeaderData['JSImgCode']);   701                 unset($GLOBALS['TSFE']->additionalHeaderData['JSImgCode']);
694                 if (is_array($GLOBALS['TSFE']->config['INTincScript'])) {   702                 if (is_array($GLOBALS['TSFE']->config['INTincScript'])) {
695                         // Storing the JSCode and JSImgCode vars...   703                         // Storing the JSCode and JSImgCode vars...
696                         $GLOBALS['TSFE']->additionalHeaderData['JSCode'] = $GLOBALS['TSFE']->JSCode;   704                         $GLOBALS['TSFE']->additionalHeaderData['JSCode'] = $GLOBALS['TSFE']->JSCode;
697                         $GLOBALS['TSFE']->additionalHeaderData['JSImgCode'] = $GLOBALS['TSFE']->JSImgCode;   705                         $GLOBALS['TSFE']->additionalHeaderData['JSImgCode'] = $GLOBALS['TSFE']->JSImgCode;
698                         $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] = $GLOBALS['TSFE']->uniqueHash();   706                         $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] = $GLOBALS['TSFE']->uniqueHash();
699                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalHeaderData'] = $GLOBALS['TSFE']->additionalHeaderData;   707                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalHeaderData'] = $GLOBALS['TSFE']->additionalHeaderData;
700                         // Storing the header-data array   708                         // Storing the header-data array
701                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalFooterData'] = $GLOBALS['TSFE']->additionalFooterData;   709                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalFooterData'] = $GLOBALS['TSFE']->additionalFooterData;
702                         // Storing the footer-data array   710                         // Storing the footer-data array
703                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalJavaScript'] = $GLOBALS['TSFE']->additionalJavaScript;   711                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalJavaScript'] = $GLOBALS['TSFE']->additionalJavaScript;
704                         // Storing the JS-data array   712                         // Storing the JS-data array
705                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalCSS'] = $GLOBALS['TSFE']->additionalCSS;   713                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalCSS'] = $GLOBALS['TSFE']->additionalCSS;
706                         // Storing the Style-data array   714                         // Storing the Style-data array
707                         $GLOBALS['TSFE']->additionalHeaderData = array('<!--HD_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->');   715                         $GLOBALS['TSFE']->additionalHeaderData = array('<!--HD_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->');
708                         // Clearing the array   716                         // Clearing the array
709                         $GLOBALS['TSFE']->additionalFooterData = array('<!--FD_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->');   717                         $GLOBALS['TSFE']->additionalFooterData = array('<!--FD_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->');
710                         // Clearing the array   718                         // Clearing the array
711                         $GLOBALS['TSFE']->divSection .= '<!--TDS_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->';   719                         $GLOBALS['TSFE']->divSection .= '<!--TDS_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->';
712                 } else {   720                 } else {
713                         $GLOBALS['TSFE']->INTincScript_loadJSCode();   721                         $GLOBALS['TSFE']->INTincScript_loadJSCode();
714                 }   722                 }
715                 $JSef = self::JSeventFunctions();   723                 $JSef = self::JSeventFunctions();
716                 $scriptJsCode = $JSef[0];   724                 $scriptJsCode = $JSef[0];
717     725  
718                 if ($GLOBALS['TSFE']->spamProtectEmailAddresses && $GLOBALS['TSFE']->spamProtectEmailAddresses !== 'ascii') {   726                 if ($GLOBALS['TSFE']->spamProtectEmailAddresses && $GLOBALS['TSFE']->spamProtectEmailAddresses !== 'ascii') {
719                         $scriptJsCode .= '   727                         $scriptJsCode .= '
720                         // decrypt helper function   728                         // decrypt helper function
721                 function decryptCharcode(n,start,end,offset) {   729                 function decryptCharcode(n,start,end,offset) {
722                         n = n + offset;   730                         n = n + offset;
723                         if (offset > 0 && n > end) {   731                         if (offset > 0 && n > end) {
724                                 n = start + (n - end - 1);   732                                 n = start + (n - end - 1);
725                         } else if (offset < 0 && n < start) {   733                         } else if (offset < 0 && n < start) {
726                                 n = end - (start - n - 1);   734                                 n = end - (start - n - 1);
727                         }   735                         }
728                         return String.fromCharCode(n);   736                         return String.fromCharCode(n);
729                 }   737                 }
730                         // decrypt string   738                         // decrypt string
731                 function decryptString(enc,offset) {   739                 function decryptString(enc,offset) {
732                         var dec = "";   740                         var dec = "";
733                         var len = enc.length;   741                         var len = enc.length;
734                         for(var i=0; i < len; i++) {   742                         for(var i=0; i < len; i++) {
735                                 var n = enc.charCodeAt(i);   743                                 var n = enc.charCodeAt(i);
736                                 if (n >= 0x2B && n <= 0x3A) {   744                                 if (n >= 0x2B && n <= 0x3A) {
737                                         dec += decryptCharcode(n,0x2B,0x3A,offset);        // 0-9 . , - + / :   745                                         dec += decryptCharcode(n,0x2B,0x3A,offset);        // 0-9 . , - + / :
738                                 } else if (n >= 0x40 && n <= 0x5A) {   746                                 } else if (n >= 0x40 && n <= 0x5A) {
739                                         dec += decryptCharcode(n,0x40,0x5A,offset);        // A-Z @   747                                         dec += decryptCharcode(n,0x40,0x5A,offset);        // A-Z @
740                                 } else if (n >= 0x61 && n <= 0x7A) {   748                                 } else if (n >= 0x61 && n <= 0x7A) {
741                                         dec += decryptCharcode(n,0x61,0x7A,offset);        // a-z   749                                         dec += decryptCharcode(n,0x61,0x7A,offset);        // a-z
742                                 } else {   750                                 } else {
743                                         dec += enc.charAt(i);   751                                         dec += enc.charAt(i);
744                                 }   752                                 }
745                         }   753                         }
746                         return dec;   754                         return dec;
747                 }   755                 }
748                         // decrypt spam-protected emails   756                         // decrypt spam-protected emails
749                 function linkTo_UnCryptMailto(s) {   757                 function linkTo_UnCryptMailto(s) {
750                         location.href = decryptString(s,' . $GLOBALS['TSFE']->spamProtectEmailAddresses * -1 . ');   758                         location.href = decryptString(s,' . $GLOBALS['TSFE']->spamProtectEmailAddresses * -1 . ');
751                 }   759                 }
752                 ';   760                 ';
753                 }   761                 }
754                 // Add inline JS   762                 // Add inline JS
755                 $inlineJS = '';   763                 $inlineJS = '';
756                 // defined in php   764                 // defined in php
757                 if (is_array($GLOBALS['TSFE']->inlineJS)) {   765                 if (is_array($GLOBALS['TSFE']->inlineJS)) {
758                         foreach ($GLOBALS['TSFE']->inlineJS as $key => $val) {   766                         foreach ($GLOBALS['TSFE']->inlineJS as $key => $val) {
759                                 if (!is_array($val)) {   767                                 if (!is_array($val)) {
760                                         $inlineJS .= LF . $val . LF;   768                                         $inlineJS .= LF . $val . LF;
761                                 }   769                                 }
762                         }   770                         }
763                 }   771                 }
764                 // defined in TS with page.inlineJS   772                 // defined in TS with page.inlineJS
765                 // Javascript inline code   773                 // Javascript inline code
766                 $inline = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['jsInline.'], 'jsInline.');   774                 $inline = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['jsInline.'], 'jsInline.');
767                 if ($inline) {   775                 if ($inline) {
768                         $inlineJS .= LF . $inline . LF;   776                         $inlineJS .= LF . $inline . LF;
769                 }   777                 }
770                 // Javascript inline code for Footer   778                 // Javascript inline code for Footer
771                 $inlineFooterJs = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['jsFooterInline.'], 'jsFooterInline.');   779                 $inlineFooterJs = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['jsFooterInline.'], 'jsFooterInline.');
772                 // Should minify?   780                 // Should minify?
773                 if ($GLOBALS['TSFE']->config['config']['compressJs']) {   781                 if ($GLOBALS['TSFE']->config['config']['compressJs']) {
774                         $pageRenderer->enableCompressJavascript();   782                         $pageRenderer->enableCompressJavascript();
775                         $minifyErrorScript = ($minifyErrorInline = '');   783                         $minifyErrorScript = ($minifyErrorInline = '');
776                         $scriptJsCode = \TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript($scriptJsCode, $minifyErrorScript);   784                         $scriptJsCode = \TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript($scriptJsCode, $minifyErrorScript);
777                         if ($minifyErrorScript) {   785                         if ($minifyErrorScript) {
778                                 $GLOBALS['TT']->setTSlogMessage($minifyErrorScript, 3);   786                                 $GLOBALS['TT']->setTSlogMessage($minifyErrorScript, 3);
779                         }   787                         }
780                         if ($inlineJS) {   788                         if ($inlineJS) {
781                                 $inlineJS = \TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript($inlineJS, $minifyErrorInline);   789                                 $inlineJS = \TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript($inlineJS, $minifyErrorInline);
782                                 if ($minifyErrorInline) {   790                                 if ($minifyErrorInline) {
783                                         $GLOBALS['TT']->setTSlogMessage($minifyErrorInline, 3);   791                                         $GLOBALS['TT']->setTSlogMessage($minifyErrorInline, 3);
784                                 }   792                                 }
785                         }   793                         }
786                         if ($inlineFooterJs) {   794                         if ($inlineFooterJs) {
787                                 $inlineFooterJs = \TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript($inlineFooterJs, $minifyErrorInline);   795                                 $inlineFooterJs = \TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript($inlineFooterJs, $minifyErrorInline);
788                                 if ($minifyErrorInline) {   796                                 if ($minifyErrorInline) {
789                                         $GLOBALS['TT']->setTSlogMessage($minifyErrorInline, 3);   797                                         $GLOBALS['TT']->setTSlogMessage($minifyErrorInline, 3);
790                                 }   798                                 }
791                         }   799                         }
792                 }   800                 }
793                 if (!$GLOBALS['TSFE']->config['config']['removeDefaultJS']) {   801                 if (!$GLOBALS['TSFE']->config['config']['removeDefaultJS']) {
794                         // inlude default and inlineJS   802                         // inlude default and inlineJS
795                         if ($scriptJsCode) {   803                         if ($scriptJsCode) {
796                                 $pageRenderer->addJsInlineCode('_scriptCode', $scriptJsCode, $GLOBALS['TSFE']->config['config']['compressJs']);   804                                 $pageRenderer->addJsInlineCode('_scriptCode', $scriptJsCode, $GLOBALS['TSFE']->config['config']['compressJs']);
797                         }   805                         }
798                         if ($inlineJS) {   806                         if ($inlineJS) {
799                                 $pageRenderer->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['compressJs']);   807                                 $pageRenderer->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['compressJs']);
800                         }   808                         }
801                         if ($inlineFooterJs) {   809                         if ($inlineFooterJs) {
802                                 $pageRenderer->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['compressJs']);   810                                 $pageRenderer->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['compressJs']);
803                         }   811                         }
804                 } elseif ($GLOBALS['TSFE']->config['config']['removeDefaultJS'] === 'external') {   812                 } elseif ($GLOBALS['TSFE']->config['config']['removeDefaultJS'] === 'external') {
805                         /*   813                         /*
806                          * This keeps inlineJS from *_INT Objects from being moved to external files.   814                          * This keeps inlineJS from *_INT Objects from being moved to external files.
807                          * At this point in frontend rendering *_INT Objects only have placeholders instead   815                          * At this point in frontend rendering *_INT Objects only have placeholders instead
808                          * of actual content so moving these placeholders to external files would   816                          * of actual content so moving these placeholders to external files would
809                          *     a) break the JS file (syntax errors due to the placeholders)   817                          *     a) break the JS file (syntax errors due to the placeholders)
810                          *     b) the needed JS would never get included to the page   818                          *     b) the needed JS would never get included to the page
811                          * Therefore inlineJS from *_INT Objects must not be moved to external files but   819                          * Therefore inlineJS from *_INT Objects must not be moved to external files but
812                          * kept internal.   820                          * kept internal.
813                          */   821                          */
814                         $inlineJSint = '';   822                         $inlineJSint = '';
815                         self::stripIntObjectPlaceholder($inlineJS, $inlineJSint);   823                         self::stripIntObjectPlaceholder($inlineJS, $inlineJSint);
816                         if ($inlineJSint) {   824                         if ($inlineJSint) {
817                                 $pageRenderer->addJsInlineCode('TS_inlineJSint', $inlineJSint, $GLOBALS['TSFE']->config['config']['compressJs']);   825                                 $pageRenderer->addJsInlineCode('TS_inlineJSint', $inlineJSint, $GLOBALS['TSFE']->config['config']['compressJs']);
818                         }   826                         }
819                         if (trim($scriptJsCode . $inlineJS)) {   827                         if (trim($scriptJsCode . $inlineJS)) {
820                                 $pageRenderer->addJsFile(self::inline2TempFile($scriptJsCode . $inlineJS, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['compressJs']);   828                                 $pageRenderer->addJsFile(self::inline2TempFile($scriptJsCode . $inlineJS, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['compressJs']);
821                         }   829                         }
822                         if ($inlineFooterJs) {   830                         if ($inlineFooterJs) {
823                                 $inlineFooterJSint = '';   831                                 $inlineFooterJSint = '';
824                                 self::stripIntObjectPlaceholder($inlineFooterJs, $inlineFooterJSint);   832                                 self::stripIntObjectPlaceholder($inlineFooterJs, $inlineFooterJSint);
825                                 if ($inlineFooterJSint) {   833                                 if ($inlineFooterJSint) {
826                                         $pageRenderer->addJsFooterInlineCode('TS_inlineFooterJSint', $inlineFooterJSint, $GLOBALS['TSFE']->config['config']['compressJs']);   834                                         $pageRenderer->addJsFooterInlineCode('TS_inlineFooterJSint', $inlineFooterJSint, $GLOBALS['TSFE']->config['config']['compressJs']);
827                                 }   835                                 }
828                                 $pageRenderer->addJsFooterFile(self::inline2TempFile($inlineFooterJs, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['compressJs']);   836                                 $pageRenderer->addJsFooterFile(self::inline2TempFile($inlineFooterJs, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['compressJs']);
829                         }   837                         }
830                 } else {   838                 } else {
831                         // Include only inlineJS   839                         // Include only inlineJS
832                         if ($inlineJS) {   840                         if ($inlineJS) {
833                                 $pageRenderer->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['compressJs']);   841                                 $pageRenderer->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['compressJs']);
834                         }   842                         }
835                         if ($inlineFooterJs) {   843                         if ($inlineFooterJs) {
836                                 $pageRenderer->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['compressJs']);   844                                 $pageRenderer->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['compressJs']);
837                         }   845                         }
838                 }   846                 }
839                 // ExtJS specific code   847                 // ExtJS specific code
840                 if (is_array($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.'])) {   848                 if (is_array($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.'])) {
841                         $pageRenderer->addInlineLanguageLabelArray($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.']);   849                         $pageRenderer->addInlineLanguageLabelArray($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.']);
842                 }   850                 }
843                 if (is_array($GLOBALS['TSFE']->pSetup['inlineSettings.'])) {   851                 if (is_array($GLOBALS['TSFE']->pSetup['inlineSettings.'])) {
844                         $pageRenderer->addInlineSettingArray('TS', $GLOBALS['TSFE']->pSetup['inlineSettings.']);   852                         $pageRenderer->addInlineSettingArray('TS', $GLOBALS['TSFE']->pSetup['inlineSettings.']);
845                 }   853                 }
846                 if (is_array($GLOBALS['TSFE']->pSetup['extOnReady.'])) {   854                 if (is_array($GLOBALS['TSFE']->pSetup['extOnReady.'])) {
847                         $pageRenderer->addExtOnReadyCode($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['extOnReady.'], 'extOnReady.'));   855                         $pageRenderer->addExtOnReadyCode($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['extOnReady.'], 'extOnReady.'));
848                 }   856                 }
849                 // Compression and concatenate settings   857                 // Compression and concatenate settings
850                 if ($GLOBALS['TSFE']->config['config']['compressCss']) {   858                 if ($GLOBALS['TSFE']->config['config']['compressCss']) {
851                         $pageRenderer->enableCompressCss();   859                         $pageRenderer->enableCompressCss();
852                 }   860                 }
853                 if ($GLOBALS['TSFE']->config['config']['compressJs']) {   861                 if ($GLOBALS['TSFE']->config['config']['compressJs']) {
854                         $pageRenderer->enableCompressJavascript();   862                         $pageRenderer->enableCompressJavascript();
855                 }   863                 }
856                 if ($GLOBALS['TSFE']->config['config']['concatenateCss']) {   864                 if ($GLOBALS['TSFE']->config['config']['concatenateCss']) {
857                         $pageRenderer->enableConcatenateCss();   865                         $pageRenderer->enableConcatenateCss();
858                 }   866                 }
859                 if ($GLOBALS['TSFE']->config['config']['concatenateJs']) {   867                 if ($GLOBALS['TSFE']->config['config']['concatenateJs']) {
860                         $pageRenderer->enableConcatenateJavascript();   868                         $pageRenderer->enableConcatenateJavascript();
861                 }   869                 }
862                 // Backward compatibility for old configuration   870                 // Backward compatibility for old configuration
863                 if ($GLOBALS['TSFE']->config['config']['concatenateJsAndCss']) {   871                 if ($GLOBALS['TSFE']->config['config']['concatenateJsAndCss']) {
864                         $pageRenderer->enableConcatenateFiles();   872                         $pageRenderer->enableConcatenateFiles();
865                 }   873                 }
866                 // Add header data block   874                 // Add header data block
867                 if ($GLOBALS['TSFE']->additionalHeaderData) {   875                 if ($GLOBALS['TSFE']->additionalHeaderData) {
868                         $pageRenderer->addHeaderData(implode(LF, $GLOBALS['TSFE']->additionalHeaderData));   876                         $pageRenderer->addHeaderData(implode(LF, $GLOBALS['TSFE']->additionalHeaderData));
869                 }   877                 }
870                 // Add footer data block   878                 // Add footer data block
871                 if ($GLOBALS['TSFE']->additionalFooterData) {   879                 if ($GLOBALS['TSFE']->additionalFooterData) {
872                         $pageRenderer->addFooterData(implode(LF, $GLOBALS['TSFE']->additionalFooterData));   880                         $pageRenderer->addFooterData(implode(LF, $GLOBALS['TSFE']->additionalFooterData));
873                 }   881                 }
874                 // Header complete, now add content   882                 // Header complete, now add content
875                 if ($GLOBALS['TSFE']->pSetup['frameSet.']) {   883                 if ($GLOBALS['TSFE']->pSetup['frameSet.']) {
876                         $fs = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\FramesetRenderer');   884                         $fs = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\FramesetRenderer');
877                         $pageRenderer->addBodyContent($fs->make($GLOBALS['TSFE']->pSetup['frameSet.']));   885                         $pageRenderer->addBodyContent($fs->make($GLOBALS['TSFE']->pSetup['frameSet.']));
878                         $pageRenderer->addBodyContent(LF . '<noframes>' . LF);   886                         $pageRenderer->addBodyContent(LF . '<noframes>' . LF);
879                 }   887                 }
880                 // Bodytag:   888                 // Bodytag:
881                 if ($GLOBALS['TSFE']->config['config']['disableBodyTag']) {   889                 if ($GLOBALS['TSFE']->config['config']['disableBodyTag']) {
882                         $bodyTag = '';   890                         $bodyTag = '';
883                 } else {   891                 } else {
884                         $defBT = $GLOBALS['TSFE']->pSetup['bodyTagCObject'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($GLOBALS['TSFE']->pSetup['bodyTagCObject'], $GLOBALS['TSFE']->pSetup['bodyTagCObject.'], 'bodyTagCObject') : '';   892                         $defBT = $GLOBALS['TSFE']->pSetup['bodyTagCObject'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($GLOBALS['TSFE']->pSetup['bodyTagCObject'], $GLOBALS['TSFE']->pSetup['bodyTagCObject.'], 'bodyTagCObject') : '';
885                         if (!$defBT) {   893                         if (!$defBT) {
886                                 $defBT = $GLOBALS['TSFE']->defaultBodyTag;   894                                 $defBT = $GLOBALS['TSFE']->defaultBodyTag;
887                         }   895                         }
888                         $bodyTag = $GLOBALS['TSFE']->pSetup['bodyTag'] ? $GLOBALS['TSFE']->pSetup['bodyTag'] : $defBT;   896                         $bodyTag = $GLOBALS['TSFE']->pSetup['bodyTag'] ? $GLOBALS['TSFE']->pSetup['bodyTag'] : $defBT;
889                         if ($bgImg = $GLOBALS['TSFE']->cObj->getImgResource($GLOBALS['TSFE']->pSetup['bgImg'], $GLOBALS['TSFE']->pSetup['bgImg.'])) {   897                         if ($bgImg = $GLOBALS['TSFE']->cObj->getImgResource($GLOBALS['TSFE']->pSetup['bgImg'], $GLOBALS['TSFE']->pSetup['bgImg.'])) {
890                                 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' background="' . $GLOBALS['TSFE']->absRefPrefix . $bgImg[3] . '">';   898                                 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' background="' . $GLOBALS['TSFE']->absRefPrefix . $bgImg[3] . '">';
891                         }   899                         }
892                         if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins'])) {   900                         if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins'])) {
893                                 $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);   901                                 $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
894                                 if ($GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {   902                                 if ($GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
895     903  
896                                 } else {   904                                 } else {
897                                         $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' leftmargin="' . $margins . '" topmargin="' . $margins . '" marginwidth="' . $margins . '" marginheight="' . $margins . '">';   905                                         $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' leftmargin="' . $margins . '" topmargin="' . $margins . '" marginwidth="' . $margins . '" marginheight="' . $margins . '">';
898                                 }   906                                 }
899                         }   907                         }
900                         if (trim($GLOBALS['TSFE']->pSetup['bodyTagAdd'])) {   908                         if (trim($GLOBALS['TSFE']->pSetup['bodyTagAdd'])) {
901                                 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']) . '>';   909                                 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']) . '>';
902                         }   910                         }
903                         // Event functions   911                         // Event functions
904                         if (count($JSef[1])) {   912                         if (count($JSef[1])) {
905                                 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim(implode(' ', $JSef[1])) . '>';   913                                 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim(implode(' ', $JSef[1])) . '>';
906                         }   914                         }
907                 }   915                 }
908                 $pageRenderer->addBodyContent(LF . $bodyTag);   916                 $pageRenderer->addBodyContent(LF . $bodyTag);
909                 // Div-sections   917                 // Div-sections
910                 if ($GLOBALS['TSFE']->divSection) {   918                 if ($GLOBALS['TSFE']->divSection) {
911                         $pageRenderer->addBodyContent(LF . $GLOBALS['TSFE']->divSection);   919                         $pageRenderer->addBodyContent(LF . $GLOBALS['TSFE']->divSection);
912                 }   920                 }
913                 // Page content   921                 // Page content
914                 $pageRenderer->addBodyContent(LF . $pageContent);   922                 $pageRenderer->addBodyContent(LF . $pageContent);
915                 if (!empty($GLOBALS['TSFE']->config['INTincScript']) && is_array($GLOBALS['TSFE']->config['INTincScript'])) {   923                 if (!empty($GLOBALS['TSFE']->config['INTincScript']) && is_array($GLOBALS['TSFE']->config['INTincScript'])) {
916                         // Store the serialized pageRenderer in configuration   924                         // Store the serialized pageRenderer in configuration
917                         $GLOBALS['TSFE']->config['INTincScript_ext']['pageRenderer'] = serialize($pageRenderer);   925                         $GLOBALS['TSFE']->config['INTincScript_ext']['pageRenderer'] = serialize($pageRenderer);
918                         // Render complete page, keep placeholders for JavaScript and CSS   926                         // Render complete page, keep placeholders for JavaScript and CSS
919                         $GLOBALS['TSFE']->content = $pageRenderer->renderPageWithUncachedObjects($GLOBALS['TSFE']->config['INTincScript_ext']['divKey']);   927                         $GLOBALS['TSFE']->content = $pageRenderer->renderPageWithUncachedObjects($GLOBALS['TSFE']->config['INTincScript_ext']['divKey']);
920                 } else {   928                 } else {
921                         // Render complete page   929                         // Render complete page
922                         $GLOBALS['TSFE']->content = $pageRenderer->render();   930                         $GLOBALS['TSFE']->content = $pageRenderer->render();
923                 }   931                 }
924                 // Ending page   932                 // Ending page
925                 if ($GLOBALS['TSFE']->pSetup['frameSet.']) {   933                 if ($GLOBALS['TSFE']->pSetup['frameSet.']) {
926                         $GLOBALS['TSFE']->content .= LF . '</noframes>';   934                         $GLOBALS['TSFE']->content .= LF . '</noframes>';
927                 }   935                 }
928         }   936         }
929     937  
930         /*************************   938         /*************************
931          *   939          *
932          * Helper functions   940          * Helper functions
933          * Remember: Calls internally must still be done on the non-instantiated class: TSpagegen::inline2TempFile()   941          * Remember: Calls internally must still be done on the non-instantiated class: TSpagegen::inline2TempFile()
934          *   942          *
935          *************************/   943          *************************/
936         /**   944         /**
937          * Searches for placeholder created from *_INT cObjects, removes them from   945          * Searches for placeholder created from *_INT cObjects, removes them from
938          * $searchString and merges them to $intObjects   946          * $searchString and merges them to $intObjects
939          *   947          *
940          * @param string $searchString The String which should be cleaned from int-object markers   948          * @param string $searchString The String which should be cleaned from int-object markers
941          * @param string $intObjects The String the found int-placeholders are moved to (for further processing)   949          * @param string $intObjects The String the found int-placeholders are moved to (for further processing)
942          */   950          */
943         static protected function stripIntObjectPlaceholder(&$searchString, &$intObjects) {   951         static protected function stripIntObjectPlaceholder(&$searchString, &$intObjects) {
944                 $tempArray = array();   952                 $tempArray = array();
945                 preg_match_all('/\\<\\!--INT_SCRIPT.[a-z0-9]*--\\>/', $searchString, $tempArray);   953                 preg_match_all('/\\<\\!--INT_SCRIPT.[a-z0-9]*--\\>/', $searchString, $tempArray);
946                 $searchString = preg_replace('/\\<\\!--INT_SCRIPT.[a-z0-9]*--\\>/', '', $searchString);   954                 $searchString = preg_replace('/\\<\\!--INT_SCRIPT.[a-z0-9]*--\\>/', '', $searchString);
947                 $intObjects = implode('', $tempArray[0]);   955                 $intObjects = implode('', $tempArray[0]);
948         }   956         }
949     957  
950         /**   958         /**
951          * Writes string to a temporary file named after the md5-hash of the string   959          * Writes string to a temporary file named after the md5-hash of the string
952          *   960          *
953          * @param string $str CSS styles / JavaScript to write to file.   961          * @param string $str CSS styles / JavaScript to write to file.
954          * @param string $ext Extension: "css" or "js   962          * @param string $ext Extension: "css" or "js
955          * @return string <script> or <link> tag for the file.   963          * @return string <script> or <link> tag for the file.
956          */   964          */
957         static public function inline2TempFile($str, $ext) {   965         static public function inline2TempFile($str, $ext) {
958                 // Create filename / tags:   966                 // Create filename / tags:
959                 $script = '';   967                 $script = '';
960                 switch ($ext) {   968                 switch ($ext) {
961                 case 'js':   969                 case 'js':
962                         $script = 'typo3temp/javascript_' . substr(md5($str), 0, 10) . '.js';   970                         $script = 'typo3temp/javascript_' . substr(md5($str), 0, 10) . '.js';
963                         break;   971                         break;
964                 case 'css':   972                 case 'css':
965                         $script = 'typo3temp/stylesheet_' . substr(md5($str), 0, 10) . '.css';   973                         $script = 'typo3temp/stylesheet_' . substr(md5($str), 0, 10) . '.css';
966                         break;   974                         break;
967                 }   975                 }
968                 // Write file:   976                 // Write file:
969                 if ($script) {   977                 if ($script) {
970                         if (!@is_file((PATH_site . $script))) {   978                         if (!@is_file((PATH_site . $script))) {
971                                 \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_site . $script, $str);   979                                 \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_site . $script, $str);
972                         }   980                         }
973                 }   981                 }
974                 return $script;   982                 return $script;
975         }   983         }
976     984  
977         /**   985         /**
978          * Checks if the value defined in "config.linkVars" contains an allowed value. Otherwise, return FALSE which means the value will not be added to any links.   986          * Checks if the value defined in "config.linkVars" contains an allowed value. Otherwise, return FALSE which means the value will not be added to any links.
979          *   987          *
980          * @param string $haystack The string in which to find $needle   988          * @param string $haystack The string in which to find $needle
981          * @param string $needle The string to find in $haystack   989          * @param string $needle The string to find in $haystack
982          * @return boolean Returns TRUE if $needle matches or is found in $haystack   990          * @return boolean Returns TRUE if $needle matches or is found in $haystack
983          */   991          */
984         static public function isAllowedLinkVarValue($haystack, $needle) {   992         static public function isAllowedLinkVarValue($haystack, $needle) {
985                 $OK = FALSE;   993                 $OK = FALSE;
986                 // Integer   994                 // Integer
987                 if ($needle == 'int' || $needle == 'integer') {   995                 if ($needle == 'int' || $needle == 'integer') {
988                         if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($haystack)) {   996                         if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($haystack)) {
989                                 $OK = TRUE;   997                                 $OK = TRUE;
990                         }   998                         }
991                 } elseif (preg_match('/^\\/.+\\/[imsxeADSUXu]*$/', $needle)) {   999                 } elseif (preg_match('/^\\/.+\\/[imsxeADSUXu]*$/', $needle)) {
992                         // Regular expression, only "//" is allowed as delimiter   1000                         // Regular expression, only "//" is allowed as delimiter
993                         if (@preg_match($needle, $haystack)) {   1001                         if (@preg_match($needle, $haystack)) {
994                                 $OK = TRUE;   1002                                 $OK = TRUE;
995                         }   1003                         }
996                 } elseif (strstr($needle, '-')) {   1004                 } elseif (strstr($needle, '-')) {
997                         // Range   1005                         // Range
998                         if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($haystack)) {   1006                         if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($haystack)) {
999                                 $range = explode('-', $needle);   1007                                 $range = explode('-', $needle);
1000                                 if ($range[0] <= $haystack && $range[1] >= $haystack) {   1008                                 if ($range[0] <= $haystack && $range[1] >= $haystack) {
1001                                         $OK = TRUE;   1009                                         $OK = TRUE;
1002                                 }   1010                                 }
1003                         }   1011                         }
1004                 } elseif (strstr($needle, '|')) {   1012                 } elseif (strstr($needle, '|')) {
1005                         // List   1013                         // List
1006                         // Trim the input   1014                         // Trim the input
1007                         $haystack = str_replace(' ', '', $haystack);   1015                         $haystack = str_replace(' ', '', $haystack);
1008                         if (strstr('|' . $needle . '|', '|' . $haystack . '|')) {   1016                         if (strstr('|' . $needle . '|', '|' . $haystack . '|')) {
1009                                 $OK = TRUE;   1017                                 $OK = TRUE;
1010                         }   1018                         }
1011                 } elseif (!strcmp($needle, $haystack)) {   1019                 } elseif (!strcmp($needle, $haystack)) {
1012                         // String comparison   1020                         // String comparison
1013                         $OK = TRUE;   1021                         $OK = TRUE;
1014                 }   1022                 }
1015                 return $OK;   1023                 return $OK;
1016         }   1024         }
1017     1025  
1018 }   1026 }
1019     1027  
1020     1028  
1021 ?>   1029 ?>