[TASK] lang: hscAndCharConv is not needed anymore.
authorBenjamin Mack <benni@typo3.org>
Thu, 7 Jul 2011 20:40:23 +0000 (22:40 +0200)
committerAndreas Wolf <andreas.wolf@ikt-werk.de>
Fri, 8 Jul 2011 07:50:44 +0000 (09:50 +0200)
The functionality is not needed anymore, and is
now only a wrapper for htmlspecialchars().

Change-Id: I71d4fc210105d128de315d5777abbc555067deaf
Resolves: #27965
Reviewed-on: http://review.typo3.org/3115
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
Reviewed-by: Philipp Gampe
Reviewed-by: Stefan Neufeind
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
t3lib/class.t3lib_befunc.php
t3lib/class.t3lib_tceforms.php
typo3/sysext/lang/lang.php
typo3/view_help.php

index e5c7ac2..5dee78e 100644 (file)
@@ -2642,7 +2642,7 @@ final class t3lib_BEfunc {
                                        </tr>
                                        </table>';
 
-                                       $output = $GLOBALS['LANG']->hscAndCharConv($fullText, FALSE);
+                                       $output = $fullText;
                                } else {
                                        $output = $icon;
 
index 3e32d8c..5794cb1 100644 (file)
@@ -5228,7 +5228,7 @@ class t3lib_TCEforms {
                                           $fDat['details'] || $fDat['syntax'] || $fDat['image_descr'] || $fDat['image'] || $fDat['seeAlso']
                                   ) .
                                   '</td><td valign="top"><span class="typo3-TCEforms-helpText">' .
-                                  $GLOBALS['LANG']->hscAndCharConv(strip_tags($fDat['description']), 1) .
+                                  htmlspecialchars(strip_tags($fDat['description'])) .
                                   '</span></td></tr></table>';
                }
        }
@@ -5261,7 +5261,7 @@ class t3lib_TCEforms {
                                        if ($alttitle) {
                                                $hoverText = '<span class="header">' . $alttitle . '</span><br />' . $hoverText;
                                        }
-                                       $hoverText = '<span class="typo3-csh-inline">' . $GLOBALS['LANG']->hscAndCharConv($hoverText, FALSE) . '</span>';
+                                       $hoverText = '<span class="typo3-csh-inline">' . $hoverText . '</span>';
                                }
 
                                        // CSH exists
@@ -5299,7 +5299,7 @@ class t3lib_TCEforms {
                                                   $cshFile
                                           ) .
                                           '</td><td valign="top"><span class="typo3-TCEforms-helpText-flexform">' .
-                                          $GLOBALS['LANG']->hscAndCharConv(strip_tags($value), 1) .
+                                          htmlspecialchars(strip_tags($value)) .
                                           '</span></td></tr></table>';
                        }
                }
index 5195dc6..da2c71d 100755 (executable)
@@ -252,10 +252,12 @@ class language {
         * @param  string $lStr The string to process
         * @param  boolean $hsc If set, then the string is htmlspecialchars()'ed
         * @return string               The processed string
+        * @deprecated since TYPO3 4.6, will be removed in TYPO3 4.8 - Use htmlspecialchars() instead.
         * @see    init()
         * @access public
         */
        public function hscAndCharConv($lStr, $hsc) {
+               t3lib_div::logDeprecatedFunction();
                        // labels returned from a locallang file used to be in the language of the charset.
                        // Since TYPO3 4.1 they are always in the charset of the BE.
                if ($hsc) {
@@ -335,9 +337,12 @@ class language {
        public function getLL($index, $hsc = FALSE) {
                        // Get Local Language
                if ($GLOBALS['LOCAL_LANG'][$this->lang][$index][0]['target'] !== '') {
-                       $output = $this->hscAndCharConv($GLOBALS['LOCAL_LANG'][$this->lang][$index][0]['target'], $hsc);
+                       $output = $GLOBALS['LOCAL_LANG'][$this->lang][$index][0]['target'];
                } else {
-                       $output = $this->hscAndCharConv($GLOBALS['LOCAL_LANG']['default'][$index][0]['target'], $hsc);
+                       $output = $GLOBALS['LOCAL_LANG']['default'][$index][0]['target'];
+               }
+               if ($hsc) {
+                       $output = htmlspecialchars($output);
                }
                return $output . $this->debugLL($index);
        }
@@ -356,12 +361,10 @@ class language {
                        // Get Local Language. Special handling for all extensions that
                        // read PHP LL files and pass arrays here directly.
                $value = is_string($localLanguage[$this->lang][$index]) ? $localLanguage[$this->lang][$index] : $localLanguage[$this->lang][$index][0]['target'];
-               if ($value !== '') {
-                       $output = $this->hscAndCharConv($value, $hsc);
-               } else {
-                       $output = $this->hscAndCharConv($value, $hsc);
+               if ($hsc) {
+                       $value = htmlspecialchars($value);
                }
-               return $output . $this->debugLL($index);
+               return $value . $this->debugLL($index);
        }
 
        /**
@@ -384,7 +387,10 @@ class language {
                if (strcmp(substr($input, 0, 4), 'LLL:')) {
                        $t = explode('|', $input);
                        $out = $t[$this->langSplitIndex] ? $t[$this->langSplitIndex] : $t[0];
-                       return $this->hscAndCharConv($out, $hsc);
+                       if ($hsc) {
+                               $out = htmlspecialchars($out);
+                       }
+                       return $out;
                        // LOCAL_LANG:
                } else {
                                // If cached label
@@ -609,4 +615,4 @@ if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLA
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/lang/lang.php']);
 }
 
-?>
\ No newline at end of file
+?>
index 7db57ef..3b44339 100644 (file)
@@ -627,7 +627,7 @@ class SC_view_help {
                                                $imgFile = '../'.$imgFile;
                                                $code.= '<br /><img src="'.$imgFile.'" '.$imgInfo[3].' class="c-inlineimg" alt="" /><br />
                                                ';
-                                               $code.= '<p><em>'.$GLOBALS['LANG']->hscAndCharConv($descr,1).'</em></p>
+                                               $code.= '<p><em>' . htmlspecialchars($descr) . '</em></p>
                                                ';
                                        } else $code.= '<div style="background-color: red; border: 1px solid black; color: white;">NOT AN IMAGE: '.$imgFile.'</div>';
                                } else $code.= '<div style="background-color: red; border: 1px solid black; color: white;">IMAGE FILE NOT FOUND: '.$image.'</div>';
@@ -666,7 +666,6 @@ class SC_view_help {
         * @return      string          Formatted content.
         */
        function prepareContent($str)   {
-               $str = $GLOBALS['LANG']->hscAndCharConv($str,0);
                return '<p>'.nl2br(trim(strip_tags($str,$this->allowedHTML))).'</p>
                ';
        }