Follow up for issue #9771: htmlArea RTE spellchecker not working in TYPO3 4.3-dev
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 13 Nov 2008 18:47:12 +0000 (18:47 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Thu, 13 Nov 2008 18:47:12 +0000 (18:47 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4468 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/ext_localconf.php
typo3/sysext/rtehtmlarea/extensions/SpellChecker/class.tx_rtehtmlarea_spellchecker.php
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/popups/spell-check-ui-iso-8859-1.html
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/popups/spell-check-ui.html
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-check-logic.php [deleted file]
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-check-ui.js
typo3/sysext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php

index f11aa0f..1d0eb89 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-13  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Follow up for issue #9771: htmlArea RTE spellchecker not working in TYPO3 4.3-dev
+
 2008-11-13  Steffen Kamper  <info@sk-typo3.de>
 
        * Fixed bug #9786: Remove duplicate JS-Files in backend.php
index e769399..4f6bfc3 100644 (file)
@@ -1,3 +1,7 @@
+2008-11-13  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Follow up for issue #9771: htmlArea RTE spellchecker not working in TYPO3 4.3-dev
+
 2008-11-11  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #9771: htmlArea RTE spellchecker not working in TYPO3 4.3-dev
index 661d21c..025fa0b 100644 (file)
@@ -191,6 +191,8 @@ $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['Language']['addIconsToSkin'] =
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['Language']['disableInFE'] = 0;
 
        // Spell checking configuration
+$TYPO3_CONF_VARS['FE']['eID_include']['rtehtmlarea_spellchecker'] = 'EXT:'.$_EXTKEY.'/pi1/class.tx_rtehtmlarea_pi1.php';
+$TYPO3_CONF_VARS['BE']['AJAX']['rtehtmlarea::spellchecker'] = 'EXT:'.$_EXTKEY.'/pi1/class.tx_rtehtmlarea_pi1.php:tx_rtehtmlarea_pi1->main';
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['dictionaryList'] = $_EXTCONF['dictionaryList'] ? $_EXTCONF['dictionaryList'] : 'en';
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['defaultDictionary'] = $_EXTCONF['defaultDictionary'] ? $_EXTCONF['defaultDictionary'] : 'en';
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['AspellDirectory'] = $_EXTCONF['AspellDirectory'] ? $_EXTCONF['AspellDirectory'] : '/usr/bin/aspell';
index 626da95..2b7717e 100644 (file)
@@ -96,6 +96,8 @@ class tx_rtehtmlarea_spellchecker extends tx_rtehtmlareaapi {
                        RTEarea['.$RTEcounter.'].buttons.'. $button .'.contentCharset = "' . $this->htmlAreaRTE->contentCharset .'";
                        RTEarea['.$RTEcounter.'].buttons.'. $button .'.spellCheckerMode = "' . $spellCheckerMode .'";
                        RTEarea['.$RTEcounter.'].buttons.'. $button .'.enablePersonalDicts = ' . ($enablePersonalDicts ? 'true' : 'false') .';';
+                       $registerRTEinJavascriptString .= '
+                       RTEarea['.$RTEcounter.'].buttons.'. $button .'.path = "' . ($this->htmlAreaRTE->is_FE() ? t3lib_div::getIndpEnv('TYPO3_SITE_URL') . '/index.php?eID=rtehtmlarea_spellchecker' : '/' . TYPO3_mainDir . 'ajax.php?ajaxID=rtehtmlarea::spellchecker') . '";';
                }
                return $registerRTEinJavascriptString;
        }
index 408461c..4397004 100644 (file)
@@ -46,7 +46,7 @@
 </head>
 <body class="popupwin htmlarea-spell-check" onload="initDocument();">
 <div id="content">
-       <form style="display: none;" action="../spell-check-logic.php" method="post" target="framecontent" accept-charset="ISO-8859-1">
+       <form id="spellcheck_form" style="display: none;" action="" method="post" target="framecontent" accept-charset="ISO-8859-1">
                <input type="hidden" name="content" id="f_content" />
                <input type="hidden" name="dictionary" id="f_dictionary" />
                <input type="hidden" name="pspell_charset" id="f_charset" />
index 72599fe..f0afa54 100644 (file)
@@ -46,7 +46,7 @@
 </head>
 <body class="popupwin htmlarea-spell-check" onload="initDocument();">
 <div id="content" class="spellcheck">
-       <form style="display: none;" action="../spell-check-logic.php" method="post" target="framecontent" accept-charset="UTF-8">
+       <form id="spellcheck_form" style="display: none;" action="" method="post" target="framecontent" accept-charset="UTF-8">
                <input type="hidden" name="content" id="f_content" />
                <input type="hidden" name="dictionary" id="f_dictionary" />
                <input type="hidden" name="pspell_charset" id="f_charset" />
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-check-logic.php b/typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-check-logic.php
deleted file mode 100644 (file)
index df97482..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2003-2008 Stanislas Rolland (typo3(arobas)sjbr.ca)
-*  All rights reserved
-*
-*  This script is part of the Typo3 project. The Typo3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * This is the script to invoke the spell checker for TYPO3 htmlArea RTE (rtehtmlarea)
- *
- * @author     Stanislas Rolland <typo3(arobas)sjbr.ca>
- *
- * TYPO3 SVN ID: $Id$
- *
- */
-       error_reporting (E_ALL ^ E_NOTICE);
-       define('TYPO3_OS', (stristr(PHP_OS,'win') && !stristr(PHP_OS,'darwin')) ? 'WIN' : '');
-       if (!defined('PATH_thisScript')) define('PATH_thisScript',str_replace('//','/', str_replace('\\','/', (php_sapi_name()=='cgi'||php_sapi_name()=='xcgi'||php_sapi_name()=='isapi' ||php_sapi_name()=='cgi-fcgi')&&((!empty($_SERVER['ORIG_PATH_TRANSLATED'])&&isset($_SERVER['ORIG_PATH_TRANSLATED']))?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? ((!empty($_SERVER['ORIG_PATH_TRANSLATED'])&&isset($_SERVER['ORIG_PATH_TRANSLATED']))?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):((!empty($_SERVER['ORIG_SCRIPT_FILENAME'])&&isset($_SERVER['ORIG_SCRIPT_FILENAME']))?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));
-       if (!defined('PATH_site')) define('PATH_site', dirname(dirname(dirname(dirname(dirname(dirname(dirname(PATH_thisScript))))))).'/');
-       if (!defined('PATH_t3lib')) define('PATH_t3lib', PATH_site.'t3lib/');
-       define('PATH_typo3conf', PATH_site.'typo3conf/');
-       define('TYPO3_mainDir', 'typo3/');
-       if (!defined('PATH_typo3')) define('PATH_typo3', PATH_site.TYPO3_mainDir);
-       if (!defined('PATH_tslib')) {
-               if (@is_dir(PATH_site.'typo3/sysext/cms/tslib/')) {
-                       define('PATH_tslib', PATH_site.'typo3/sysext/cms/tslib/');
-               } elseif (@is_dir(PATH_site.'tslib/')) {
-                       define('PATH_tslib', PATH_site.'tslib/');
-               }
-       }
-       define('TYPO3_MODE','FE');
-
-       require_once(PATH_t3lib.'class.t3lib_div.php');
-       require_once(PATH_t3lib.'class.t3lib_extmgm.php');
-       require_once(PATH_t3lib.'config_default.php');
-       require_once(PATH_typo3conf.'localconf.php');
-       require_once(PATH_tslib.'class.tslib_fe.php');
-       require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
-       require_once(PATH_t3lib.'class.t3lib_page.php');
-       require_once(PATH_tslib.'class.tslib_content.php');
-       require_once(t3lib_extMgm::extPath('rtehtmlarea').'pi1/class.tx_rtehtmlarea_pi1.php');
-       require_once(PATH_t3lib.'class.t3lib_userauth.php');
-       require_once(PATH_tslib.'class.tslib_feuserauth.php');
-
-       $typoVersion = t3lib_div::int_from_ver($GLOBALS['TYPO_VERSION']);
-       require_once(PATH_t3lib.'class.t3lib_cs.php');
-
-       if (!defined ('TYPO3_db'))  die ('The configuration file was not included.');
-       if (isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS']))      die('You cannot set the GLOBALS-array from outside this script.');
-
-       require_once(PATH_t3lib.'class.t3lib_db.php');
-       $TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
-
-       require_once(PATH_t3lib.'class.t3lib_timetrack.php');
-       $GLOBALS['TT'] = new t3lib_timeTrack;
-
-// ***********************************
-// Initializing the Caching System
-// ***********************************
-
-$GLOBALS['TT']->push('Initializing the Caching System','');
-       require_once(PATH_t3lib . 'class.t3lib_cache.php');
-
-       require_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractbackend.php');
-       require_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractcache.php');
-       require_once(PATH_t3lib . 'cache/class.t3lib_cache_exception.php');
-       require_once(PATH_t3lib . 'cache/class.t3lib_cache_factory.php');
-       require_once(PATH_t3lib . 'cache/class.t3lib_cache_manager.php');
-       require_once(PATH_t3lib . 'cache/class.t3lib_cache_variablecache.php');
-
-       require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_classalreadyloaded.php');
-       require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_duplicateidentifier.php');
-       require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidbackend.php');
-       require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidcache.php');
-       require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invaliddata.php');
-       require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_nosuchcache.php');
-
-       $typo3CacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
-       $cacheFactoryClass = t3lib_div::makeInstanceClassName('t3lib_cache_Factory');
-       $typo3CacheFactory = new $cacheFactoryClass($typo3CacheManager);
-
-       unset($cacheFactoryClass);
-$GLOBALS['TT']->pull();
-
-       // ***********************************
-       // Creating a fake $TSFE object
-       // ***********************************
-       $TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
-       $id = isset($HTTP_GET_VARS['id'])?$HTTP_GET_VARS['id']:0;
-       $GLOBALS['TSFE'] = new $TSFEclassName($TYPO3_CONF_VARS, $id, '0', 1, '', '','','');
-       $GLOBALS['TSFE']->initCaches();
-       $GLOBALS['TSFE']->set_no_cache();
-       $GLOBALS['TSFE']->connectToMySQL();
-       $GLOBALS['TSFE']->initFEuser();
-       $GLOBALS['TSFE']->fetch_the_id();
-       $GLOBALS['TSFE']->getPageAndRootline();
-       $GLOBALS['TSFE']->initTemplate();
-       $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
-       $GLOBALS['TSFE']->forceTemplateParsing = 1;
-       $GLOBALS['TSFE']->getConfigArray();
-
-       // *********
-       // initialize a BE_USER if applicable
-       // *********
-       $BE_USER='';
-       if ($_COOKIE['be_typo_user'])   {       // If the backend cookie is set, we proceed and checks if a backend user is logged in.
-               $TYPO3_MISC['microtime_BE_USER_start'] = microtime();
-               $TT->push('Back End user initialized','');
-               require_once (PATH_t3lib.'class.t3lib_befunc.php');
-               require_once (PATH_t3lib.'class.t3lib_userauthgroup.php');
-               require_once (PATH_t3lib.'class.t3lib_beuserauth.php');
-               require_once (PATH_t3lib.'class.t3lib_tsfebeuserauth.php');
-
-                       // the value this->formfield_status is set to empty in order to disable login-attempts to the backend account through this script
-               $BE_USER = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth');     // New backend user object
-               $BE_USER->OS = TYPO3_OS;
-               $BE_USER->lockIP = $TYPO3_CONF_VARS['BE']['lockIP'];
-               $BE_USER->start();      // Object is initialized
-               $BE_USER->unpack_uc('');
-               if ($BE_USER->user['uid'])      {
-                       $BE_USER->fetchGroupData();
-                       $TSFE->beUserLogin = 1;
-               }
-                       // Now we need to do some additional checks for IP/SSL
-               if (!$BE_USER->checkLockToIP() || !$BE_USER->checkBackendAccessSettingsFromInitPhp())   {
-                               // Unset the user initialization.
-                       $BE_USER='';
-                       $TSFE->beUserLogin=0;
-               }
-       }
-
-       $spellChecker = t3lib_div::makeInstance('tx_rtehtmlarea_pi1');
-       $spellChecker->cObj = t3lib_div::makeInstance('tslib_cObj');
-       $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$spellChecker->prefixId.'.'];
-       $spellChecker->main($conf);
-?>
\ No newline at end of file
index 196482d..3fc656d 100644 (file)
@@ -84,7 +84,7 @@ function saveClicked() {
                data['dictionary'] = dialog.plugin.contentISOLanguage;
                data['pspell_charset'] = dialog.plugin.contentCharset;
                data['pspell_mode'] = dialog.plugin.spellCheckerMode;
-               window.opener.HTMLArea._postback('plugins/SpellChecker/spell-check-logic.php', data);
+               window.opener.HTMLArea._postback(dialog.plugin.pageTSconfiguration.path, data);
        }
        window.close();
        return false;
@@ -195,6 +195,7 @@ function initDocument() {
 
        modified = false;
        document.title = dialog.plugin.localize("Spell Checker");
+       document.getElementById("spellcheck_form").action = plugin.pageTSconfiguration.path;
        frame = document.getElementById("i_framecontent");
        var field = document.getElementById("f_content");
        field.value = HTMLArea.getHTML(editor._doc.body, false, editor);
index ddb2fef..60f71ae 100644 (file)
  * TYPO3 SVN ID: $Id$
  *
  */
-require_once(PATH_tslib.'class.tslib_pibase.php');
 
-class tx_rtehtmlarea_pi1 extends tslib_pibase {
+class tx_rtehtmlarea_pi1 {
 
-       /**
-        * back reference to the mother cObj object set at call time
-        *
-        * @var tslib_cObj
-        */
-       var $cObj;
-       var $prefixId = 'tx_rtehtmlarea_pi1';  // Same as class name
-       var $scriptRelPath = 'pi1/class.tx_rtehtmlarea_pi1.php';  // Path to this script relative to the extension dir.
+       protected $csConvObj;
        var $extKey = 'rtehtmlarea'; // The extension key.
-       var $conf = array();
        var $siteUrl;
        var $charset = 'utf-8';
        var $parserCharset = 'utf-8';
@@ -70,23 +61,18 @@ class tx_rtehtmlarea_pi1 extends tslib_pibase {
        /**
         * Main class of Spell Checker plugin for Typo3 CMS
         *
-        * @param       string          $content: content to be displayed
-        * @param       array           $conf: TS setup for the plugin
         * @return      string          content produced by the plugin
         */
-       function main($conf) {
-               global $TYPO3_CONF_VARS, $TYPO3_DB;
-
-               $this->conf = $conf;
-               $this->tslib_pibase();
-               $this->pi_setPiVarDefaults();
-               $this->pi_loadLL();
-               $this->pi_USER_INT_obj = 1;  // Disable caching
+       function main() {
+
+               require_once(PATH_t3lib.'class.t3lib_cs.php');
+               $this->csConvObj = t3lib_div::makeInstance('t3lib_cs');
+
                        // Setting start time
                $time_start = microtime(true);
                $this->pspell_is_available = in_array('pspell', get_loaded_extensions());
-               $this->AspellDirectory = trim($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['AspellDirectory'])? trim($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['AspellDirectory']) : '/usr/bin/aspell';
-               $this->forceCommandMode = (trim($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['forceCommandMode']))? trim($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['forceCommandMode']) : 0;
+               $this->AspellDirectory = trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['AspellDirectory'])? trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['AspellDirectory']) : '/usr/bin/aspell';
+               $this->forceCommandMode = (trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['forceCommandMode']))? trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['forceCommandMode']) : 0;
                $safe_mode_is_enabled = ini_get('safe_mode');
                if($safe_mode_is_enabled && !$this->pspell_is_available ) echo('Configuration problem: Spell checking cannot be performed');
                if($safe_mode_is_enabled && $this->forceCommandMode) echo('Configuration problem: Spell checking cannot be performed in command mode');
@@ -103,14 +89,14 @@ class tx_rtehtmlarea_pi1 extends tslib_pibase {
                        $dictionaryList = implode(',', t3lib_div::trimExplode(chr(10), $dictionaryList, 1));
                }
                if( empty($dictionaryList) ) {
-                       $dictionaryList = trim($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['dictionaryList']);
+                       $dictionaryList = trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['dictionaryList']);
                }
                if( empty($dictionaryList) ) {
                        $dictionaryList = 'en';
                }
                $dictionaryArray = t3lib_div::trimExplode(',', $dictionaryList, 1);
 
-               $defaultDictionary = trim($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['defaultDictionary']);
+               $defaultDictionary = trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['defaultDictionary']);
                if(!$defaultDictionary || !in_array($defaultDictionary, $dictionaryArray)) {
                        $defaultDictionary = 'en';
                }
@@ -123,8 +109,8 @@ class tx_rtehtmlarea_pi1 extends tslib_pibase {
                $table = $tableA . ' LEFT JOIN ' . $tableB . ' ON ' . $tableA . '.static_lang_isocode=' . $tableB . '.uid';
                $whereClause = '1=1 ';
                $whereClause .= ' AND ' . $tableA . '.hidden != 1';
-               $res = $TYPO3_DB->exec_SELECTquery($selectFields, $table, $whereClause);
-               while($row = $TYPO3_DB->sql_fetch_assoc($res))    {
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selectFields, $table, $whereClause);
+               while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))    {
                        $languageArray[] = strtolower($row['lg_iso_2']).($row['lg_country_iso_2']?'_'.$row['lg_country_iso_2']:'');
                }
                if(!in_array($defaultDictionary, $languageArray)) {
@@ -186,7 +172,7 @@ class tx_rtehtmlarea_pi1 extends tslib_pibase {
                }
 
                        // Setting the path to user personal dicts, if any
-               if (t3lib_div::_POST('enablePersonalDicts') == 'true' && $GLOBALS['TSFE']->beUserLogin) {
+               if (t3lib_div::_POST('enablePersonalDicts') == 'true' && TYPO3_MODE == 'BE' && is_object($GLOBALS['BE_USER'])) {
                        $this->userUid = 'BE_' . $GLOBALS['BE_USER']->user['uid'];
                        if ($this->userUid) {
                                $this->personalDictPath = t3lib_div::getFileAbsFileName($this->uploadFolder . $this->userUid);
@@ -201,7 +187,7 @@ class tx_rtehtmlarea_pi1 extends tslib_pibase {
                $cmd = t3lib_div::_POST('cmd');
                if ($cmd == 'learn' && !$safe_mode_is_enabled) {
                                // Only availble for BE_USERS, die silently if someone has gotten here by accident
-                       if(!$GLOBALS['TSFE']->beUserLogin) die('');
+                       if (TYPO3_MODE !='BE' || !is_object($GLOBALS['BE_USER'])) die('');
                                // Updating the personal word list
                        $to_p_dict = t3lib_div::_POST('to_p_dict');
                        $to_p_dict = $to_p_dict ? $to_p_dict : array();
@@ -209,7 +195,6 @@ class tx_rtehtmlarea_pi1 extends tslib_pibase {
                        $to_r_list = $to_r_list ? $to_r_list : array();
                        header('Content-Type: text/plain; charset=' . strtoupper($this->parserCharset));
                        header('Pragma: no-cache');
-                       //print_r($to_r_list);
                        if($to_p_dict || $to_r_list) {
                                $tmpFileName = t3lib_div::tempnam($this->filePrefix);
                                if($filehandle = fopen($tmpFileName,'wb')) {
@@ -305,7 +290,6 @@ class tx_rtehtmlarea_pi1 extends tslib_pibase {
        }  // end of function main
 
        function startHandler($xml_parser, $tag, $attributes) {
-               global $TSFE;
                
                if (strlen($this->xmlCharacterData)) {
                        $this->spellCheckHandler($xml_parser, $this->xmlCharacterData);
@@ -323,14 +307,14 @@ class tx_rtehtmlarea_pi1 extends tslib_pibase {
                        case 'HR':
                        case 'area':
                        case 'AREA':
-                               $this->text .= '<'. $TSFE->csConvObj->conv_case($this->parserCharset, $tag, 'toLower') . ' ';
+                               $this->text .= '<'. $this->csConvObj->conv_case($this->parserCharset, $tag, 'toLower') . ' ';
                                foreach( $attributes as $key => $val) {
                                        $this->text .= $key . '="' . $val . '" ';
                                }
                                $this->text .= ' />';
                                break;
                        default:
-                               $this->text .= '<'. $TSFE->csConvObj->conv_case($this->parserCharset, $tag, 'toLower') . ' ';
+                               $this->text .= '<'. $this->csConvObj->conv_case($this->parserCharset, $tag, 'toLower') . ' ';
                                foreach( $attributes as $key => $val) {
                                        $this->text .= $key . '="' . $val . '" ';
                                }
@@ -450,10 +434,13 @@ class tx_rtehtmlarea_pi1 extends tslib_pibase {
                return;
        }
 
-} // end of class
+}
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php']) {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php']);
+if (TYPO3_MODE=='FE') {
+       require_once(PATH_tslib.'class.tslib_eidtools.php');
+       tslib_eidtools::connectDB();
+       $spellChecker = t3lib_div::makeInstance('tx_rtehtmlarea_pi1');
+       $spellChecker->main();
 }
 
 ?>
\ No newline at end of file