diff --git a/typo3/sysext/rtehtmlarea/Classes/Hook/Frontend/Controller/TypoScriptFrontendControllerHook.php b/typo3/sysext/rtehtmlarea/Classes/Hook/Frontend/Controller/TypoScriptFrontendControllerHook.php new file mode 100644 index 0000000000000000000000000000000000000000..04f63ef283dc288f570f34b6a3a0ddfc07ffe3ed --- /dev/null +++ b/typo3/sysext/rtehtmlarea/Classes/Hook/Frontend/Controller/TypoScriptFrontendControllerHook.php @@ -0,0 +1,50 @@ +<?php +namespace TYPO3\CMS\Rtehtmlarea\Hook\Frontend\Controller; +/*************************************************************** + * Copyright notice + * + * (c) 2014 Stanislas Rolland <stanislas.rolland@typo3.org> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the text file GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. + * + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ +/** + * Frontend hook to add meta tag when rtehtmlarea is present and user agent is IE 11+ + * + */ +class TypoScriptFrontendControllerHook { + + /** + * 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); + } + } + } +} diff --git a/typo3/sysext/rtehtmlarea/Configuration/Hook/Frontend/Controller/ext_localconf.php b/typo3/sysext/rtehtmlarea/Configuration/Hook/Frontend/Controller/ext_localconf.php new file mode 100644 index 0000000000000000000000000000000000000000..bd35116a637550fc7af2a44a4c15a7adf215b072 --- /dev/null +++ b/typo3/sysext/rtehtmlarea/Configuration/Hook/Frontend/Controller/ext_localconf.php @@ -0,0 +1,8 @@ +<?php +if (!defined('TYPO3_MODE')) { + die('Access denied.'); +} +if (TYPO3_MODE === 'FE') { + // Register frontend hook to add meta tag when rtehtmlarea is present and user agent is IE 11+ + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output']['rtehtmlarea'] = 'TYPO3\\CMS\\Rtehtmlarea\\Hook\\Frontend\\Controller\\TypoScriptFrontendControllerHook->contentPostProcOutput'; +} diff --git a/typo3/sysext/rtehtmlarea/ext_localconf.php b/typo3/sysext/rtehtmlarea/ext_localconf.php index 32e8d5de55bb65409a2f3405d8367096761a9775..4b5d6555d310c7bbd005caa24ae4a7520e84bd5d 100644 --- a/typo3/sysext/rtehtmlarea/ext_localconf.php +++ b/typo3/sysext/rtehtmlarea/ext_localconf.php @@ -67,6 +67,8 @@ if (strstr($_EXTCONF['defaultConfiguration'], 'Minimal')) { require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'hooks/softref/ext_localconf.php'; // Add Status Report about Conflicting Extensions require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'hooks/statusreport/ext_localconf.php'; +// Add frontend hook to add meta tag when rtehtmlarea is present and user agent is IE 11+ +require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/Hook/Frontend/Controller/ext_localconf.php'; // Configure Lorem Ipsum hook to insert nonsense in wysiwyg mode if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('lorem_ipsum') && TYPO3_MODE == 'BE') {