[BUGFIX] Adjustments to FAL-enabled RTE image and link dialogues
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / class.tx_rtehtmlarea_base.php
index 7172785..f45ece2 100644 (file)
@@ -130,8 +130,9 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
        public $language;
        public $contentTypo3Language;
        public $contentISOLanguage;
-       public $contentCharset;
-       public $OutputCharset;
+       public $charset = 'utf-8';
+       public $contentCharset = 'utf-8';
+       public $OutputCharset = 'utf-8';
        var $editorCSS;
        var $specConf;
        var $toolbar = array();                                 // Save the buttons for the toolbar
@@ -323,15 +324,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                                }
                        }
 
-                               // Character sets: interface and content
-                       $this->charset = $LANG->charSet;
-                       $this->OutputCharset = $this->charset;
-
-                       $this->contentCharset = $LANG->csConvObj->charSetArray[$this->contentTypo3Language];
-                       $this->contentCharset = $this->contentCharset ? $this->contentCharset : 'iso-8859-1';
-                       $this->origContentCharSet = $this->contentCharset;
-                       $this->contentCharset = 'utf-8';
-
                        /* =======================================
                         * TOOLBAR CONFIGURATION
                         * =======================================
@@ -891,10 +883,18 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                }
 
                        // Setting the list of tags to be removed with their contents if specified in the RTE config
-               if (trim($this->thisConfig['removeTagsAndContents']))  {
+               if (trim($this->thisConfig['removeTagsAndContents'])) {
                        $configureRTEInJavascriptString .= '
                        RTEarea[editornumber].htmlRemoveTagsAndContents = /^(' . implode('|', t3lib_div::trimExplode(',', $this->thisConfig['removeTagsAndContents'], 1)) . ')$/i;';
                }
+                       // Setting array of custom tags if specified in the RTE config
+               if (!empty($this->thisConfig['customTags'])) {
+                       $customTags = t3lib_div::trimExplode(',', $this->thisConfig['customTags'], 1);
+                       if (!empty($customTags)) {
+                               $configureRTEInJavascriptString .= '
+                               RTEarea[editornumber].customTags= ' . json_encode($customTags) . ';';
+                       }
+               }
                        // Process default style configuration
                        // This default configuration is deprecated as of TYPO3 4.6 and will be removed in TYPO3 4.8.
                        // Use contentCSS instead.
@@ -1091,9 +1091,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
         */
        function buildNestedJSArray($conf) {
                $convertedConf = t3lib_div::removeDotsFromTS($conf);
-               if (!$this->is_FE()) {
-                       $GLOBALS['LANG']->csConvObj->convArray($convertedConf, $GLOBALS['LANG']->charSet, 'utf-8');
-               }
                return str_replace(array(':"0"', ':"\/^(', ')$\/i"', ':"\/^(', ')$\/"', '[]'), array(':false', ':/^(', ')$/i', ':/^(', ')$/', '{}'), json_encode($convertedConf));
        }
 
@@ -1252,16 +1249,19 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                return json_encode($toolbar);
        }
 
+       /**
+        * Localize a string using the language of the content element rather than the language of the BE interface
+        *
+        * @param       string          string: the label to be localized
+        * @return      string          Localized string.
+        */
        public function getLLContent($string) {
-               global $LANG;
-
-               $BE_lang = $LANG->lang;
-               $BE_charSet = $LANG->charSet;
-               $LANG->lang = $this->contentTypo3Language;
-               $LANG->charSet = $this->contentCharset;
-               $LLString = $LANG->JScharCode($LANG->sL($string));
-               $LANG->lang = $BE_lang;
-               $LANG->charSet = $BE_charSet;
+               $BE_lang = $GLOBALS['LANG']->lang;
+
+               $GLOBALS['LANG']->lang = $this->contentTypo3Language;
+               $LLString = $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL($string));
+
+               $GLOBALS['LANG']->lang = $BE_lang;
                return $LLString;
        }
 
@@ -1270,7 +1270,7 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
 
                if ($this->is_FE()) {
                        if (strcmp(substr($string,0,4),'LLL:')) {
-                                       // A pure string coming from Page TSConfig must be in forceCharset, otherwise we just don't know..
+                                       // A pure string coming from Page TSConfig must be in utf-8
                                $label = $TSFE->csConvObj->conv($TSFE->sL(trim($string)), 'utf-8', $this->OutputCharset);
                        } else {
                                $label = $TSFE->csConvObj->conv($TSFE->sL(trim($string)), $this->charset, $this->OutputCharset);
@@ -1290,12 +1290,13 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
        }
 
        function feJScharCode($str) {
-               global $TSFE;
                        // Convert string to UTF-8:
-               if ($this->OutputCharset != 'utf-8') $str = $TSFE->csConvObj->utf8_encode($str,$this->OutputCharset);
+               if ($this->OutputCharset != 'utf-8') {
+                       $str = $GLOBALS['TSFE']->csConvObj->utf8_encode($str, $this->OutputCharset);
+               }
                        // Convert the UTF-8 string into a array of char numbers:
-               $nArr = $TSFE->csConvObj->utf8_to_numberarray($str);
-               return 'String.fromCharCode('.implode(',',$nArr).')';
+               $nArr = $GLOBALS['TSFE']->csConvObj->utf8_to_numberarray($str);
+               return 'String.fromCharCode('.implode(',', $nArr).')';
        }
 
        public function getFullFileName($filename) {