[TASK] Fix deprecated code calling LanguageService::sL() 11/49611/3
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 29 Aug 2016 07:21:22 +0000 (09:21 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Mon, 29 Aug 2016 12:44:42 +0000 (14:44 +0200)
Calling LanguageService::sL() with true for 2nd argument is deprecated.
Use htmlspecialchars() directly.

Resolves: #77653
Releases: master
Change-Id: Id0d4490747ac94b861f42adfb1acafc63ebf5f07
Reviewed-on: https://review.typo3.org/49611
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/core/Classes/Database/QueryView.php
typo3/sysext/indexed_search/Classes/FileContentParser.php

index 851271c..e71dacc 100644 (file)
@@ -1593,10 +1593,9 @@ class EditDocumentController extends AbstractModule
                     }
                     $languageMenu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
                     $languageMenu->setIdentifier('_langSelector');
-                    $languageMenu->setLabel($this->getLanguageService()->sL(
-                        'LLL:EXT:lang/locallang_general.xlf:LGL.language',
-                        true
-                    ));
+                    $languageMenu->setLabel(htmlspecialchars($this->getLanguageService()->sL(
+                        'LLL:EXT:lang/locallang_general.xlf:LGL.language'
+                    )));
                     foreach ($langRows as $lang) {
                         if ($this->getBackendUser()->checkLanguageAccess($lang['uid'])) {
                             $newTranslation = isset($rowsByLang[$lang['uid']]) ? '' : ' [' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.new')) . ']';
index 992a4b1..b5c0eb7 100644 (file)
@@ -1104,10 +1104,9 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                 // Traverse fields, separated by ";" (displayed in a single cell).
                 foreach ($theFields as $fName2) {
                     if ($GLOBALS['TCA'][$table]['columns'][$fName2]) {
-                        $out[$fieldName] .= '<strong>' . $this->getLanguageService()->sL(
-                            $GLOBALS['TCA'][$table]['columns'][$fName2]['label'],
-                            true
-                        ) . '</strong>' . '&nbsp;&nbsp;' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(
+                        $out[$fieldName] .= '<strong>' . htmlspecialchars($this->getLanguageService()->sL(
+                            $GLOBALS['TCA'][$table]['columns'][$fName2]['label']
+                        )) . '</strong>' . '&nbsp;&nbsp;' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(
                             BackendUtility::getProcessedValue($table, $fName2, $row[$fName2], 0, 0, 0, $row['uid']),
                             25
                         )) . '<br />';
@@ -1802,10 +1801,9 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                     } else {
                         $out .= '<strong>' . $this->getLanguageService()->getLL('noPluginSelected') . '</strong>';
                     }
-                    $out .= $this->getLanguageService()->sL(
-                        BackendUtility::getLabelFromItemlist('tt_content', 'pages', $row['pages']),
-                        true
-                    ) . '<br />';
+                    $out .= htmlspecialchars($this->getLanguageService()->sL(
+                            BackendUtility::getLabelFromItemlist('tt_content', 'pages', $row['pages'])
+                        )) . '<br />';
                     break;
                 default:
                     $contentType = $this->CType_labels[$row['CType']];
index bee71df..6052a66 100644 (file)
@@ -1162,9 +1162,9 @@ class QueryView
                 && $fieldName != 'deleted'
             ) {
                 if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) {
-                    $title = $this->languageService->sL($conf['columns'][$fieldName]['label']
+                    $title = htmlspecialchars($this->languageService->sL($conf['columns'][$fieldName]['label']
                         ? $conf['columns'][$fieldName]['label']
-                        : $fieldName, true);
+                        : $fieldName));
                 } else {
                     $title = htmlspecialchars($this->languageService->sL($fieldName));
                 }
@@ -1195,17 +1195,17 @@ class QueryView
                 || !$SET['queryFields'] && $fieldName != 'pid') {
                 if (!$out) {
                     if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) {
-                        $out = $this->languageService->sL($conf['columns'][$fieldName]['label']
+                        $out = htmlspecialchars($this->languageService->sL($conf['columns'][$fieldName]['label']
                             ? $conf['columns'][$fieldName]['label']
-                            : $fieldName, true);
+                            : $fieldName));
                     } else {
                         $out = htmlspecialchars($this->languageService->sL($fieldName));
                     }
                 } else {
                     if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) {
-                        $out .= ',' . $this->languageService->sL(($conf['columns'][$fieldName]['label']
+                        $out .= ',' . htmlspecialchars($this->languageService->sL(($conf['columns'][$fieldName]['label']
                             ? $conf['columns'][$fieldName]['label']
-                            : $fieldName), true);
+                            : $fieldName)));
                     } else {
                         $out .= ',' . htmlspecialchars($this->languageService->sL($fieldName));
                     }
index 87978ae..f94057a 100644 (file)
@@ -435,12 +435,11 @@ class FileContentParser
      * Wraps the "splitLabel function" of the language object.
      *
      * @param string $reference: Reference/key of the label
-     * @param bool $useHtmlSpecialChar: Convert special chars to HTML entities (default: FALSE)
      * @return string The label of the reference/key to be fetched
      */
-    protected function sL($reference, $useHtmlSpecialChar = false)
+    protected function sL($reference)
     {
-        return $this->langObject->sL($reference, $useHtmlSpecialChar);
+        return $this->langObject->sL($reference);
     }
 
     /************************