[ Index ] |
|
Code source de Typo3 4.1.3 |
1 <?php 2 /*************************************************************** 3 * Copyright notice 4 * 5 * (c) 2005-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca> 6 * All rights reserved 7 * 8 * This script is part of the TYPO3 project. The TYPO3 project is 9 * free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * The GNU General Public License can be found at 15 * http://www.gnu.org/copyleft/gpl.html. 16 * A copy is found in the textfile GPL.txt and important notices to the license 17 * from the author is found in LICENSE.txt distributed with these scripts. 18 * 19 * 20 * This script is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details. 24 * 25 * This copyright notice MUST APPEAR in all copies of the script! 26 ***************************************************************/ 27 /** 28 * Content parsing for htmlArea RTE 29 * 30 * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca> 31 * 32 * $Id: class.tx_rtehtmlarea_parse_html.php 1421 2006-04-10 09:27:15Z mundaun $ * 33 */ 34 35 require_once (PATH_t3lib.'class.t3lib_parsehtml.php'); 36 37 class tx_rtehtmlarea_parse_html { 38 var $content; 39 var $modData; 40 var $doc; 41 var $extKey = 'rtehtmlarea'; 42 var $prefixId = 'TYPO3HtmlParser'; 43 44 /** 45 * @return [type] ... 46 */ 47 function init() { 48 global $BE_USER,$BACK_PATH,$MCONF; 49 50 $this->doc = t3lib_div::makeInstance('template'); 51 $this->doc->backPath = $BACK_PATH; 52 $this->doc->JScode=''; 53 54 $this->modData = $BE_USER->getModuleData($MCONF['name'],'ses'); 55 if (t3lib_div::_GP('OC_key')) { 56 $parts = explode('|',t3lib_div::_GP('OC_key')); 57 $this->modData['openKeys'][$parts[1]] = $parts[0]=='O' ? 1 : 0; 58 $BE_USER->pushModuleData($MCONF['name'],$this->modData); 59 } 60 } 61 62 /** 63 * [Describe function...] 64 * 65 * @return [type] ... 66 */ 67 function main() { 68 global $LANG; 69 70 $this->content .= $this->main_parse_html($this->modData['openKeys']); 71 72 // if no HTTP input conversion is configured, the input was uft-8 (urlencoded). 73 $fromCharSet = 'utf-8'; 74 // if conversion was done, the input is encoded in mbstring.internal_encoding 75 if (in_array('mbstring', get_loaded_extensions()) && ini_get('mbstring.encoding_translation')) { 76 $fromCharSet = strToLower(ini_get('mbstring.internal_encoding')); 77 } 78 79 $clientInfo = t3lib_div::clientInfo(); 80 // the charset of the content element, possibly overidden by forceCharset 81 $toCharSet = t3lib_div::_GP('charset')?t3lib_div::_GP('charset'):'iso-8859-1'; 82 // IE wants it back in utf-8 83 if ( $clientInfo['BROWSER']= 'msie') { 84 $toCharSet = 'utf-8'; 85 } elseif ($clientInfo['SYSTEM'] = 'win') { 86 // if the client is windows the input may contain windows-1252 characters; 87 if (strToLower($toCharSet) == 'iso-8859-1') { 88 $toCharSet = 'Windows-1252'; 89 } 90 } 91 // convert to requested charset 92 $this->content = $LANG->csConvObj->conv($this->content, $fromCharSet, $toCharSet); 93 header('Content-Type: text/plain; charset='.$toCharSet); 94 } 95 96 /** 97 * [Describe function...] 98 * 99 * @return [type] ... 100 */ 101 function printContent() { 102 echo $this->content; 103 } 104 105 /** 106 * Rich Text Editor (RTE) html parser 107 * 108 * @param [type] $openKeys: ... 109 * @return [type] ... 110 */ 111 function main_parse_html($openKeys) { 112 global $BE_USER, $TYPO3_CONF_VARS; 113 114 $editorNo = t3lib_div::_GP('editorNo'); 115 $html = t3lib_div::_GP('content'); 116 117 $RTEtsConfigParts = explode(':',t3lib_div::_GP('RTEtsConfigParams')); 118 $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5])); 119 $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]); 120 121 $HTMLParser = t3lib_div::makeInstance('t3lib_parsehtml'); 122 if (is_array($thisConfig['enableWordClean.'])) { 123 $HTMLparserConfig = is_array($thisConfig['enableWordClean.']['HTMLparser.']) ? $HTMLParser->HTMLparserConfig($thisConfig['enableWordClean.']['HTMLparser.']) : ''; 124 } 125 if (is_array($HTMLparserConfig)) { 126 $html = $HTMLParser->HTMLcleaner($html, $HTMLparserConfig[0], $HTMLparserConfig[1], $HTMLparserConfig[2], $HTMLparserConfig[3]); 127 } 128 129 if (is_array ($TYPO3_CONF_VARS['EXTCONF'][$this->extKey][$this->prefixId]['cleanPastedContent'])) { 130 foreach ($TYPO3_CONF_VARS['EXTCONF'][$this->extKey][$this->prefixId]['cleanPastedContent'] as $classRef) { 131 $hookObj = &t3lib_div::getUserObj($classRef); 132 if (method_exists($hookObj, 'cleanPastedContent_afterCleanWord')) { 133 $html = $hookObj->cleanPastedContent_afterCleanWord($html, $thisConfig); 134 } 135 } 136 } 137 138 return $html; 139 } 140 141 } 142 143 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod6/class.tx_rtehtmlarea_parse_html.php']) { 144 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod6/class.tx_rtehtmlarea_parse_html.php']); 145 } 146 147 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Nov 25 17:13:16 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |