diff --git a/typo3/sysext/frontend/Classes/Hooks/FrontendHooks.php b/typo3/sysext/frontend/Classes/Hooks/FrontendHooks.php
index 09dd58267dae..bc77eb797914 100644
--- a/typo3/sysext/frontend/Classes/Hooks/FrontendHooks.php
+++ b/typo3/sysext/frontend/Classes/Hooks/FrontendHooks.php
@@ -14,8 +14,11 @@
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Core\Localization\LanguageService;
+use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
+
/**
- * Uses frontend hooks to show preview informations
+ * Uses frontend hooks to show preview information
*/
class FrontendHooks
{
@@ -24,7 +27,7 @@ class FrontendHooks
* in the LIVE workspace
*
* @param array $params
- * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj
+ * @param TypoScriptFrontendController $pObj
* @return string
*/
public function hook_previewInfo($params, $pObj)
@@ -35,6 +38,7 @@ public function hook_previewInfo($params, $pObj)
if ($pObj->config['config']['message_preview']) {
$message = $pObj->config['config']['message_preview'];
} else {
+ $label = $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_tsfe.xlf:preview');
$styles = [];
$styles[] = 'position: fixed';
$styles[] = 'top: 15px';
@@ -48,11 +52,19 @@ public function hook_previewInfo($params, $pObj)
$styles[] = 'color: #856404';
$styles[] = 'z-index: 20000';
$styles[] = 'user-select: none';
- $styles[] = 'pointer-events:none';
+ $styles[] = 'pointer-events: none';
$styles[] = 'text-align: center';
$styles[] = 'border-radius: 2px';
- $message = '
PREVIEW
';
+ $message = '' . htmlspecialchars($label) . '
';
}
return $message;
}
+
+ /**
+ * @return LanguageService
+ */
+ protected function getLanguageService()
+ {
+ return $GLOBALS['LANG'];
+ }
}
diff --git a/typo3/sysext/workspaces/Classes/Middleware/WorkspacePreview.php b/typo3/sysext/workspaces/Classes/Middleware/WorkspacePreview.php
index dc436ed2c3d7..8999aaa10bb8 100644
--- a/typo3/sysext/workspaces/Classes/Middleware/WorkspacePreview.php
+++ b/typo3/sysext/workspaces/Classes/Middleware/WorkspacePreview.php
@@ -23,8 +23,8 @@
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Http\NormalizedParams;
use TYPO3\CMS\Core\Http\Stream;
+use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
use TYPO3\CMS\Workspaces\Authentication\PreviewUserAuthentication;
@@ -121,20 +121,22 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
*/
protected function getLogoutTemplateMessage(string $returnUrl = ''): string
{
+ $returnUrl = GeneralUtility::sanitizeLocalUrl($returnUrl);
+ $returnUrl = $this->removePreviewParameterFromUrl($returnUrl);
if ($GLOBALS['TYPO3_CONF_VARS']['FE']['workspacePreviewLogoutTemplate']) {
$templateFile = GeneralUtility::getFileAbsFileName($GLOBALS['TYPO3_CONF_VARS']['FE']['workspacePreviewLogoutTemplate']);
if (@is_file($templateFile)) {
$message = file_get_contents($templateFile);
} else {
- $message = 'ERROR!
Template File "'
- . $GLOBALS['TYPO3_CONF_VARS']['FE']['workspacePreviewLogoutTemplate']
- . '" configured with $TYPO3_CONF_VARS["FE"]["workspacePreviewLogoutTemplate"] not found. Please contact webmaster about this problem.';
+ $message = $this->getLanguageService()->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang_mod.xlf:previewLogoutError');
+ $message = htmlspecialchars($message);
+ $message = sprintf($message, '', '
', $templateFile);
}
} else {
- $message = 'You logged out from Workspace preview mode. Click this link to go back to the website';
+ $message = $this->getLanguageService()->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang_mod.xlf:previewLogoutSuccess');
+ $message = htmlspecialchars($message);
+ $message = sprintf($message, '', '');
}
- $returnUrl = GeneralUtility::sanitizeLocalUrl($returnUrl);
- $returnUrl = $this->removePreviewParameterFromUrl($returnUrl);
return sprintf($message, htmlspecialchars($returnUrl));
}
@@ -154,7 +156,7 @@ protected function getLogoutTemplateMessage(string $returnUrl = ''): string
* @return array Preview configuration array from sys_preview record.
* @throws \Exception
*/
- protected function getPreviewConfigurationFromRequest(ServerRequestInterface $request, string $inputCode)
+ protected function getPreviewConfigurationFromRequest(ServerRequestInterface $request, string $inputCode): array
{
$previewData = $this->getPreviewData($inputCode);
if (!is_array($previewData)) {
@@ -285,16 +287,15 @@ protected function renderPreviewInfo(TypoScriptFrontendController $tsfe, Normali
$currentWorkspaceId ?? -99
);
} else {
- $text = LocalizationUtility::translate(
- 'LLL:EXT:workspaces/Resources/Private/Language/locallang_mod.xlf:previewText',
- 'workspaces',
- [$currentWorkspaceTitle, $currentWorkspaceId ?? -99]
- );
+ $text = $this->getLanguageService()->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang_mod.xlf:previewText');
$text = htmlspecialchars($text);
+ $text = sprintf($text, $currentWorkspaceTitle, $currentWorkspaceId ?? -99);
+ $stopPreviewText = $this->getLanguageService()->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang_mod.xlf:stopPreview');
+ $stopPreviewText = htmlspecialchars($stopPreviewText);
if ($GLOBALS['BE_USER'] instanceof PreviewUserAuthentication) {
$url = $this->removePreviewParameterFromUrl($normalizedParams->getRequestUri());
$urlForStoppingPreview = $normalizedParams->getSiteUrl() . 'index.php?returnUrl=' . rawurlencode($url) . '&ADMCMD_prev=LOGOUT';
- $text .= '
Stop preview';
+ $text .= '
' . $stopPreviewText . '';
}
$styles = [];
$styles[] = 'position: fixed';
@@ -352,4 +353,12 @@ protected function removePreviewParameterFromUrl(string $url): string
{
return (string)preg_replace('/\\&?' . $this->previewKey . '=[[:alnum:]]+/', '', $url);
}
+
+ /**
+ * @return LanguageService
+ */
+ protected function getLanguageService(): LanguageService
+ {
+ return $GLOBALS['LANG'] ?: GeneralUtility::makeInstance(LanguageService::class);
+ }
}
diff --git a/typo3/sysext/workspaces/Resources/Private/Language/locallang_mod.xlf b/typo3/sysext/workspaces/Resources/Private/Language/locallang_mod.xlf
index da322ec6c493..a2fcfacd6c77 100644
--- a/typo3/sysext/workspaces/Resources/Private/Language/locallang_mod.xlf
+++ b/typo3/sysext/workspaces/Resources/Private/Language/locallang_mod.xlf
@@ -30,6 +30,15 @@
+
+
+
+
+
+
+
+
+