<?php
  include_once '../doc-typo3-funcs.php';
  $doxygen_vars = array(	"title" => "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);
?>
<!-- Generated by Doxygen 1.4.6 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="dirs.html"><span>Directories</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
  </ul></div>
<div class="nav">
<a class="el" href="dir_c8daf1ad746050abf985cc546c89e248.html">typo3_src-4.0.1</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_18071ae4545d8b3e0364d30c0659c74a.html">typo3</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_57bf1ed8249c1fd5b014486d01bcb27a.html">sysext</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_ba35782bbbbab3dd5f9ad49363790eab.html">rtehtmlarea</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_ba6900a2e673b8b6f4d39d4be023600a.html">mod6</a></div>
<h1>class.tx_rtehtmlarea_parse_html.php</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?php
<a name="l00002"></a>00002 <span class="comment">/***************************************************************</span>
<a name="l00003"></a>00003 <span class="comment">*  Copyright notice</span>
<a name="l00004"></a>00004 <span class="comment">*</span>
<a name="l00005"></a>00005 <span class="comment">*  (c) 2005-2006 Stanislas Rolland &lt;stanislas.rolland(arobas)fructifor.ca&gt;</span>
<a name="l00006"></a>00006 <span class="comment">*  All rights reserved</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">*  This script is part of the TYPO3 project. The TYPO3 project is</span>
<a name="l00009"></a>00009 <span class="comment">*  free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment">*  it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment">*  the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00012"></a>00012 <span class="comment">*  (at your option) any later version.</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">*  The GNU General Public License can be found at</span>
<a name="l00015"></a>00015 <span class="comment">*  http://www.gnu.org/copyleft/gpl.html.</span>
<a name="l00016"></a>00016 <span class="comment">*  A copy is found in the textfile GPL.txt and important notices to the license </span>
<a name="l00017"></a>00017 <span class="comment">*  from the author is found in LICENSE.txt distributed with these scripts.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">*</span>
<a name="l00020"></a>00020 <span class="comment">*  This script is distributed in the hope that it will be useful,</span>
<a name="l00021"></a>00021 <span class="comment">*  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00022"></a>00022 <span class="comment">*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00023"></a>00023 <span class="comment">*  GNU General Public License for more details.</span>
<a name="l00024"></a>00024 <span class="comment">*</span>
<a name="l00025"></a>00025 <span class="comment">*  This copyright notice MUST APPEAR in all copies of the script!</span>
<a name="l00026"></a>00026 <span class="comment">***************************************************************/</span>
<a name="l00035"></a>00035 require_once (PATH_t3lib.'<span class="keyword">class</span>.t3lib_parsehtml.php');
<a name="l00036"></a>00036 
<a name="l00037"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html">00037</a> <span class="keyword">class </span><a class="code" href="classtx__rtehtmlarea__parse__html.html">tx_rtehtmlarea_parse_html</a> {
<a name="l00038"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html#c066e5dadd2d45263e13dd470ce8c109">00038</a>         var <a class="code" href="classtx__rtehtmlarea__parse__html.html#c066e5dadd2d45263e13dd470ce8c109">$content</a>;
<a name="l00039"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html#5e6eee4e0146d4ecc44024626e406775">00039</a>         var <a class="code" href="classtx__rtehtmlarea__parse__html.html#5e6eee4e0146d4ecc44024626e406775">$modData</a>;
<a name="l00040"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html#4f86a042fd19ad05ec5fa75a91bb2873">00040</a>         var <a class="code" href="classtx__rtehtmlarea__parse__html.html#4f86a042fd19ad05ec5fa75a91bb2873">$doc</a>;
<a name="l00041"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html#8a5ccbd5f15f1445e43fcb37dffbb5dd">00041</a>         var <a class="code" href="classtx__rtehtmlarea__parse__html.html#8a5ccbd5f15f1445e43fcb37dffbb5dd">$extKey</a> = 'rtehtmlarea';
<a name="l00042"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html#ed45117eb33263641c5df0f0207faf41">00042</a>         var <a class="code" href="classtx__rtehtmlarea__parse__html.html#ed45117eb33263641c5df0f0207faf41">$prefixId</a> = 'TYPO3HtmlParser';
<a name="l00043"></a>00043 
<a name="l00047"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html#03ccf3332d0a5997d10069d234eced6e">00047</a>         function <a class="code" href="classtx__rtehtmlarea__parse__html.html#03ccf3332d0a5997d10069d234eced6e">init</a>() {
<a name="l00048"></a>00048                 global $BE_USER,$BACK_PATH,$MCONF;
<a name="l00049"></a>00049                 
<a name="l00050"></a>00050                 $this-&gt;doc = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<span class="keyword">template</span>');
<a name="l00051"></a>00051                 $this-&gt;doc-&gt;backPath = $BACK_PATH;
<a name="l00052"></a>00052                 $this-&gt;doc-&gt;JScode='';
<a name="l00053"></a>00053                 
<a name="l00054"></a>00054                 $this-&gt;modData = $BE_USER-&gt;getModuleData($MCONF['name'],'ses');
<a name="l00055"></a>00055                 <span class="keywordflow">if</span> (<a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('OC_key'))   {
<a name="l00056"></a>00056                         $parts = explode(<span class="charliteral">'|'</span>,<a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('OC_key'));
<a name="l00057"></a>00057                         $this-&gt;modData['openKeys'][$parts[1]] = $parts[0]==<span class="charliteral">'O'</span> ? 1 : 0;
<a name="l00058"></a>00058                         $BE_USER-&gt;pushModuleData($MCONF['name'],$this-&gt;modData);
<a name="l00059"></a>00059                 }
<a name="l00060"></a>00060         }
<a name="l00061"></a>00061         
<a name="l00067"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html#9f779a53f1b03662732458901474c27b">00067</a>         function <a class="code" href="classtx__rtehtmlarea__parse__html.html#9f779a53f1b03662732458901474c27b">main</a>() {
<a name="l00068"></a>00068                 global $LANG;
<a name="l00069"></a>00069                 
<a name="l00070"></a>00070                 $this-&gt;content .= $this-&gt;<a class="code" href="classtx__rtehtmlarea__parse__html.html#6974f1a91613f12fdb2417f9dac3609e">main_parse_html</a>($this-&gt;modData['openKeys']);
<a name="l00071"></a>00071                 
<a name="l00072"></a>00072                         <span class="comment">// if no HTTP input conversion is configured, the input was uft-8 (urlencoded).</span>
<a name="l00073"></a>00073                 $fromCharSet = 'utf-8';
<a name="l00074"></a>00074                         <span class="comment">// if conversion was done, the input is encoded in mbstring.internal_encoding</span>
<a name="l00075"></a>00075                 <span class="keywordflow">if</span> (in_array('mbstring', get_loaded_extensions()) &amp;&amp; ini_get('mbstring.encoding_translation')) {
<a name="l00076"></a>00076                         $fromCharSet = strToLower(ini_get('mbstring.internal_encoding'));
<a name="l00077"></a>00077                 }
<a name="l00078"></a>00078                 
<a name="l00079"></a>00079                 $clientInfo = <a class="code" href="classt3lib__div.html#4ab1e28e6e09d7c9470411b9bcc5f25e">t3lib_div::clientInfo</a>();
<a name="l00080"></a>00080                         <span class="comment">// the charset of the content element, possibly overidden by forceCharset</span>
<a name="l00081"></a>00081                 $toCharSet = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('charset')?<a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('charset'):'iso-8859-1';
<a name="l00082"></a>00082                         <span class="comment">// IE wants it back in utf-8</span>
<a name="l00083"></a>00083                 <span class="keywordflow">if</span> ( $clientInfo['BROWSER']= 'msie') {
<a name="l00084"></a>00084                         $toCharSet = 'utf-8';
<a name="l00085"></a>00085                 } elseif ($clientInfo['SYSTEM'] = 'win') {
<a name="l00086"></a>00086                                 <span class="comment">// if the client is windows the input may contain windows-1252 characters;</span>
<a name="l00087"></a>00087                         <span class="keywordflow">if</span> (strToLower($toCharSet) == 'iso-8859-1') {
<a name="l00088"></a>00088                                 $toCharSet = 'Windows-1252';
<a name="l00089"></a>00089                         }
<a name="l00090"></a>00090                 }
<a name="l00091"></a>00091                         <span class="comment">// convert to requested charset</span>
<a name="l00092"></a>00092                 $this-&gt;content = $LANG-&gt;csConvObj-&gt;conv($this-&gt;content, $fromCharSet, $toCharSet);
<a name="l00093"></a>00093                 header('Content-Type: text/plain; charset='.$toCharSet);
<a name="l00094"></a>00094         }
<a name="l00095"></a>00095 
<a name="l00101"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html#36db5c861312f1171cc56de27f0828f7">00101</a>         function <a class="code" href="classtx__rtehtmlarea__parse__html.html#36db5c861312f1171cc56de27f0828f7">printContent</a>() {
<a name="l00102"></a>00102                 echo $this-&gt;content;
<a name="l00103"></a>00103         }
<a name="l00104"></a>00104         
<a name="l00111"></a><a class="code" href="classtx__rtehtmlarea__parse__html.html#6974f1a91613f12fdb2417f9dac3609e">00111</a>         function <a class="code" href="classtx__rtehtmlarea__parse__html.html#6974f1a91613f12fdb2417f9dac3609e">main_parse_html</a>($openKeys)     {
<a name="l00112"></a>00112                 global $BE_USER, $TYPO3_CONF_VARS;
<a name="l00113"></a>00113                 
<a name="l00114"></a>00114                 $editorNo = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('editorNo');
<a name="l00115"></a>00115                 $html = <a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('content');
<a name="l00116"></a>00116                 
<a name="l00117"></a>00117                 $RTEtsConfigParts = explode(<span class="charliteral">':'</span>,<a class="code" href="classt3lib__div.html#016d2190758279b2dbb953826c690118">t3lib_div::_GP</a>('RTEtsConfigParams'));
<a name="l00118"></a>00118                 $RTEsetup = $BE_USER-&gt;getTSConfig('RTE',<a class="code" href="classt3lib__BEfunc.html#643143cf81548a0c3b160ae0d58bebc9">t3lib_BEfunc::getPagesTSconfig</a>($RTEtsConfigParts[5]));
<a name="l00119"></a>00119                 $thisConfig = <a class="code" href="classt3lib__BEfunc.html#af77c78443db5a728c702c714f266c22">t3lib_BEfunc::RTEsetup</a>($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
<a name="l00120"></a>00120                 
<a name="l00121"></a>00121                 $HTMLParser = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<a class="code" href="classt3lib__parsehtml.html">t3lib_parsehtml</a>');
<a name="l00122"></a>00122                 <span class="keywordflow">if</span> (is_array($thisConfig['enableWordClean.'])) {
<a name="l00123"></a>00123                         $HTMLparserConfig = is_array($thisConfig['enableWordClean.']['HTMLparser.'])  ? $HTMLParser-&gt;HTMLparserConfig($thisConfig['enableWordClean.']['HTMLparser.']) : '';
<a name="l00124"></a>00124                 }
<a name="l00125"></a>00125                 <span class="keywordflow">if</span> (is_array($HTMLparserConfig)) {
<a name="l00126"></a>00126                         $html = $HTMLParser-&gt;HTMLcleaner($html, $HTMLparserConfig[0], $HTMLparserConfig[1], $HTMLparserConfig[2], $HTMLparserConfig[3]);
<a name="l00127"></a>00127                 }
<a name="l00128"></a>00128                 
<a name="l00129"></a>00129                 <span class="keywordflow">if</span> (is_array ($TYPO3_CONF_VARS['EXTCONF'][$this-&gt;extKey][$this-&gt;prefixId]['cleanPastedContent'])) {
<a name="l00130"></a>00130                         foreach  ($TYPO3_CONF_VARS['EXTCONF'][$this-&gt;extKey][$this-&gt;prefixId]['cleanPastedContent'] as $classRef) {
<a name="l00131"></a>00131                                 $hookObj = &amp;<a class="code" href="classt3lib__div.html#ebd81edfc92886dc4c625fc9fe53595f">t3lib_div::getUserObj</a>($classRef);
<a name="l00132"></a>00132                                 <span class="keywordflow">if</span> (method_exists($hookObj, 'cleanPastedContent_afterCleanWord')) {
<a name="l00133"></a>00133                                         $html = $hookObj-&gt;cleanPastedContent_afterCleanWord($html, $thisConfig);
<a name="l00134"></a>00134                                 }
<a name="l00135"></a>00135                         }
<a name="l00136"></a>00136                 }
<a name="l00137"></a>00137                 
<a name="l00138"></a>00138                 <span class="keywordflow">return</span> $html;
<a name="l00139"></a>00139         }
<a name="l00140"></a>00140 
<a name="l00141"></a>00141 }
<a name="l00142"></a>00142 
<a name="l00143"></a>00143 <span class="keywordflow">if</span> (defined('TYPO3_MODE') &amp;&amp; $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod6/<span class="keyword">class</span>.<a class="code" href="classtx__rtehtmlarea__parse__html.html">tx_rtehtmlarea_parse_html</a>.php']) {
<a name="l00144"></a>00144         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod6/<span class="keyword">class</span>.<a class="code" href="classtx__rtehtmlarea__parse__html.html">tx_rtehtmlarea_parse_html</a>.php']);
<a name="l00145"></a>00145 }
<a name="l00146"></a>00146 
<a name="l00147"></a>00147 ?&gt;
</pre></div><?php
  include_once '../doc-typo3-funcs.php';
  get_footer();
?>