/**
  * Initializes TSFE. This is necessary to have proper environment for typoLink.
  * This function is based on the one from extension 'pagepath' by Dmitry Dulepov.
  *
  * @return	void
  */
 protected function createTSFE()
 {
     require_once PATH_tslib . 'class.tslib_fe.php';
     require_once PATH_t3lib . 'class.t3lib_page.php';
     require_once PATH_tslib . 'class.tslib_content.php';
     require_once PATH_t3lib . 'class.t3lib_userauth.php';
     require_once PATH_tslib . 'class.tslib_feuserauth.php';
     require_once PATH_t3lib . 'class.t3lib_tstemplate.php';
     require_once PATH_t3lib . 'class.t3lib_cs.php';
     $GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $this->pageId, '');
     $GLOBALS['TSFE']->connectToDB();
     $GLOBALS['TSFE']->initFEuser();
     $GLOBALS['TSFE']->determineId();
     $GLOBALS['TSFE']->getCompressedTCarray();
     $GLOBALS['TSFE']->initTemplate();
     $GLOBALS['TSFE']->getConfigArray();
     $this->cObj = t3lib_div::makeInstance('tslib_cObj');
     // Set linkVars, absRefPrefix, etc
     require_once PATH_tslib . 'class.tslib_pagegen.php';
     TSpagegen::pagegenInit();
 }
Пример #2
0
 */
if (!is_object($TSFE)) {
    die('You cannot execute this file directly. It\'s meant to be included from index_ts.php');
}
$TT->push('pagegen.php, initialize');
// *********************************
// Initialization of some variables
// *********************************
TSpagegen::pagegenInit();
// *************************
// Global content object...
// *************************
$GLOBALS['TSFE']->newCObj();
// ******************************
// LIBRARY INCLUSION, TypoScript
// ******************************
$temp_incFiles = TSpagegen::getIncFiles();
foreach ($temp_incFiles as $temp_file) {
    include_once './' . $temp_file;
}
$TT->pull();
// *******************
// Content generation
// *******************
// If this is an array, it's a sign that this script is included in order to include certain PHP_SCRIPT_INT-scripts
if (!$GLOBALS['TSFE']->isINTincScript()) {
    $TT->push('pagegen.php, render');
    TSpagegen::renderContent();
    $GLOBALS['TSFE']->setAbsRefPrefix();
    $TT->pull();
}
 /**
  * improved copy from dam_index
  * 
  * Returns HTML of a box with a step counter and "back" and "next" buttons
  * Use label "next"/"prev" or "next_[stepnumber]"/"prev_[stepnumber]" for specific step in language file as button text.
  * 
  * <code>
  * #set background color
  * plugin.Tx_Formhandler.settings.stepbar_color = #EAEAEA
  * #use default CSS, written to temp file
  * plugin.Tx_Formhandler.settings.useDefaultStepBarStyles = 1
  * </code>
  * 
  * @author Johannes Feustel
  * @param	integer	$currentStep current step (begins with 1)
  * @param	integer	$lastStep last step
  * @param	string	$buttonNameBack name attribute of the back button
  * @param	string	$buttonNameFwd name attribute of the forward button
  * @return 	string	HTML code
  */
 protected function createStepBar($currentStep, $lastStep, $buttonNameBack = '', $buttonNameFwd = '')
 {
     //colors
     $bgcolor = '#EAEAEA';
     $bgcolor = $this->settings['stepbar_color'] ? $this->settings['stepbar_color'] : $bgcolor;
     $nrcolor = t3lib_div::modifyHTMLcolor($bgcolor, 30, 30, 30);
     $errorbgcolor = '#dd7777';
     $errornrcolor = t3lib_div::modifyHTMLcolor($errorbgcolor, 30, 30, 30);
     $classprefix = Tx_Formhandler_Globals::$formValuesPrefix . '_stepbar';
     $css = array();
     $css[] = '.' . $classprefix . ' { background:' . $bgcolor . '; padding:4px;}';
     $css[] = '.' . $classprefix . '_error { background: ' . $errorbgcolor . ';}';
     $css[] = '.' . $classprefix . '_steps { margin-left:50px; margin-right:25px; vertical-align:middle; font-family:Verdana,Arial,Helvetica; font-size:22px; font-weight:bold; }';
     $css[] = '.' . $classprefix . '_steps span { color:' . $nrcolor . '; margin-left:5px; margin-right:5px; }';
     $css[] = '.' . $classprefix . '_error .' . $classprefix . '_steps span { color:' . $errornrcolor . '; margin-left:5px; margin-right:5px; }';
     $css[] = '.' . $classprefix . '_steps .' . $classprefix . '_currentstep { color:  #000;}';
     $css[] = '#stepsFormButtons { margin-left:25px;vertical-align:middle;}';
     $content = '';
     $buttons = '';
     for ($i = 1; $i <= $lastStep; $i++) {
         $class = '';
         if ($i == $currentStep) {
             $class = 'class="' . $classprefix . '_currentstep"';
         }
         $stepName = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'step-' . $i);
         if (strlen($stepName) === 0) {
             $stepName = $i;
         }
         $content .= '<span ' . $class . ' >' . $stepName . '</span>';
     }
     $content = '<span class="' . $classprefix . '_steps' . '">' . $content . '</span>';
     //if not the first step, show back button
     if ($currentStep > 1) {
         //check if label for specific step
         $buttonvalue = '';
         $message = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'prev_' . $currentStep);
         if (strlen($message) === 0) {
             $message = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'prev');
         }
         $buttonvalue = $message;
         $buttons .= '<input type="submit" name="' . $buttonNameBack . '" value="' . trim($buttonvalue) . '" class="button_prev" style="margin-right:10px;" />';
     }
     $buttonvalue = '';
     $message = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'next_' . $currentStep);
     if (strlen($message) === 0) {
         $message = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'next');
     }
     $buttonvalue = $message;
     $buttons .= '<input type="submit" name="' . $buttonNameFwd . '" value="' . trim($buttonvalue) . '" class="button_next" />';
     $content .= '<span id="stepsFormButtons">' . $buttons . '</span>';
     //wrap
     $classes = $classprefix;
     if ($this->errors) {
         $classes = $classes . ' ' . $classprefix . '_error';
     }
     $content = '<div class="' . $classes . '" >' . $content . '</div>';
     //add default css to page
     if ($this->settings['useDefaultStepBarStyles']) {
         $css = implode("\n", $css);
         $css = TSpagegen::inline2TempFile($css, 'css');
         if (version_compare(TYPO3_version, '4.3.0') >= 0) {
             $css = '<link rel="stylesheet" type="text/css" href="' . htmlspecialchars($css) . '" />';
         }
         $GLOBALS['TSFE']->additionalHeaderData[$this->extKey . '_' . $classprefix] .= $css;
     }
     return $content;
 }
 protected function createTSFE()
 {
     if (!is_object($GLOBALS['TT'])) {
         $GLOBALS['TT'] = t3lib_div::makeInstance('t3lib_TimeTrackNull');
     }
     $GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], 1, '');
     $GLOBALS['TSFE']->connectToDB();
     $GLOBALS['TSFE']->initFEuser();
     $GLOBALS['TSFE']->determineId();
     $GLOBALS['TSFE']->getCompressedTCarray();
     $GLOBALS['TSFE']->initTemplate();
     $GLOBALS['TSFE']->getConfigArray();
     if (TYPO3_MODE == 'BE') {
         // Set current backend language
         $GLOBALS['TSFE']->getPageRenderer()->setLanguage($GLOBALS['LANG']->lang);
     }
     $GLOBALS['TSFE']->newcObj();
     TSpagegen::pagegenInit();
 }
 /**
  * Initializes TSFE and sets $GLOBALS['TSFE'].
  *
  * @return void
  */
 protected function initTSFE()
 {
     $GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], t3lib_div::_GP('id'), '');
     $GLOBALS['TSFE']->connectToDB();
     $GLOBALS['TSFE']->initFEuser();
     $GLOBALS['TSFE']->checkAlternativeIdMethods();
     $GLOBALS['TSFE']->determineId();
     $GLOBALS['TSFE']->getCompressedTCarray();
     $GLOBALS['TSFE']->initTemplate();
     $GLOBALS['TSFE']->getConfigArray();
     // Get linkVars, absRefPrefix, etc
     TSpagegen::pagegenInit();
 }
    /**
     * Rendering normal HTML-page with header by wrapping the generated content ($pageContent) in body-tags and setting the header accordingly.
     *
     * @param	string		The page content which TypoScript objects has generated
     * @return	void
     */
    public static function renderContentWithHeader($pageContent)
    {
        // get instance of t3lib_PageRenderer
        /** @var $pageRenderer t3lib_PageRenderer */
        $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
        $pageRenderer->backPath = TYPO3_mainDir;
        if ($GLOBALS['TSFE']->config['config']['moveJsFromHeaderToFooter']) {
            $pageRenderer->enableMoveJsFromHeaderToFooter();
        }
        if ($GLOBALS['TSFE']->config['config']['pageRendererTemplateFile']) {
            $file = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->config['config']['pageRendererTemplateFile']);
            if ($file) {
                $pageRenderer->setTemplateFile($file);
            }
        }
        $headerComment = $GLOBALS['TSFE']->config['config']['headerComment'];
        if (trim($headerComment)) {
            $pageRenderer->addInlineComment(TAB . str_replace(LF, LF . TAB, trim($headerComment)) . LF);
        }
        // Setting charset:
        $theCharset = $GLOBALS['TSFE']->metaCharset;
        // Reset the content variables:
        $GLOBALS['TSFE']->content = '';
        $htmlTagAttributes = array();
        $htmlLang = $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] ? $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] : 'en';
        // Set content direction: (More info: http://www.tau.ac.il/~danon/Hebrew/HTML_and_Hebrew.html)
        if ($GLOBALS['TSFE']->config['config']['htmlTag_dir']) {
            $htmlTagAttributes['dir'] = htmlspecialchars($GLOBALS['TSFE']->config['config']['htmlTag_dir']);
        }
        // Setting document type:
        $docTypeParts = array();
        // Part 1: XML prologue
        switch ((string) $GLOBALS['TSFE']->config['config']['xmlprologue']) {
            case 'none':
                break;
            case 'xml_10':
                $docTypeParts[] = '<?xml version="1.0" encoding="' . $theCharset . '"?>';
                break;
            case 'xml_11':
                $docTypeParts[] = '<?xml version="1.1" encoding="' . $theCharset . '"?>';
                break;
            case '':
                if ($GLOBALS['TSFE']->xhtmlVersion) {
                    $docTypeParts[] = '<?xml version="1.0" encoding="' . $theCharset . '"?>';
                }
                break;
            default:
                $docTypeParts[] = $GLOBALS['TSFE']->config['config']['xmlprologue'];
        }
        // Part 2: DTD
        $doctype = $GLOBALS['TSFE']->config['config']['doctype'];
        if ($doctype) {
            switch ($doctype) {
                case 'xhtml_trans':
                    $docTypeParts[] = '<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
                    break;
                case 'xhtml_strict':
                    $docTypeParts[] = '<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
                    break;
                case 'xhtml_frames':
                    $docTypeParts[] = '<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
                    break;
                case 'xhtml_basic':
                    $docTypeParts[] = '<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
    "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';
                    break;
                case 'xhtml_11':
                    $docTypeParts[] = '<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.1//EN"
     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
                    break;
                case 'xhtml_2':
                    $docTypeParts[] = '<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 2.0//EN"
	"http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd">';
                    break;
                case 'xhtml+rdfa_10':
                    $docTypeParts[] = '<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
	"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">';
                    break;
                case 'html5':
                    $docTypeParts[] = '<!DOCTYPE html>';
                    break;
                case 'none':
                    break;
                default:
                    $docTypeParts[] = $doctype;
            }
        } else {
            $docTypeParts[] = '<!DOCTYPE html
	PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
        }
        if ($GLOBALS['TSFE']->xhtmlVersion) {
            $htmlTagAttributes['xml:lang'] = $htmlLang;
        }
        if ($GLOBALS['TSFE']->xhtmlVersion < 110 || $doctype === 'html5') {
            $htmlTagAttributes['lang'] = $htmlLang;
        }
        if ($GLOBALS['TSFE']->xhtmlVersion || $doctype === 'html5') {
            $htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';
            // We add this to HTML5 to achieve a slightly better backwards compatibility
            if (is_array($GLOBALS['TSFE']->config['config']['namespaces.'])) {
                foreach ($GLOBALS['TSFE']->config['config']['namespaces.'] as $prefix => $uri) {
                    $htmlTagAttributes['xmlns:' . htmlspecialchars($prefix)] = $uri;
                    // $uri gets htmlspecialchared later
                }
            }
        }
        // Swap XML and doctype order around (for MSIE / Opera standards compliance)
        if ($GLOBALS['TSFE']->config['config']['doctypeSwitch']) {
            $docTypeParts = array_reverse($docTypeParts);
        }
        // Adding doctype parts:
        if (count($docTypeParts)) {
            $pageRenderer->setXmlPrologAndDocType(implode(LF, $docTypeParts));
        }
        // Begin header section:
        if (strcmp($GLOBALS['TSFE']->config['config']['htmlTag_setParams'], 'none')) {
            $_attr = $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] ? $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] : t3lib_div::implodeAttributes($htmlTagAttributes);
        } else {
            $_attr = '';
        }
        $pageRenderer->setHtmlTag('<html' . ($_attr ? ' ' . $_attr : '') . '>');
        // Head tag:
        $headTag = $GLOBALS['TSFE']->pSetup['headTag'] ? $GLOBALS['TSFE']->pSetup['headTag'] : '<head>';
        $pageRenderer->setHeadTag($headTag);
        // Setting charset meta tag:
        $pageRenderer->setCharSet($theCharset);
        $pageRenderer->addInlineComment('	This website is powered by TYPO3 - inspiring people to share!
	TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
	TYPO3 is copyright ' . TYPO3_copyright_year . ' of Kasper Skaarhoj. Extensions are copyright of their respective owners.
	Information and contribution at ' . TYPO3_URL_GENERAL . ' and ' . TYPO3_URL_ORG . '
');
        if ($GLOBALS['TSFE']->baseUrl) {
            $pageRenderer->setBaseUrl($GLOBALS['TSFE']->baseUrl);
        }
        if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {
            $favIcon = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['shortcutIcon']);
            $iconMimeType = '';
            if (function_exists('finfo_open')) {
                if ($finfo = @finfo_open(FILEINFO_MIME)) {
                    $iconMimeType = ' type="' . finfo_file($finfo, PATH_site . $favIcon) . '"';
                    finfo_close($finfo);
                    $pageRenderer->setIconMimeType($iconMimeType);
                }
            }
            $pageRenderer->setFavIcon(t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $favIcon);
        }
        // Including CSS files
        if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'])) {
            $temp_styleLines = array();
            foreach ($GLOBALS['TSFE']->tmpl->setup['plugin.'] as $key => $iCSScode) {
                if (is_array($iCSScode) && $iCSScode['_CSS_DEFAULT_STYLE']) {
                    $temp_styleLines[] = '/* default styles for extension "' . substr($key, 0, -1) . '" */' . LF . $iCSScode['_CSS_DEFAULT_STYLE'];
                }
            }
            if (count($temp_styleLines)) {
                if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
                    $pageRenderer->addCssFile(TSpagegen::inline2TempFile(implode(LF, $temp_styleLines), 'css'));
                } else {
                    $pageRenderer->addCssInlineBlock('TSFEinlineStyle', implode(LF, $temp_styleLines));
                }
            }
        }
        if ($GLOBALS['TSFE']->pSetup['stylesheet']) {
            $ss = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);
            if ($ss) {
                $pageRenderer->addCssFile($ss);
            }
        }
        /**********************************************************************/
        /* includeCSS
        		/* config.includeCSS {
        		/*
        		/* }
        		/**********************************************************************/
        if (is_array($GLOBALS['TSFE']->pSetup['includeCSS.'])) {
            foreach ($GLOBALS['TSFE']->pSetup['includeCSS.'] as $key => $CSSfile) {
                if (!is_array($CSSfile)) {
                    $ss = $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['external'] ? $CSSfile : $GLOBALS['TSFE']->tmpl->getFileName($CSSfile);
                    if ($ss) {
                        if ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['import']) {
                            if (!$GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['external'] && substr($ss, 0, 1) != '/') {
                                // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
                                $ss = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;
                            }
                            $pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media']) . ';', $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['compress'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, '');
                        } else {
                            $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'] : '', $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['compress'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['allWrap']);
                        }
                    }
                }
            }
        }
        // Stylesheets
        $style = '';
        if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE']) {
            $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
            $RTEclasses = $pageTSConfig['RTE.']['classes.'];
            if (is_array($RTEclasses)) {
                foreach ($RTEclasses as $RTEclassName => $RTEvalueArray) {
                    if ($RTEvalueArray['value']) {
                        $style .= '
.' . substr($RTEclassName, 0, -1) . ' {' . $RTEvalueArray['value'] . '}';
                    }
                }
            }
            if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'])) {
                $mSOa_tList = t3lib_div::trimExplode(',', strtoupper($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs']), 1);
                foreach ($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'] as $mSOa_key => $mSOa_value) {
                    if (!is_array($mSOa_value) && (in_array('*', $mSOa_tList) || in_array($mSOa_key, $mSOa_tList))) {
                        $style .= '
' . $mSOa_key . ' {' . $mSOa_value . '}';
                    }
                }
            }
        }
        // Setting body tag margins in CSS:
        if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
            $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
            $style .= '
	BODY {margin: ' . $margins . 'px ' . $margins . 'px ' . $margins . 'px ' . $margins . 'px;}';
        }
        if ($GLOBALS['TSFE']->pSetup['noLinkUnderline']) {
            $GLOBALS['TSFE']->logDeprecatedTyposcript('config.noLinkUnderline');
            $style .= '
	A:link {text-decoration: none}
	A:visited {text-decoration: none}
	A:active {text-decoration: none}';
        }
        if (trim($GLOBALS['TSFE']->pSetup['hover'])) {
            $GLOBALS['TSFE']->logDeprecatedTyposcript('config.hover');
            $style .= '
	A:hover {color: ' . trim($GLOBALS['TSFE']->pSetup['hover']) . ';}';
        }
        if (trim($GLOBALS['TSFE']->pSetup['hoverStyle'])) {
            $GLOBALS['TSFE']->logDeprecatedTyposcript('config.hoverStyle');
            $style .= '
	A:hover {' . trim($GLOBALS['TSFE']->pSetup['hoverStyle']) . '}';
        }
        if ($GLOBALS['TSFE']->pSetup['smallFormFields']) {
            $GLOBALS['TSFE']->logDeprecatedTyposcript('config.smallFormFields');
            $style .= '
	SELECT {  font-family: Verdana, Arial, Helvetica; font-size: 10px }
	TEXTAREA  {  font-family: Verdana, Arial, Helvetica; font-size: 10px}
	INPUT   {  font-family: Verdana, Arial, Helvetica; font-size: 10px }';
        }
        if ($GLOBALS['TSFE']->pSetup['adminPanelStyles']) {
            $style .= '

	/* Default styles for the Admin Panel */
	TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }
	TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }
	TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }
	TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }
	TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }
	TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }
	TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }
	TABLE.typo3-editPanel TD { border: 0px; }
			';
        }
        // CSS_inlineStyle from TS
        $style .= trim($GLOBALS['TSFE']->pSetup['CSS_inlineStyle']);
        $style .= $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['cssInline.'], 'cssInline.');
        if (trim($style)) {
            if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
                $pageRenderer->addCssFile(TSpagegen::inline2TempFile($style, 'css'));
            } else {
                $pageRenderer->addCssInlineBlock('additionalTSFEInlineStyle', $style);
            }
        }
        // Javascript Libraries
        if (is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.'])) {
            if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG']) {
                $pageRenderer->loadSvg();
                if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG.']['debug']) {
                    $pageRenderer->enableSvgDebug();
                }
                if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['SVG.']['forceFlash']) {
                    $pageRenderer->svgForceFlash();
                }
            }
            if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Prototype']) {
                $pageRenderer->loadPrototype();
            }
            if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous']) {
                $modules = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] : '';
                $pageRenderer->loadScriptaculous($modules);
            }
            if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore']) {
                $pageRenderer->loadExtCore();
                if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore.']['debug']) {
                    $pageRenderer->enableExtCoreDebug();
                }
            }
            if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs']) {
                $css = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['css'] ? TRUE : FALSE;
                $theme = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['theme'] ? TRUE : FALSE;
                $adapter = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] : '';
                $pageRenderer->loadExtJs($css, $theme, $adapter);
                if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['debug']) {
                    $pageRenderer->enableExtJsDebug();
                }
                if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['quickTips']) {
                    $pageRenderer->enableExtJSQuickTips();
                }
            }
        }
        // JavaScript library files
        if (is_array($GLOBALS['TSFE']->pSetup['includeJSlibs.'])) {
            foreach ($GLOBALS['TSFE']->pSetup['includeJSlibs.'] as $key => $JSfile) {
                if (!is_array($JSfile)) {
                    $ss = $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
                    if ($ss) {
                        $type = $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['type'];
                        if (!$type) {
                            $type = 'text/javascript';
                        }
                        $pageRenderer->addJsLibrary($key, $ss, $type, $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['compress'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['allWrap']);
                    }
                }
            }
        }
        if (is_array($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'])) {
            foreach ($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'] as $key => $JSfile) {
                if (!is_array($JSfile)) {
                    $ss = $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
                    if ($ss) {
                        $type = $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['type'];
                        if (!$type) {
                            $type = 'text/javascript';
                        }
                        $pageRenderer->addJsFooterLibrary($key, $ss, $type, $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['compress'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['allWrap']);
                    }
                }
            }
        }
        // JavaScript files
        if (is_array($GLOBALS['TSFE']->pSetup['includeJS.'])) {
            foreach ($GLOBALS['TSFE']->pSetup['includeJS.'] as $key => $JSfile) {
                if (!is_array($JSfile)) {
                    $ss = $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
                    if ($ss) {
                        $type = $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['type'];
                        if (!$type) {
                            $type = 'text/javascript';
                        }
                        $pageRenderer->addJsFile($ss, $type, $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['compress'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['allWrap']);
                    }
                }
            }
        }
        if (is_array($GLOBALS['TSFE']->pSetup['includeJSFooter.'])) {
            foreach ($GLOBALS['TSFE']->pSetup['includeJSFooter.'] as $key => $JSfile) {
                if (!is_array($JSfile)) {
                    $ss = $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
                    if ($ss) {
                        $type = $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['type'];
                        if (!$type) {
                            $type = 'text/javascript';
                        }
                        $pageRenderer->addJsFooterFile($ss, $type, $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['compress'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeJSFooter.'][$key . '.']['allWrap']);
                    }
                }
            }
        }
        // Headerdata
        if (is_array($GLOBALS['TSFE']->pSetup['headerData.'])) {
            $pageRenderer->addHeaderData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'], 'headerData.'));
        }
        // Footerdata
        if (is_array($GLOBALS['TSFE']->pSetup['footerData.'])) {
            $pageRenderer->addFooterData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['footerData.'], 'footerData.'));
        }
        // Title
        $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']);
        if ($GLOBALS['TSFE']->config['config']['titleTagFunction']) {
            $titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction($GLOBALS['TSFE']->config['config']['titleTagFunction'], array(), $titleTagContent);
        }
        if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config['config']['noPageTitle']) !== 2) {
            $pageRenderer->setTitle($titleTagContent);
        }
        // add ending slash only to documents rendered as xhtml
        $endingSlash = $GLOBALS['TSFE']->xhtmlVersion ? ' /' : '';
        $pageRenderer->addMetaTag('<meta name="generator" content="TYPO3 ' . TYPO3_branch . ' CMS"' . $endingSlash . '>');
        $conf = $GLOBALS['TSFE']->pSetup['meta.'];
        if (is_array($conf)) {
            foreach ($conf as $theKey => $theValue) {
                if (!strstr($theKey, '.') || !isset($conf[substr($theKey, 0, -1)])) {
                    // Only if 1) the property is set but not the value itself, 2) the value and/or any property
                    if (strstr($theKey, '.')) {
                        $theKey = substr($theKey, 0, -1);
                    }
                    $val = $GLOBALS['TSFE']->cObj->stdWrap($conf[$theKey], $conf[$theKey . '.']);
                    $key = $theKey;
                    if (trim($val)) {
                        $a = 'name';
                        if (strtolower($key) == 'refresh') {
                            $a = 'http-equiv';
                        }
                        $pageRenderer->addMetaTag('<meta ' . $a . '="' . $key . '" content="' . htmlspecialchars(trim($val)) . '"' . $endingSlash . '>');
                    }
                }
            }
        }
        unset($GLOBALS['TSFE']->additionalHeaderData['JSCode']);
        unset($GLOBALS['TSFE']->additionalHeaderData['JSImgCode']);
        if (is_array($GLOBALS['TSFE']->config['INTincScript'])) {
            // Storing the JSCode and JSImgCode vars...
            $GLOBALS['TSFE']->additionalHeaderData['JSCode'] = $GLOBALS['TSFE']->JSCode;
            $GLOBALS['TSFE']->additionalHeaderData['JSImgCode'] = $GLOBALS['TSFE']->JSImgCode;
            $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] = $GLOBALS['TSFE']->uniqueHash();
            $GLOBALS['TSFE']->config['INTincScript_ext']['additionalHeaderData'] = $GLOBALS['TSFE']->additionalHeaderData;
            // Storing the header-data array
            $GLOBALS['TSFE']->config['INTincScript_ext']['additionalJavaScript'] = $GLOBALS['TSFE']->additionalJavaScript;
            // Storing the JS-data array
            $GLOBALS['TSFE']->config['INTincScript_ext']['additionalCSS'] = $GLOBALS['TSFE']->additionalCSS;
            // Storing the Style-data array
            $GLOBALS['TSFE']->additionalHeaderData = array('<!--HD_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->');
            // Clearing the array
            $GLOBALS['TSFE']->divSection .= '<!--TDS_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->';
        } else {
            $GLOBALS['TSFE']->INTincScript_loadJSCode();
        }
        $JSef = TSpagegen::JSeventFunctions();
        // Adding default Java Script:
        $scriptJsCode = '
		var browserName = navigator.appName;
		var browserVer = parseInt(navigator.appVersion);
		var version = "";
		var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
		if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror" || browserName=="Opera") {version = "n3";} else {version = "n2";}
			// Blurring links:
		function blurLink(theObject)	{	//
			if (msie4)	{theObject.blur();}
		}
		' . $JSef[0];
        if ($GLOBALS['TSFE']->spamProtectEmailAddresses && $GLOBALS['TSFE']->spamProtectEmailAddresses !== 'ascii') {
            $scriptJsCode .= '
			// decrypt helper function
		function decryptCharcode(n,start,end,offset)	{
			n = n + offset;
			if (offset > 0 && n > end)	{
				n = start + (n - end - 1);
			} else if (offset < 0 && n < start)	{
				n = end - (start - n - 1);
			}
			return String.fromCharCode(n);
		}
			// decrypt string
		function decryptString(enc,offset)	{
			var dec = "";
			var len = enc.length;
			for(var i=0; i < len; i++)	{
				var n = enc.charCodeAt(i);
				if (n >= 0x2B && n <= 0x3A)	{
					dec += decryptCharcode(n,0x2B,0x3A,offset);	// 0-9 . , - + / :
				} else if (n >= 0x40 && n <= 0x5A)	{
					dec += decryptCharcode(n,0x40,0x5A,offset);	// A-Z @
				} else if (n >= 0x61 && n <= 0x7A)	{
					dec += decryptCharcode(n,0x61,0x7A,offset);	// a-z
				} else {
					dec += enc.charAt(i);
				}
			}
			return dec;
		}
			// decrypt spam-protected emails
		function linkTo_UnCryptMailto(s)	{
			location.href = decryptString(s,' . $GLOBALS['TSFE']->spamProtectEmailAddresses * -1 . ');
		}
		';
        }
        //add inline JS
        $inlineJS = '';
        // defined in php
        if (is_array($GLOBALS['TSFE']->inlineJS)) {
            foreach ($GLOBALS['TSFE']->inlineJS as $key => $val) {
                if (!is_array($val)) {
                    $inlineJS .= LF . $val . LF;
                }
            }
        }
        // defined in TS with page.inlineJS
        // Javascript inline code
        $inline = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['jsInline.'], 'jsInline.');
        if ($inline) {
            $inlineJS .= LF . $inline . LF;
        }
        // Javascript inline code for Footer
        $inlineFooterJs = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['jsFooterInline.'], 'jsFooterInline.');
        // Should minify?
        if ($GLOBALS['TSFE']->config['config']['minifyJS']) {
            $pageRenderer->enableCompressJavascript();
            $minifyErrorScript = $minifyErrorInline = '';
            $scriptJsCode = t3lib_div::minifyJavaScript($scriptJsCode, $minifyErrorScript);
            if ($minifyErrorScript) {
                $GLOBALS['TT']->setTSlogMessage($minifyErrorScript, 3);
            }
            if ($inlineJS) {
                $inlineJS = t3lib_div::minifyJavaScript($inlineJS, $minifyErrorInline);
                if ($minifyErrorInline) {
                    $GLOBALS['TT']->setTSlogMessage($minifyErrorInline, 3);
                }
            }
            if ($inlineFooterJs) {
                $inlineFooterJs = t3lib_div::minifyJavaScript($inlineFooterJs, $minifyErrorInline);
                if ($minifyErrorInline) {
                    $GLOBALS['TT']->setTSlogMessage($minifyErrorInline, 3);
                }
            }
        }
        if (!$GLOBALS['TSFE']->config['config']['removeDefaultJS']) {
            // inlude default and inlineJS
            if ($scriptJsCode) {
                $pageRenderer->addJsInlineCode('_scriptCode', $scriptJsCode, $GLOBALS['TSFE']->config['config']['minifyJS']);
            }
            if ($inlineJS) {
                $pageRenderer->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['minifyJS']);
            }
            if ($inlineFooterJs) {
                $pageRenderer->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['minifyJS']);
            }
        } elseif ($GLOBALS['TSFE']->config['config']['removeDefaultJS'] === 'external') {
            /*
             This keeps inlineJS from *_INT Objects from being moved to external files.
             At this point in frontend rendering *_INT Objects only have placeholders instead
             of actual content so moving these placeholders to external files would
             	a) break the JS file (syntax errors due to the placeholders)
             	b) the needed JS would never get included to the page
             Therefore inlineJS from *_INT Objects must not be moved to external files but
             kept internal.
            */
            $inlineJSint = '';
            self::stripIntObjectPlaceholder($inlineJS, $inlineJSint);
            if ($inlineJSint) {
                $pageRenderer->addJsInlineCode('TS_inlineJSint', $inlineJSint, $GLOBALS['TSFE']->config['config']['minifyJS']);
            }
            $pageRenderer->addJsFile(TSpagegen::inline2TempFile($scriptJsCode . $inlineJS, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
            if ($inlineFooterJs) {
                $inlineFooterJSint = '';
                self::stripIntObjectPlaceholder($inlineFooterJs, $inlineFooterJSint);
                if ($inlineFooterJSint) {
                    $pageRenderer->addJsFooterInlineCode('TS_inlineFooterJSint', $inlineFooterJSint, $GLOBALS['TSFE']->config['config']['minifyJS']);
                }
                $pageRenderer->addJsFooterFile(TSpagegen::inline2TempFile($inlineFooterJs, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
            }
        } else {
            // include only inlineJS
            if ($inlineJS) {
                $pageRenderer->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['minifyJS']);
            }
            if ($inlineFooterJs) {
                $pageRenderer->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['minifyJS']);
            }
        }
        // ExtJS specific code
        if (is_array($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.'])) {
            $pageRenderer->addInlineLanguageLabelArray($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.']);
        }
        if (is_array($GLOBALS['TSFE']->pSetup['inlineSettings.'])) {
            $pageRenderer->addInlineSettingArray('TS', $GLOBALS['TSFE']->pSetup['inlineSettings.']);
        }
        if (is_array($GLOBALS['TSFE']->pSetup['extOnReady.'])) {
            $pageRenderer->addExtOnReadyCode($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['extOnReady.'], 'extOnReady.'));
        }
        // compression and concatenate settings
        if ($GLOBALS['TSFE']->config['config']['minifyCSS']) {
            $pageRenderer->enableCompressCss();
        }
        if ($GLOBALS['TSFE']->config['config']['minifyJS']) {
            $pageRenderer->enableCompressJavascript();
        }
        if ($GLOBALS['TSFE']->config['config']['concatenateJsAndCss']) {
            $pageRenderer->enableConcatenateFiles();
        }
        // add header data block
        if ($GLOBALS['TSFE']->additionalHeaderData) {
            $pageRenderer->addHeaderData(implode(LF, $GLOBALS['TSFE']->additionalHeaderData));
        }
        // add footer data block
        if ($GLOBALS['TSFE']->additionalFooterData) {
            $pageRenderer->addFooterData(implode(LF, $GLOBALS['TSFE']->additionalFooterData));
        }
        // Header complete, now add content
        if ($GLOBALS['TSFE']->pSetup['frameSet.']) {
            $fs = t3lib_div::makeInstance('tslib_frameset');
            $pageRenderer->addBodyContent($fs->make($GLOBALS['TSFE']->pSetup['frameSet.']));
            $pageRenderer->addBodyContent(LF . '<noframes>' . LF);
        }
        // Bodytag:
        $defBT = $GLOBALS['TSFE']->pSetup['bodyTagCObject'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($GLOBALS['TSFE']->pSetup['bodyTagCObject'], $GLOBALS['TSFE']->pSetup['bodyTagCObject.'], 'bodyTagCObject') : '';
        if (!$defBT) {
            $defBT = $GLOBALS['TSFE']->defaultBodyTag;
        }
        $bodyTag = $GLOBALS['TSFE']->pSetup['bodyTag'] ? $GLOBALS['TSFE']->pSetup['bodyTag'] : $defBT;
        if ($bgImg = $GLOBALS['TSFE']->cObj->getImgResource($GLOBALS['TSFE']->pSetup['bgImg'], $GLOBALS['TSFE']->pSetup['bgImg.'])) {
            $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' background="' . $GLOBALS["TSFE"]->absRefPrefix . $bgImg[3] . '">';
        }
        if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins'])) {
            $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
            if ($GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
                // Setting margins in CSS, see above
            } else {
                $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' leftmargin="' . $margins . '" topmargin="' . $margins . '" marginwidth="' . $margins . '" marginheight="' . $margins . '">';
            }
        }
        if (trim($GLOBALS['TSFE']->pSetup['bodyTagAdd'])) {
            $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']) . '>';
        }
        if (count($JSef[1])) {
            // Event functions:
            $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim(implode(' ', $JSef[1])) . '>';
        }
        $pageRenderer->addBodyContent(LF . $bodyTag);
        // Div-sections
        if ($GLOBALS['TSFE']->divSection) {
            $pageRenderer->addBodyContent(LF . $GLOBALS['TSFE']->divSection);
        }
        // Page content
        $pageRenderer->addBodyContent(LF . $pageContent);
        // Render complete page
        $GLOBALS['TSFE']->content = $pageRenderer->render();
        // Ending page
        if ($GLOBALS['TSFE']->pSetup['frameSet.']) {
            $GLOBALS['TSFE']->content .= LF . '</noframes>';
        }
    }
 /**
  * @param string $id
  * @param bool $L
  * @return string
  */
 function buildURL($id, $L = false)
 {
     if ($id) {
         $GLOBALS['TSFE']->determineId();
         $GLOBALS['TSFE']->getCompressedTCarray();
         $GLOBALS['TSFE']->initTemplate();
         $GLOBALS['TSFE']->getConfigArray();
         // Set linkVars, absRefPrefix, etc
         require_once PATH_tslib . 'class.tslib_pagegen.php';
         TSpagegen::pagegenInit();
         $cObj = t3lib_div::makeInstance('tslib_cObj');
         $cObj->start(array());
         $url = $cObj->getTypoLink_URL($id, $L ? array('L' => $L) : array());
         return $url;
     }
 }
 /**
  * Will set header content and BodyTag for template.
  *
  * @param	array		$MappingInfo_head: ...
  * @param	array		$MappingData_head_cached: ...
  * @param	string		$BodyTag_cached: ...
  * @param	boolean		$pageRenderer: try to use the pageRenderer for script and style inclusion
  * @return	void
  */
 function setHeaderBodyParts($MappingInfo_head, $MappingData_head_cached, $BodyTag_cached = '', $pageRenderer = FALSE)
 {
     $htmlParse = $this->htmlParse ? $this->htmlParse : t3lib_div::makeInstance('t3lib_parsehtml');
     /* @var $htmlParse t3lib_parsehtml */
     $types = array('LINK' => 'text/css', 'STYLE' => 'text/css', 'SCRIPT' => 'text/javascript');
     // Traversing mapped header parts:
     if (is_array($MappingInfo_head['headElementPaths'])) {
         $extraHeaderData = array();
         foreach (array_keys($MappingInfo_head['headElementPaths']) as $kk) {
             if (isset($MappingData_head_cached['cArray']['el_' . $kk])) {
                 $tag = strtoupper($htmlParse->getFirstTagName($MappingData_head_cached['cArray']['el_' . $kk]));
                 $attr = $htmlParse->get_tag_attributes($MappingData_head_cached['cArray']['el_' . $kk]);
                 if (isset($GLOBALS['TSFE']) && $pageRenderer && isset($attr[0]['type']) && isset($types[$tag]) && $types[$tag] == $attr[0]['type']) {
                     $name = 'templavoila#' . md5($MappingData_head_cached['cArray']['el_' . $kk]);
                     $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
                     switch ($tag) {
                         case 'LINK':
                             $rel = isset($attr[0]['rel']) ? $attr[0]['rel'] : 'stylesheet';
                             $media = isset($attr[0]['media']) ? $attr[0]['media'] : 'all';
                             $pageRenderer->addCssFile($attr[0]['href'], $rel, $media);
                             break;
                         case 'STYLE':
                             $cont = $htmlParse->removeFirstAndLastTag($MappingData_head_cached['cArray']['el_' . $kk]);
                             if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
                                 $pageRenderer->addCssFile(TSpagegen::inline2TempFile($cont, 'css'));
                             } else {
                                 $pageRenderer->addCssInlineBlock($name, $cont);
                             }
                             break;
                         case 'SCRIPT':
                             if (isset($attr[0]['src'])) {
                                 $pageRenderer->addJsFile($attr[0]['src']);
                             } else {
                                 $cont = $htmlParse->removeFirstAndLastTag($MappingData_head_cached['cArray']['el_' . $kk]);
                                 $pageRenderer->addJsInlineCode($name, $cont);
                             }
                             break;
                         default:
                             // can't happen due to condition
                     }
                 } else {
                     $uKey = md5(trim($MappingData_head_cached['cArray']['el_' . $kk]));
                     $extraHeaderData['TV_' . $uKey] = chr(10) . chr(9) . trim($htmlParse->XHTML_clean($MappingData_head_cached['cArray']['el_' . $kk]));
                 }
             }
         }
         // Set 'page.headerData', use the lowest possible free index!
         // This will make sure that header data appears the very first on the page
         // but unfortunately after styles from extensions
         for ($i = 1; $i < PHP_INT_MAX; $i++) {
             if (!isset($GLOBALS['TSFE']->pSetup['headerData.'][$i])) {
                 $GLOBALS['TSFE']->pSetup['headerData.'][$i] = 'TEXT';
                 $GLOBALS['TSFE']->pSetup['headerData.'][$i . '.']['value'] = implode('', $extraHeaderData) . chr(10);
                 break;
             }
         }
         // Alternative way is to prepend it additionalHeaderData but that
         // will still put JS/CSS after any page.headerData. So this code is
         // kept commented here.
         //$GLOBALS['TSFE']->additionalHeaderData = $extraHeaderData + $GLOBALS['TSFE']->additionalHeaderData;
     }
     // Body tag:
     if ($MappingInfo_head['addBodyTag'] && $BodyTag_cached) {
         $GLOBALS['TSFE']->defaultBodyTag = $BodyTag_cached;
     }
 }
 /**
  * Initializes TSFE. This is necessary to have proper environment for typoLink.
  *
  * @return	void
  */
 protected function createTSFE()
 {
     $GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $this->pageId, '');
     $GLOBALS['TSFE']->connectToDB();
     $GLOBALS['TSFE']->initFEuser();
     $GLOBALS['TSFE']->determineId();
     $GLOBALS['TSFE']->getCompressedTCarray();
     $GLOBALS['TSFE']->initTemplate();
     $GLOBALS['TSFE']->getConfigArray();
     // Set linkVars, absRefPrefix, etc
     TSpagegen::pagegenInit();
 }