Project

General

Profile

Bug #16803 » bug_4686.diff

Administrator Admin, 2006-12-21 13:38

View differences:

typo3/sysext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php (Arbeitskopie)
// Setting the charset
if( t3lib_div::_POST('pspell_charset') ) $this->charset = trim(t3lib_div::_POST('pspell_charset'));
if(strtolower($this->charset) == 'iso-8859-1') $this->parserCharset = strtolower($this->charset);
$internal_encoding = mb_internal_encoding(strtoupper($this->parserCharset));
//$regex_encoding = mb_regex_encoding (strtoupper($this->parserCharset));
// However, we are going to work only in the parser charset
if($this->pspell_is_available && !$this->forceCommandMode) {
$this->pspell_link = pspell_new($this->dictionary, '', '', $this->parserCharset, $pspellModeFlag);
......
if( !xml_set_element_handler( $parser, 'startHandler', 'endHandler')) echo('Bad xml handler setting');
if( !xml_set_character_data_handler ( $parser, 'spellCheckHandler')) echo('Bad xml handler setting');
if( !xml_set_default_handler( $parser, 'defaultHandler')) echo('Bad xml handler setting');
if(! xml_parse($parser,'<?xml version="1.0" encoding="' . $this->parserCharset . '"?><SPELLCHECKER> ' . mb_ereg_replace('&nbsp;', ' ', $content) . ' </SPELLCHECKER>')) echo('Bad parsing');
if(! xml_parse($parser,'<?xml version="1.0" encoding="' . $this->parserCharset . '"?><SPELLCHECKER> ' . str_replace('&nbsp;', ' ', $content) . ' </SPELLCHECKER>')) echo('Bad parsing');
if( xml_get_error_code($parser)) {
die('Line '.xml_get_current_line_number($parser).': '.xml_error_string(xml_get_error_code($parser)));
}
......
case 'HR':
case 'area':
case 'AREA':
$this->text .= '<'. mb_strtolower($tag) . ' ';
$this->text .= '<'. strtolower($tag) . ' ';
foreach( $attributes as $key => $val) {
$this->text .= $key . '="' . $val . '" ';
}
$this->text .= ' />';
break;
default:
$this->text .= '<'. mb_strtolower($tag) . ' ';
$this->text .= '<'. strtolower($tag) . ' ';
foreach( $attributes as $key => $val) {
$this->text .= $key . '="' . $val . '" ';
}
......
function spellCheckHandler($xml_parser, $string) {
$incurrent=array();
$stringText = $string;
$words = mb_split('\W+', $stringText);
$words = split('\W+', $stringText);
while( list(,$word) = each($words) ) {
$word = mb_ereg_replace(' ', '', $word);
$word = str_replace(' ', '', $word);
if( $word && !is_numeric($word)) {
if($this->pspell_is_available && !$this->forceCommandMode) {
if (!pspell_check($this->pspell_link, $word)) {
......
unset($suggest);
}
if( !in_array($word, $incurrent) ) {
$stringText = mb_ereg_replace('\b'.$word.'\b', '<span class="HA-spellcheck-error">'.$word.'</span>', $stringText);
$stringText = ereg_replace('\b'.$word.'\b', '<span class="HA-spellcheck-error">'.$word.'</span>', $stringText);
$incurrent[] = $word;
}
}
......
unset($suggestions);
}
if (!in_array($word, $incurrent)) {
$stringText = mb_ereg_replace('\b'.$word.'\b', '<span class="HA-spellcheck-error">'.$word.'</span>', $stringText);
$stringText = ereg_replace('\b'.$word.'\b', '<span class="HA-spellcheck-error">'.$word.'</span>', $stringText);
$incurrent[] = $word;
}
}
(1-1/3)