00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00035 require_once (PATH_t3lib.'class.t3lib_parsehtml.php');
00036
00037 class tx_rtehtmlarea_parse_html {
00038 var $content;
00039 var $modData;
00040 var $doc;
00041 var $extKey = 'rtehtmlarea';
00042 var $prefixId = 'TYPO3HtmlParser';
00043
00047 function init() {
00048 global $BE_USER,$BACK_PATH,$MCONF;
00049
00050 $this->doc = t3lib_div::makeInstance('template');
00051 $this->doc->backPath = $BACK_PATH;
00052 $this->doc->JScode='';
00053
00054 $this->modData = $BE_USER->getModuleData($MCONF['name'],'ses');
00055 if (t3lib_div::_GP('OC_key')) {
00056 $parts = explode('|',t3lib_div::_GP('OC_key'));
00057 $this->modData['openKeys'][$parts[1]] = $parts[0]=='O' ? 1 : 0;
00058 $BE_USER->pushModuleData($MCONF['name'],$this->modData);
00059 }
00060 }
00061
00067 function main() {
00068 global $LANG;
00069
00070 $this->content .= $this->main_parse_html($this->modData['openKeys']);
00071
00072
00073 $fromCharSet = 'utf-8';
00074
00075 if (in_array('mbstring', get_loaded_extensions()) && ini_get('mbstring.encoding_translation')) {
00076 $fromCharSet = strToLower(ini_get('mbstring.internal_encoding'));
00077 }
00078
00079 $clientInfo = t3lib_div::clientInfo();
00080
00081 $toCharSet = t3lib_div::_GP('charset')?t3lib_div::_GP('charset'):'iso-8859-1';
00082
00083 if ( $clientInfo['BROWSER']= 'msie') {
00084 $toCharSet = 'utf-8';
00085 } elseif ($clientInfo['SYSTEM'] = 'win') {
00086
00087 if (strToLower($toCharSet) == 'iso-8859-1') {
00088 $toCharSet = 'Windows-1252';
00089 }
00090 }
00091
00092 $this->content = $LANG->csConvObj->conv($this->content, $fromCharSet, $toCharSet);
00093 header('Content-Type: text/plain; charset='.$toCharSet);
00094 }
00095
00101 function printContent() {
00102 echo $this->content;
00103 }
00104
00111 function main_parse_html($openKeys) {
00112 global $BE_USER, $TYPO3_CONF_VARS;
00113
00114 $editorNo = t3lib_div::_GP('editorNo');
00115 $html = t3lib_div::_GP('content');
00116
00117 $RTEtsConfigParts = explode(':',t3lib_div::_GP('RTEtsConfigParams'));
00118 $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
00119 $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
00120
00121 $HTMLParser = t3lib_div::makeInstance('t3lib_parsehtml');
00122 if (is_array($thisConfig['enableWordClean.'])) {
00123 $HTMLparserConfig = is_array($thisConfig['enableWordClean.']['HTMLparser.']) ? $HTMLParser->HTMLparserConfig($thisConfig['enableWordClean.']['HTMLparser.']) : '';
00124 }
00125 if (is_array($HTMLparserConfig)) {
00126 $html = $HTMLParser->HTMLcleaner($html, $HTMLparserConfig[0], $HTMLparserConfig[1], $HTMLparserConfig[2], $HTMLparserConfig[3]);
00127 }
00128
00129 if (is_array ($TYPO3_CONF_VARS['EXTCONF'][$this->extKey][$this->prefixId]['cleanPastedContent'])) {
00130 foreach ($TYPO3_CONF_VARS['EXTCONF'][$this->extKey][$this->prefixId]['cleanPastedContent'] as $classRef) {
00131 $hookObj = &t3lib_div::getUserObj($classRef);
00132 if (method_exists($hookObj, 'cleanPastedContent_afterCleanWord')) {
00133 $html = $hookObj->cleanPastedContent_afterCleanWord($html, $thisConfig);
00134 }
00135 }
00136 }
00137
00138 return $html;
00139 }
00140
00141 }
00142
00143 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod6/class.tx_rtehtmlarea_parse_html.php']) {
00144 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod6/class.tx_rtehtmlarea_parse_html.php']);
00145 }
00146
00147 ?>