[TASK] Use a getter for the LanguageService in ext:version 37/48337/7
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 27 May 2016 14:06:04 +0000 (16:06 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Sat, 28 May 2016 10:28:20 +0000 (12:28 +0200)
Resolves: #76330
Releases: master
Change-Id: Ifff1c2bf9af25bf1a57de4f80ce356dad3462b64
Reviewed-on: https://review.typo3.org/48337
Reviewed-by: Stephan Großberndt <stephan@grossberndt.de>
Tested-by: Stephan Großberndt <stephan@grossberndt.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/version/Classes/ClickMenu/VersionClickMenu.php
typo3/sysext/version/Classes/Controller/VersionModuleController.php
typo3/sysext/version/Classes/Hook/DataHandlerHook.php
typo3/sysext/version/Classes/View/VersionView.php

index 3b53fef..61b71af 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\ClickMenu\ClickMenu;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * "Versioning" item added to click menu of elements.
@@ -59,7 +60,7 @@ class VersionClickMenu
             // "Versioning" element added:
             $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid));
             $localItems[] = $backRef->linkItem(
-                $GLOBALS['LANG']->getLLL('title', $LL),
+                $this->getLanguageService()->getLLL('title', $LL),
                 $this->iconFactory->getIcon('actions-version-page-open', Icon::SIZE_SMALL)->render(),
                 $backRef->urlRefForCM($url),
                 true
@@ -87,6 +88,14 @@ class VersionClickMenu
      */
     public function includeLL()
     {
-        return $GLOBALS['LANG']->includeLLFile('EXT:version/Resources/Private/Language/locallang.xlf', false);
+        return $this->getLanguageService()->includeLLFile('EXT:version/Resources/Private/Language/locallang.xlf', false);
+    }
+
+    /**
+     * @return LanguageService
+     */
+    protected function getLanguageService()
+    {
+        return $GLOBALS['LANG'];
     }
 }
index 944632f..157dc3b 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\DiffUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Versioning module, including workspace management
@@ -127,7 +128,7 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
     public function __construct()
     {
         $GLOBALS['SOBE'] = $this;
-        $GLOBALS['LANG']->includeLLFile('EXT:version/Resources/Private/Language/locallang.xlf');
+        $this->getLanguageService()->includeLLFile('EXT:version/Resources/Private/Language/locallang.xlf');
         $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
     }
 
@@ -211,13 +212,13 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
             $markers['CONTENT'] = $this->content;
         } else {
             // If no access or id value, create empty document
-            $this->content = '<h2>' . htmlspecialchars($GLOBALS['LANG']->getLL('clickAPage_header')) . '</h2><div>' . $GLOBALS['LANG']->getLL('clickAPage_content') . '</div>';
+            $this->content = '<h2>' . htmlspecialchars($this->getLanguageService()->getLL('clickAPage_header')) . '</h2><div>' . $this->getLanguageService()->getLL('clickAPage_content') . '</div>';
             // Setting up the buttons and markers for docheader
             $docHeaderButtons = $this->getButtons();
             $markers['CONTENT'] = $this->content;
         }
         // Build the <body> for the module
-        $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
+        $this->content = $this->doc->startPage($this->getLanguageService()->getLL('title'));
         $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
         $this->content .= $this->doc->endPage();
         $this->content = $this->doc->insertStylesAndJS($this->content);
@@ -240,7 +241,7 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
         if ($this->recordFound && $GLOBALS['TCA'][$this->table]['ctrl']['versioningWS']) {
             // View page
             $buttons['view'] = '
-                               <a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage')) . '">
+                               <a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage')) . '">
                                        ' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '
                                </a>';
             // Shortcut
@@ -254,7 +255,7 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                    'id' => $this->pageinfo['uid'],
                    'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
                 ]
-            )) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showList')) . '</a>';
+            )) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showList')) . '</a>';
         }
         return $buttons;
     }
@@ -271,13 +272,14 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
      */
     public function versioningMgm()
     {
+        $lang = $this->getLanguageService();
         // Diffing:
         $diff_1 = GeneralUtility::_POST('diff_1');
         $diff_2 = GeneralUtility::_POST('diff_2');
         if (GeneralUtility::_POST('do_diff')) {
             $content = '';
             $content .= '<div class="panel panel-space panel-default">';
-            $content .= '<div class="panel-heading">' . $GLOBALS['LANG']->getLL('diffing') . '</div>';
+            $content .= '<div class="panel-heading">' . $lang->getLL('diffing') . '</div>';
             if ($diff_1 && $diff_2) {
                 $diff_1_record = BackendUtility::getRecord($this->table, $diff_1);
                 $diff_2_record = BackendUtility::getRecord($this->table, $diff_2);
@@ -286,8 +288,8 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                     $rows = array();
                     $rows[] = '
                                                                        <tr>
-                                                                               <th>' . $GLOBALS['LANG']->getLL('fieldname') . '</th>
-                                                                               <th width="98%">' . $GLOBALS['LANG']->getLL('coloredDiffView') . ':</th>
+                                                                               <th>' . $lang->getLL('fieldname') . '</th>
+                                                                               <th width="98%">' . $lang->getLL('coloredDiffView') . ':</th>
                                                                        </tr>
                                                                ';
                     foreach ($diff_1_record as $fN => $fV) {
@@ -309,13 +311,13 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                     if (count($rows) > 1) {
                         $content .= '<div class="table-fit"><table class="table">' . implode('', $rows) . '</table></div>';
                     } else {
-                        $content .= '<div class="panel-body">' . $GLOBALS['LANG']->getLL('recordsMatchesCompletely') . '</div>';
+                        $content .= '<div class="panel-body">' . $lang->getLL('recordsMatchesCompletely') . '</div>';
                     }
                 } else {
-                    $content .= '<div class="panel-body">' . $GLOBALS['LANG']->getLL('errorRecordsNotFound') . '</div>';
+                    $content .= '<div class="panel-body">' . $lang->getLL('errorRecordsNotFound') . '</div>';
                 }
             } else {
-                $content .= '<div class="panel-body">' . $GLOBALS['LANG']->getLL('errorDiffSources') . '</div>';
+                $content .= '<div class="panel-body">' . $lang->getLL('errorDiffSources') . '</div>';
             }
             $content .= '</div>';
         }
@@ -332,20 +334,20 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                                                        <thead>
                                                                <tr>
                                                                        <th colspan="2" class="col-icon"></th>
-                                                                       <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_title') . '">' . $GLOBALS['LANG']->getLL('tblHeader_title') . '</th>
-                                                                       <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_uid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_uid') . '</i></th>
-                                                                       <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_oid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_oid') . '</i></th>
-                                                                       <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_id') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_id') . '</i></th>
-                                                                       <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_wsid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_wsid') . '</i></th>
-                                                                       <th title="' . htmlspecialchars($GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_state')) . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_state') . '</i></th>
-                                                                       <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_stage') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_stage') . '</i></th>
-                                                                       <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_count') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_count') . '</i></th>
-                                                                       <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_pid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_pid') . '</i></th>
-                                                                       <th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_label') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</i></th>
+                                                                       <th title="' . $lang->getLL('tblHeaderDesc_title') . '">' . $lang->getLL('tblHeader_title') . '</th>
+                                                                       <th title="' . $lang->getLL('tblHeaderDesc_uid') . '"><i>' . $lang->getLL('tblHeader_uid') . '</i></th>
+                                                                       <th title="' . $lang->getLL('tblHeaderDesc_t3ver_oid') . '"><i>' . $lang->getLL('tblHeader_t3ver_oid') . '</i></th>
+                                                                       <th title="' . $lang->getLL('tblHeaderDesc_t3ver_id') . '"><i>' . $lang->getLL('tblHeader_t3ver_id') . '</i></th>
+                                                                       <th title="' . $lang->getLL('tblHeaderDesc_t3ver_wsid') . '"><i>' . $lang->getLL('tblHeader_t3ver_wsid') . '</i></th>
+                                                                       <th title="' . htmlspecialchars($lang->getLL('tblHeaderDesc_t3ver_state')) . '"><i>' . $lang->getLL('tblHeader_t3ver_state') . '</i></th>
+                                                                       <th title="' . $lang->getLL('tblHeaderDesc_t3ver_stage') . '"><i>' . $lang->getLL('tblHeader_t3ver_stage') . '</i></th>
+                                                                       <th title="' . $lang->getLL('tblHeaderDesc_t3ver_count') . '"><i>' . $lang->getLL('tblHeader_t3ver_count') . '</i></th>
+                                                                       <th title="' . $lang->getLL('tblHeaderDesc_pid') . '"><i>' . $lang->getLL('tblHeader_pid') . '</i></th>
+                                                                       <th title="' . $lang->getLL('tblHeaderDesc_t3ver_label') . '"><i>' . $lang->getLL('tblHeader_t3ver_label') . '</i></th>
                                                                        <th></th>
                                                                        <th colspan="2">
                                                                                <button class="btn btn-default btn-sm" type="submit"  name="do_diff" value="true">
-                                                                                       ' . $GLOBALS['LANG']->getLL('diff') . '
+                                                                                       ' . $lang->getLL('diff') . '
                                                                                </button>
                                                                        </th>
                                                                </tr>
@@ -369,8 +371,8 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                                <tr' . ($row['uid'] != $this->uid ? '' : ' class="active"') . '>
                                        <td class="col-icon">' .
                         ($row['uid'] != $this->uid ?
-                            '<a href="' . BackendUtility::getLinkToDataHandlerAction('&cmd[' . $this->table . '][' . $this->uid . '][version][swapWith]=' . $row['uid'] . '&cmd[' . $this->table . '][' . $this->uid . '][version][action]=swap') . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('swapWithCurrent')) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-version-swap-version', Icon::SIZE_SMALL)->render() . '</a>' :
-                            '<span title="' . htmlspecialchars($GLOBALS['LANG']->getLL('currentOnlineVersion')) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('status-status-current', Icon::SIZE_SMALL)->render() . '</span>'
+                            '<a href="' . BackendUtility::getLinkToDataHandlerAction('&cmd[' . $this->table . '][' . $this->uid . '][version][swapWith]=' . $row['uid'] . '&cmd[' . $this->table . '][' . $this->uid . '][version][action]=swap') . '" title="' . htmlspecialchars($lang->getLL('swapWithCurrent')) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-version-swap-version', Icon::SIZE_SMALL)->render() . '</a>' :
+                            '<span title="' . htmlspecialchars($lang->getLL('currentOnlineVersion')) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('status-status-current', Icon::SIZE_SMALL)->render() . '</span>'
                         ) . '
                                        </td>
                                        <td class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($this->table, $row, Icon::SIZE_SMALL)->render() . '</td>
@@ -384,7 +386,7 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                                        <td>' . $row['t3ver_count'] . '</td>
                                        <td>' . $row['pid'] . '</td>
                                        <td>
-                                               <a href="' . htmlspecialchars($editUrl) . '" title="' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit')) . '">
+                                               <a href="' . htmlspecialchars($editUrl) . '" title="' . htmlspecialchars($lang->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit')) . '">
                                                        ' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '
                                                </a>' . htmlspecialchars($row['t3ver_label']) . '
                                        </td>
@@ -412,28 +414,28 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                                        </div>
                                </div>
                        </form>';
-        $this->content .= '<h2>' . htmlspecialchars($GLOBALS['LANG']->getLL('title')) . '</h2><div>' . $content . '</div>';
+        $this->content .= '<h2>' . htmlspecialchars($lang->getLL('title')) . '</h2><div>' . $content . '</div>';
         // Create new:
         $content = '
                        <form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db')) . '" method="post">
                                <div class="row">
                                        <div class="col-sm-6 col-md-4 col-lg-3">
                                                <div class="form-group">
-                                                       <label for="typo3-new-version-label">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</label>
+                                                       <label for="typo3-new-version-label">' . $lang->getLL('tblHeader_t3ver_label') . '</label>
                                                        <input id="typo3-new-version-label" class="form-control" type="text" name="cmd[' . $this->table . '][' . $this->uid . '][version][label]" />
                                                </div>
                                                <div class="form-group">
                                                        <input type="hidden" name="cmd[' . $this->table . '][' . $this->uid . '][version][action]" value="new" />
                                                        <input type="hidden" name="prErr" value="1" />
                                                        <input type="hidden" name="redirect" value="' . htmlspecialchars($this->REQUEST_URI) . '" />
-                                                       <input class="btn btn-default" type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('createNewVersion') . '" />
+                                                       <input class="btn btn-default" type="submit" name="_" value="' . $lang->getLL('createNewVersion') . '" />
                                                </div>
                                        </div>
                                </div>
                        </form>
 
                ';
-        $this->content .= '<h2>' . htmlspecialchars($GLOBALS['LANG']->getLL('createNewVersion')) . '</h2><div>' . $content . '</div>';
+        $this->content .= '<h2>' . htmlspecialchars($lang->getLL('createNewVersion')) . '</h2><div>' . $content . '</div>';
     }
 
     /**
@@ -456,7 +458,7 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                                        <table class="table">
                                                <tr>
                                                        <th class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . '</th>
-                                                       <th class="col-title">' . htmlspecialchars($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'])) . '</th>
+                                                       <th class="col-title">' . htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$table]['ctrl']['title'])) . '</th>
                                                        <th></th>
                                                        <th></th>
                                                </tr>';
@@ -523,9 +525,9 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
             ],
             'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
         ]);
-        $adminLink = '<a class="btn btn-default" href="' . htmlspecialchars($editUrl) . '" title="' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit')) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
+        $adminLink = '<a class="btn btn-default" href="' . htmlspecialchars($editUrl) . '" title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit')) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
         // Delete link:
-        $adminLink .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete')) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
+        $adminLink .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete')) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
         if ($table === 'pages') {
             // If another page module was specified, replace the default Page module with the new one
             $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
@@ -564,4 +566,12 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
         $response->getBody()->write($this->content);
         return $response;
     }
+
+    /**
+     * @return LanguageService
+     */
+    protected function getLanguageService()
+    {
+        return $GLOBALS['LANG'];
+    }
 }
index c4e42b8..9dced4b 100644 (file)
@@ -21,6 +21,7 @@ use TYPO3\CMS\Core\Service\MarkerBasedTemplateService;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Versioning\VersionState;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Contains some parts for staging, versioning and workspaces
@@ -551,7 +552,7 @@ class DataHandlerHook
                 $this->workspaceService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
                 // only generate the link if the marker is in the template - prevents database from getting to much entries
                 if (GeneralUtility::isFirstPartOfStr($emailConfig['message'], 'LLL:')) {
-                    $tempEmailMessage = $GLOBALS['LANG']->sL($emailConfig['message']);
+                    $tempEmailMessage = $this->getLanguageService()->sL($emailConfig['message']);
                 } else {
                     $tempEmailMessage = $emailConfig['message'];
                 }
@@ -574,7 +575,7 @@ class DataHandlerHook
             // an array of language objects that are needed
             // for emails with different languages
             $languageObjects = array(
-                $GLOBALS['LANG']->lang => $GLOBALS['LANG']
+                $this->getLanguageService()->lang => $this->getLanguageService()
             );
             // loop through each recipient and send the email
             foreach ($emails as $recipientData) {
@@ -969,9 +970,9 @@ class DataHandlerHook
             // Set log entry for live record:
             $propArr = $tcemainObj->getRecordPropertiesFromRow($table, $swapVersion);
             if ($propArr['_ORIG_pid'] == -1) {
-                $label = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tcemain.xlf:version_swap.offline_record_updated');
+                $label = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_tcemain.xlf:version_swap.offline_record_updated');
             } else {
-                $label = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tcemain.xlf:version_swap.online_record_updated');
+                $label = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_tcemain.xlf:version_swap.online_record_updated');
             }
             $theLogId = $tcemainObj->log($table, $id, 2, $propArr['pid'], 0, $label, 10, array($propArr['header'], $table . ':' . $id), $propArr['event_pid']);
             $tcemainObj->setHistory($table, $id, $theLogId);
@@ -980,9 +981,9 @@ class DataHandlerHook
             // Set log entry for offline record:
             $propArr = $tcemainObj->getRecordPropertiesFromRow($table, $curVersion);
             if ($propArr['_ORIG_pid'] == -1) {
-                $label = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tcemain.xlf:version_swap.offline_record_updated');
+                $label = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_tcemain.xlf:version_swap.offline_record_updated');
             } else {
-                $label = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tcemain.xlf:version_swap.online_record_updated');
+                $label = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_tcemain.xlf:version_swap.online_record_updated');
             }
             $theLogId = $tcemainObj->log($table, $swapWith, 2, $propArr['pid'], 0, $label, 10, array($propArr['header'], $table . ':' . $swapWith), $propArr['event_pid']);
             $tcemainObj->setHistory($table, $swapWith, $theLogId);
@@ -1507,4 +1508,12 @@ class DataHandlerHook
     {
         return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\RelationHandler::class);
     }
+
+    /**
+     * @return LanguageService
+     */
+    protected function getLanguageService()
+    {
+        return $GLOBALS['LANG'];
+    }
 }
index e2c915f..f978d8c 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Contains some parts for staging, versioning and workspaces
@@ -40,6 +41,7 @@ class VersionView
             return '';
         }
         if ($GLOBALS['BE_USER']->workspace == 0) {
+            $lang = $this->getLanguageService();
             // Get Current page record:
             $curPage = BackendUtility::getRecord('pages', $id);
             // If the selected page is not online, find the right ID
@@ -53,9 +55,9 @@ class VersionView
                 foreach ($versions as $vRow) {
                     if ($vRow['uid'] == $onlineId) {
                         // Live version
-                        $label = '[' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:version/Resources/Private/Language/locallang.xlf:versionSelect.live')) . ']';
+                        $label = '[' . htmlspecialchars($lang->sL('LLL:EXT:version/Resources/Private/Language/locallang.xlf:versionSelect.live')) . ']';
                     } else {
-                        $label = $vRow['t3ver_label'] . ' (' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:version/Resources/Private/Language/locallang.xlf:versionId')) . ' ' . $vRow['t3ver_id'] . ($vRow['t3ver_wsid'] != 0 ? ' ' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:version/Resources/Private/Language/locallang.xlf:workspaceId')) . ' ' . $vRow['t3ver_wsid'] : '') . ')';
+                        $label = $vRow['t3ver_label'] . ' (' . htmlspecialchars($lang->sL('LLL:EXT:version/Resources/Private/Language/locallang.xlf:versionId')) . ' ' . $vRow['t3ver_id'] . ($vRow['t3ver_wsid'] != 0 ? ' ' . htmlspecialchars($lang->sL('LLL:EXT:version/Resources/Private/Language/locallang.xlf:workspaceId')) . ' ' . $vRow['t3ver_wsid'] : '') . ')';
                     }
                     $opt[] = '<option value="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $vRow['uid']))) . '"' . ($id == $vRow['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>';
                 }
@@ -65,22 +67,22 @@ class VersionView
                 $management = '
                                        <a class="btn btn-default" href="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => 'pages', 'uid' => $onlineId))) . '">
                                                ' . $iconFactory->getIcon('actions-version-page-open', Icon::SIZE_SMALL)->render() . '
-                                               ' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.mgm')) . '
+                                               ' . htmlspecialchars($lang->sL('LLL:EXT:lang/locallang_core.xlf:ver.mgm')) . '
                                        </a>';
                 // Create onchange handler:
                 $onChange = 'window.location.href=this.options[this.selectedIndex].value;';
                 // Controls:
                 if ($id == $onlineId) {
-                    $controls = '<strong class="text-success">' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.online')) . '</strong>';
+                    $controls = '<strong class="text-success">' . htmlspecialchars($lang->sL('LLL:EXT:lang/locallang_core.xlf:ver.online')) . '</strong>';
                 } elseif (!$noAction) {
                     $href = BackendUtility::getLinkToDataHandlerAction(
                         '&cmd[pages][' . $onlineId . '][version][swapWith]=' . $id . '&cmd[pages][' . $onlineId . '][version][action]=swap',
                         GeneralUtility::linkThisScript(array('id' => $onlineId))
                     );
                     $controls = '
-                                               <a href="' . htmlspecialchars($href) . '" class="btn btn-default" title="' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swapPage')) . '">
+                                               <a href="' . htmlspecialchars($href) . '" class="btn btn-default" title="' . htmlspecialchars($lang->sL('LLL:EXT:lang/locallang_core.xlf:ver.swapPage')) . '">
                                                        ' . $iconFactory->getIcon('actions-version-swap-version', Icon::SIZE_SMALL)->render() . '
-                                                       ' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swap')) . '
+                                                       ' . htmlspecialchars($lang->sL('LLL:EXT:lang/locallang_core.xlf:ver.swap')) . '
                                                </a>';
                 }
                 // Write out HTML code:
@@ -90,7 +92,7 @@ class VersionView
                                        -->
                                        <div id="typo3-version-selector" class="form-inline form-inline-spaced">
                                                <div class="form-group">
-                                                       <label for="version-selector">' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:version/Resources/Private/Language/locallang.xlf:versionSelect.label')) . '</label>
+                                                       <label for="version-selector">' . htmlspecialchars($lang->sL('LLL:EXT:version/Resources/Private/Language/locallang.xlf:versionSelect.label')) . '</label>
                                                        <select id="version-selector" class="form-control" onchange="' . htmlspecialchars($onChange) . '">
                                                                ' . implode('', $opt) . '
                                                        </select>
@@ -106,4 +108,12 @@ class VersionView
             }
         }
     }
+
+    /**
+     * @return LanguageService
+     */
+    protected function getLanguageService()
+    {
+        return $GLOBALS['LANG'];
+    }
 }