コード例 #1
0
 /**
  * Add meta tag when rtehtmlarea is present and user agent is IE 11+
  *
  * @param array $params
  * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $controller
  * @return void
  */
 public function contentPostProcOutput(array $params, \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $controller)
 {
     if (strpos($controller->content, 'textarea id="RTEarea') !== FALSE) {
         $userAgent = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT');
         $browserInfo = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgent);
         if ($browserInfo['browser'] === 'msie' && $browserInfo['version'] > 10) {
             $controller->content = preg_replace('/<head([^>]*)>/', '<head$1>' . LF . '<meta http-equiv="X-UA-Compatible" content="IE=10" />', $controller->content);
         }
     }
 }
コード例 #2
0
ファイル: AudioViewHelper.php プロジェクト: olek07/GiGaBonus
 /**
  * Render the captcha audio rendering request icon
  *
  * @param string suffix to be appended to the extenstion key when forming css class names
  * @return string The html used to render the captcha audio rendering request icon
  */
 public function render($suffix = '')
 {
     $value = '';
     // Get the plugin configuration
     $settings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $this->extensionName, $this->pluginName);
     // Get the translation view helper
     $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
     $translator->injectConfigurationManager($this->configurationManager);
     // Get browser info: in IE 8, we will use a simple link, as dynamic insertion of object element gives unpredictable results
     $browserInfo = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
     $browerIsIE8 = $browserInfo['browser'] == 'msie' && $browserInfo['version'] == '8';
     // Generate the icon
     if ($settings['accessibleOutput'] && in_array('mcrypt', get_loaded_extensions()) && intval($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'])) {
         $fakeId = \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5(uniqid(rand()), 5);
         $siteURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
         $urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => $this->extensionName, 'pluginName' => 'AudioPlayer', 'controllerName' => 'AudioPlayer', 'actionName' => 'play', 'formatName' => $browerIsIE8 ? 'mp3' : 'wav');
         $L = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('L');
         if (isset($L)) {
             $urlParams['L'] = htmlspecialchars($L);
         }
         if ($GLOBALS['TSFE']->MP) {
             $urlParams['MP'] = $GLOBALS['TSFE']->MP;
         }
         $audioURL = $siteURL . 'index.php?' . ltrim(\TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $urlParams), '&');
         if ($settings['accessibleOutputImage']) {
             if ($browerIsIE8) {
                 $value = '<a href="' . $audioURL . '&set=' . rand() . '" title="' . $translator->render('click_here_accessible') . '">' . '<img alt="' . $translator->render('click_here_accessible') . '"' . ' src="' . $siteURL . str_replace(PATH_site, '', \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($settings['accessibleOutputImage'])) . '"' . $this->getClassAttribute('image-accessible', $suffix) . ' />' . '</a>';
             } else {
                 $value = '<input type="image" alt="' . $translator->render('click_here_accessible') . '"' . ' title="' . $translator->render('click_here_accessible') . '"' . ' src="' . $siteURL . str_replace(PATH_site, '', \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($settings['accessibleOutputImage'])) . '"' . ' onclick="' . $this->extensionName . '.playCaptcha(\'' . $fakeId . '\', \'' . $audioURL . '\', \'' . $translator->render('noPlayMessage') . '\');return false;" style="cursor: pointer;"' . $this->getClassAttribute('image-accessible', $suffix) . ' />';
             }
         } else {
             if ($browerIsIE8) {
                 $value = '<span id="tx_srfreecap_captcha_playLink_' . $fakeId . '"' . $this->getClassAttribute('accessible-link', $suffix) . '>' . $translator->render('click_here_accessible_before_link') . '<a href="' . $audioURL . '&set=' . rand() . '"' . ' title="' . $translator->render('click_here_accessible') . '">' . $translator->render('click_here_accessible_link') . '</a>' . $translator->render('click_here_accessible_after_link') . '</span>';
             } else {
                 $value = '<span id="tx_srfreecap_captcha_playLink_' . $fakeId . '"' . $this->getClassAttribute('accessible-link', $suffix) . '>' . $translator->render('click_here_accessible_before_link') . '<a onClick="' . $this->extensionName . '.playCaptcha(\'' . $fakeId . '\', \'' . $audioURL . '\', \'' . $translator->render('noPlayMessage') . '\');" style="cursor: pointer;" title="' . $translator->render('click_here_accessible') . '">' . $translator->render('click_here_accessible_link') . '</a>' . $translator->render('click_here_accessible_after_link') . '</span>';
             }
         }
         $value .= '<span' . $this->getClassAttribute('accessible', $suffix) . ' id="tx_srfreecap_captcha_playAudio_' . $fakeId . '"></span>';
     }
     return $value;
 }
コード例 #3
0
    /**
     * Formats and echoes the exception as XHTML.
     *
     * @param \Throwable $exception The throwable object.
     * @return void
     */
    public function echoExceptionWeb(\Throwable $exception)
    {
        $this->sendStatusHeaders($exception);
        $filePathAndName = $exception->getFile();
        $exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
        $moreInformationLink = $exceptionCodeNumber !== '' ? '(<a href="' . TYPO3_URL_EXCEPTION . 'debug/' . $exception->getCode() . '" target="_blank">More information</a>)' : '';
        $backtraceCode = $this->getBacktraceCode($exception->getTrace());
        $this->writeLogEntries($exception, self::CONTEXT_WEB);
        // Set the XML prologue
        $xmlPrologue = '<?xml version="1.0" encoding="utf-8"?>';
        // Set the doctype declaration
        $docType = '<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.1//EN"
     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
        // Get the browser info
        $browserInfo = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
        // Put the XML prologue before or after the doctype declaration according to browser
        if ($browserInfo['browser'] === 'msie' && $browserInfo['version'] < 7) {
            $headerStart = $docType . LF . $xmlPrologue;
        } else {
            $headerStart = $xmlPrologue . LF . $docType;
        }
        echo $headerStart . '
			<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
				<head>
					<title>TYPO3 Exception</title>
					<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
					<style type="text/css">
						.ExceptionProperty {
							color: #101010;
						}
						pre {
							margin: 0;
							font-size: 11px;
							color: #515151;
							background-color: #D0D0D0;
							padding-left: 30px;
						}
					</style>
				</head>
				<body>
					<div style="
							position: absolute;
							left: 10px;
							background-color: #B9B9B9;
							outline: 1px solid #515151;
							color: #515151;
							font-family: Arial, Helvetica, sans-serif;
							font-size: 12px;
							margin: 10px;
							padding: 0;
						">
						<div style="width: 100%; background-color: #515151; color: white; padding: 2px; margin: 0 0 6px 0;">Uncaught TYPO3 Exception</div>
						<div style="width: 100%; padding: 2px; margin: 0 0 6px 0;">
							<strong style="color: #BE0027;">' . $exceptionCodeNumber . htmlspecialchars($exception->getMessage()) . '</strong> ' . $moreInformationLink . '<br />
							<br />
							<span class="ExceptionProperty">' . get_class($exception) . '</span> thrown in file<br />
							<span class="ExceptionProperty">' . htmlspecialchars($filePathAndName) . '</span> in line
							<span class="ExceptionProperty">' . $exception->getLine() . '</span>.<br />
							<br />
							' . $backtraceCode . '
						</div>
					</div>
				</body>
			</html>
		';
    }
コード例 #4
0
 /**
  * Client Browser Information
  *
  * @return array Contains keys "user agent", "browser", "version", "system"
  */
 protected function clientInfo()
 {
     $userAgent = GeneralUtility::getIndpEnv('HTTP_USER_AGENT');
     $browserInfo = ClientUtility::getBrowserInfo($userAgent);
     // Known engines: order is not irrelevant!
     $knownEngines = array('opera', 'msie', 'gecko', 'webkit');
     if (is_array($browserInfo['all'])) {
         foreach ($knownEngines as $engine) {
             if ($browserInfo['all'][$engine]) {
                 $browserInfo['browser'] = $engine;
                 $browserInfo['version'] = ClientUtility::getVersion($browserInfo['all'][$engine]);
                 break;
             }
         }
     }
     return $browserInfo;
 }
コード例 #5
0
 /**
  * Gets a code for a browsing device based on the input useragent string.
  *
  * @param string $userAgent The useragent string, \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT')
  * @return string Code for the specific device type
  */
 protected function getDeviceType($userAgent)
 {
     return \TYPO3\CMS\Core\Utility\ClientUtility::getDeviceType($userAgent);
 }
コード例 #6
0
ファイル: Installer.php プロジェクト: noxludo/TYPO3v4-Core
    /**
     * This wraps and returns the main content of the page into proper html-code.
     *
     * @param string $content The page content
     * @return string The full HTML page
     * @todo Define visibility
     */
    public function outputWrapper($content)
    {
        // Get the template file
        if (!$this->passwordOK) {
            $this->template = @file_get_contents(PATH_site . $this->templateFilePath . 'Install_login.html');
        } elseif ($this->mode == '123') {
            $this->template = @file_get_contents(PATH_site . $this->templateFilePath . 'Install_123.html');
        } else {
            $this->template = @file_get_contents(PATH_site . $this->templateFilePath . 'Install.html');
        }
        // Add prototype to javascript array for output
        $this->javascript[] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename('../contrib/prototype/prototype.js') . '"></script>';
        // Add JS functions for output
        $this->javascript[] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename('../sysext/install/Resources/Public/Javascript/install.js') . '"></script>';
        // Include the default stylesheets
        $this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/reset.css') . '" />';
        $this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/general.css') . '" />';
        // Get the browser info
        $browserInfo = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
        // Add the stylesheet for Internet Explorer
        if ($browserInfo['browser'] === 'msie') {
            // IE7
            if (intval($browserInfo['version']) === 7) {
                $this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/ie7.css') . '" />';
            }
        }
        // Include the stylesheets based on screen
        if ($this->mode == '123') {
            $this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/install_123.css') . '" />';
        } elseif ($this->passwordOK) {
            $this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/install.css') . '" />';
        } else {
            $this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/install.css') . '" />';
            $this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/install_login.css') . '" />';
        }
        // Define the markers content
        if ($this->mode == '123') {
            $this->markers['headTitle'] = 'Installing TYPO3 ' . TYPO3_branch;
        } else {
            $this->markers['headTitle'] = '
				TYPO3 ' . TYPO3_version . '
				Install Tool on site: ' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '
			';
        }
        $this->markers['title'] = 'TYPO3 ' . TYPO3_version;
        $this->markers['javascript'] = implode(LF, $this->javascript);
        $this->markers['stylesheets'] = implode(LF, $this->stylesheets);
        $this->markers['llErrors'] = 'The following errors occured';
        $this->markers['copyright'] = $this->copyright();
        $this->markers['charset'] = 'utf-8';
        $this->markers['backendUrl'] = '../index.php';
        $this->markers['backend'] = 'Backend admin';
        $this->markers['frontendUrl'] = '../../index.php';
        $this->markers['frontend'] = 'Frontend website';
        $this->markers['metaCharset'] = 'Content-Type" content="text/html; charset=';
        $this->markers['metaCharset'] .= 'utf-8';
        // Add the error messages
        if (!empty($this->errorMessages)) {
            // Get the subpart for all error messages
            $errorMessagesSubPart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->template, '###ERRORMESSAGES###');
            // Get the subpart for a single error message
            $errorMessageSubPart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($errorMessagesSubPart, '###MESSAGES###');
            $errors = array();
            foreach ($this->errorMessages as $errorMessage) {
                // Define the markers content
                $errorMessageMarkers = array('message' => $errorMessage);
                // Fill the markers in the subpart
                $errors[] = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($errorMessageSubPart, $errorMessageMarkers, '###|###', TRUE, FALSE);
            }
            // Substitute the subpart for a single message
            $errorMessagesSubPart = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($errorMessagesSubPart, '###MESSAGES###', implode(LF, $errors));
        }
        // Version subpart is only allowed when password is ok
        if ($this->passwordOK) {
            // Get the subpart for the version
            $versionSubPart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->template, '###VERSIONSUBPART###');
            // Define the markers content
            $versionSubPartMarkers['version'] = 'Version: ' . TYPO3_version;
            // Fill the markers in the subpart
            $versionSubPart = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($versionSubPart, $versionSubPartMarkers, '###|###', TRUE, FALSE);
        }
        // Substitute the version subpart
        $this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->template, '###VERSIONSUBPART###', $versionSubPart);
        // Substitute the menu subpart
        $this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->template, '###MENU###', $this->menu());
        // Substitute the error messages subpart
        $this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->template, '###ERRORMESSAGES###', $errorMessagesSubPart);
        // Substitute the content subpart
        $this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->template, '###CONTENT###', $content);
        // Fill the markers
        $this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($this->template, $this->markers, '###|###', TRUE, FALSE);
        return $this->template;
    }
コード例 #7
0
 /**
  * Reviews and adjusts plugin settings
  *
  * @return void
  * @api
  */
 protected function processSettings()
 {
     // Set the list of language uid's
     if (!$this->settings['languages']) {
         // Take the list from TypoScript, if any
         $this->settings['languages'] = strval($this->settings['languagesUidsList']);
     } else {
         // The list was set in the flexform
         $languagesArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->settings['languages'], TRUE);
         $positionOfDefaultLanguage = min(intval($this->settings['positionOfDefaultLanguage']), count($languagesArray));
         array_splice($languagesArray, $positionOfDefaultLanguage, 0, array('0'));
         $this->settings['languages'] = implode(',', $languagesArray);
     }
     // Backward compatibility settings for language labels
     if (!isset($this->settings['languageTitle']) || !in_array($this->settings['languageTitle'], array(0, 1, 2, 3))) {
         if ($this->settings['useSysLanguageTitle']) {
             $this->settings['languageTitle'] = 2;
         } else {
             if ($this->settings['useIsoLanguageCountryCode']) {
                 $this->settings['languageTitle'] = 3;
             } else {
                 if ($this->settings['useSelfLanguageTitle']) {
                     $this->settings['languageTitle'] = 1;
                 } else {
                     $this->settings['languageTitle'] = 0;
                 }
             }
         }
     }
     // Map numeric layout to keyword
     if (!isset($this->settings['layout'])) {
         $this->settings['layout'] = $this->settings['defaultLayout'];
     }
     $allowedLayouts = array('Flags', 'Select', 'Links');
     // Allow keyword values coming from Fluid widget... and perhaps from TS setup
     if (!in_array($this->settings['layout'], $allowedLayouts)) {
         $this->settings['layout'] = $allowedLayouts[$this->settings['layout']];
         if (!$this->settings['layout']) {
             $this->settings['layout'] = 'Flags';
         }
     }
     // Flags directory
     $this->settings['flagsDirectory'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/Images/Flags/';
     if ($this->settings['englishFlagFile']) {
         $this->settings['flagsDirectory'] = dirname($this->getFrontendObject()->tmpl->getFileName(trim($this->settings['englishFlagFile']))) . '/';
     }
     // 'Hide default translation of page' configuration option
     $this->settings['hideIfDefaultLanguage'] = \TYPO3\CMS\Core\Utility\GeneralUtility::hideIfDefaultLanguage($this->getFrontendObject()->page['l18n_cfg']);
     // Adjust parameters to remove
     if (!is_array($this->settings['removeParams'])) {
         $this->settings['removeParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->settings['removeParams'], TRUE);
         // Add L and cHash to url parameters to remove
         $this->settings['removeParams'] = array_merge($this->settings['removeParams'], array('L', 'cHash'));
         // Add disallowed url query parameters
         if ($this->settings['allowedParams']) {
             $allowedParams = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->settings['allowedParams'], TRUE);
             $allowedParams = array_merge($allowedParams, array('L', 'id', 'type', 'MP'));
             $allowedParams = array_merge($allowedParams, \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->getFrontendObject()->config['config']['linkVars'], TRUE));
             $disallowedParams = array_diff(array_keys($GLOBALS['HTTP_GET_VARS']), $allowedParams);
             // Add disallowed parameters to parameters to remove
             $this->settings['removeParams'] = array_merge($this->settings['removeParams'], $disallowedParams);
         }
     }
     // Identify IE > 9
     $browserInfo = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
     $this->settings['isIeGreaterThan9'] = $browserInfo['browser'] == 'msie' && intval($browserInfo['version']) > 9 ? 1 : 0;
 }
コード例 #8
0
    /**
     * Returns page start
     * This includes the proper header with charset, title, meta tag and beginning body-tag.
     *
     * @param string $title HTML Page title for the header
     * @param boolean $includeCsh flag for including CSH
     * @return string Returns the whole header section of a HTML-document based on settings in internal variables (like styles, javascript code, charset, generator and docType)
     * @see endPage()
     * @todo Define visibility
     */
    public function startPage($title, $includeCsh = TRUE)
    {
        // hook pre start page
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'])) {
            $preStartPageHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'];
            if (is_array($preStartPageHook)) {
                $hookParameters = array('title' => &$title);
                foreach ($preStartPageHook as $hookFunction) {
                    GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        $this->pageRenderer->backPath = $this->backPath;
        // alternative template for Header and Footer
        if ($this->pageHeaderFooterTemplateFile) {
            $file = GeneralUtility::getFileAbsFileName($this->pageHeaderFooterTemplateFile, TRUE);
            if ($file) {
                $this->pageRenderer->setTemplateFile($file);
            }
        }
        // Send HTTP header for selected charset. Added by Robert Lemke 23.10.2003
        header('Content-Type:text/html;charset=' . $this->charset);
        // Standard HTML tag
        $htmlTag = '<html xmlns="http://www.w3.org/1999/xhtml">';
        switch ($this->docType) {
            case 'html_3':
                $headerStart = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
                $htmlTag = '<html>';
                // Disable rendering of XHTML tags
                $this->pageRenderer->setRenderXhtml(FALSE);
                break;
            case 'xhtml_strict':
                $headerStart = '<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
                break;
            case 'xhtml_frames':
                $headerStart = '<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
                break;
            case 'xhtml_trans':
                $headerStart = '<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
                break;
            case 'html5':
            default:
                // The fallthrough is intended as HTML5, as this is the default for the BE since TYPO3 4.5
                $headerStart = '<!DOCTYPE html>' . LF;
                $htmlTag = '<html>';
                // Disable rendering of XHTML tags
                $this->pageRenderer->setRenderXhtml(FALSE);
        }
        $this->pageRenderer->setHtmlTag($htmlTag);
        // This loads the tabulator-in-textarea feature. It automatically modifies
        // every textarea which is found.
        if (!$GLOBALS['BE_USER']->uc['disableTabInTextarea']) {
            $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/tab.js');
        }
        // Include the JS for the Context Sensitive Help
        if ($includeCsh) {
            $this->loadCshJavascript();
        }
        // Get the browser info
        $browserInfo = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo(GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
        // Set the XML prologue
        $xmlPrologue = '<?xml version="1.0" encoding="' . $this->charset . '"?>';
        // Set the XML stylesheet
        $xmlStylesheet = '<?xml-stylesheet href="#internalStyle" type="text/css"?>';
        // Add the XML prologue for XHTML doctypes
        if (strpos($this->docType, 'xhtml') !== FALSE) {
            // Put the XML prologue before or after the doctype declaration according to browser
            if ($browserInfo['browser'] === 'msie' && $browserInfo['version'] < 7) {
                $headerStart = $headerStart . LF . $xmlPrologue;
            } else {
                $headerStart = $xmlPrologue . LF . $headerStart;
            }
            // Add the xml stylesheet according to doctype
            if ($this->docType !== 'xhtml_frames') {
                $headerStart = $headerStart . LF . $xmlStylesheet;
            }
        }
        $this->pageRenderer->setXmlPrologAndDocType($headerStart);
        $this->pageRenderer->setHeadTag('<head>' . LF . '<!-- TYPO3 Script ID: ' . htmlspecialchars($this->scriptID) . ' -->');
        $this->pageRenderer->setCharSet($this->charset);
        $this->pageRenderer->addMetaTag($this->generator());
        $this->pageRenderer->addMetaTag('<meta name="robots" content="noindex,follow" />');
        $this->pageRenderer->setFavIcon($this->getBackendFavicon());
        if ($this->useCompatibilityTag) {
            $this->pageRenderer->addMetaTag($this->xUaCompatible($this->xUaCompatibilityVersion));
        }
        $this->pageRenderer->setTitle($title);
        // add docstyles
        $this->docStyle();
        if ($this->extDirectStateProvider) {
            $this->pageRenderer->addJsFile($this->backPath . 'sysext/backend/Resources/Public/JavaScript/ExtDirect.StateProvider.js');
        }
        // Add jsCode for overriding the console with a debug panel connection
        $this->pageRenderer->addJsInlineCode('consoleOverrideWithDebugPanel', 'if (typeof top.Ext === "object") {
				top.Ext.onReady(function() {
					if (typeof console === "undefined") {
						if (top && top.TYPO3 && top.TYPO3.Backend && top.TYPO3.Backend.DebugConsole) {
							console = top.TYPO3.Backend.DebugConsole;
						} else {
							console = {
								log: Ext.log,
								info: Ext.log,
								warn: Ext.log,
								error: Ext.log
							};
						}
					}
				});
			}
			', FALSE);
        $this->pageRenderer->addHeaderData($this->JScode);
        foreach ($this->JScodeArray as $name => $code) {
            $this->pageRenderer->addJsInlineCode($name, $code, FALSE);
        }
        if (count($this->JScodeLibArray)) {
            foreach ($this->JScodeLibArray as $library) {
                $this->pageRenderer->addHeaderData($library);
            }
        }
        if ($this->extJScode) {
            $this->pageRenderer->addExtOnReadyCode($this->extJScode);
        }
        // hook for additional headerData
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'])) {
            $preHeaderRenderHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'];
            if (is_array($preHeaderRenderHook)) {
                $hookParameters = array('pageRenderer' => &$this->pageRenderer);
                foreach ($preHeaderRenderHook as $hookFunction) {
                    GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        // Construct page header.
        $str = $this->pageRenderer->render(PageRenderer::PART_HEADER);
        $this->JScodeLibArray = array();
        $this->JScode = $this->extJScode = '';
        $this->JScodeArray = array();
        $this->endOfPageJsBlock = $this->pageRenderer->render(PageRenderer::PART_FOOTER);
        if ($this->docType == 'xhtml_frames') {
            return $str;
        } else {
            $str .= $this->docBodyTagBegin() . ($this->divClass ? '

<!-- Wrapping DIV-section for whole page BEGIN -->
<div class="' . $this->divClass . '">
' : '') . trim($this->form);
        }
        return $str;
    }
コード例 #9
0
 /**
  * @test
  */
 public function getBrowserInfoReturnsCorrectBrowserValueForUserAgentStringOfKonqueror()
 {
     $userAgentString = 'Mozilla/5.0 (compatible; Konqueror/4.4; FreeBSD) KHTML/4.4.5 (like Gecko)';
     $infoArray = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo($userAgentString);
     $this->assertSame('konqueror', $infoArray['browser']);
 }