"TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/rtehtmlarea/mod6/class.tx_rtehtmlarea_parse_html.php Source File", "datetime" => "Sat Dec 2 19:22:34 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2005-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 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 // if no HTTP input conversion is configured, the input was uft-8 (urlencoded). 00073 $fromCharSet = 'utf-8'; 00074 // if conversion was done, the input is encoded in mbstring.internal_encoding 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 // the charset of the content element, possibly overidden by forceCharset 00081 $toCharSet = t3lib_div::_GP('charset')?t3lib_div::_GP('charset'):'iso-8859-1'; 00082 // IE wants it back in utf-8 00083 if ( $clientInfo['BROWSER']= 'msie') { 00084 $toCharSet = 'utf-8'; 00085 } elseif ($clientInfo['SYSTEM'] = 'win') { 00086 // if the client is windows the input may contain windows-1252 characters; 00087 if (strToLower($toCharSet) == 'iso-8859-1') { 00088 $toCharSet = 'Windows-1252'; 00089 } 00090 } 00091 // convert to requested charset 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 ?>