+2008-08-18 Stanislas Rolland <typo3@sjbr.ca>
+
+ * Follow-up for feature #4686: htmlArea RTE Spell Checker: add u modifier to preg_* operations
+
2008-08-18 Dmitry Dulepov <dmitry@typo3.org>
* Fixed bug #8627: Translation of the belog-module (thanks to Christopher Stelmaszyk and Christian Kuhn)
2008-08-18 Dmitry Dulepov <dmitry@typo3.org>
* Fixed bug #8627: Translation of the belog-module (thanks to Christopher Stelmaszyk and Christian Kuhn)
+2008-08-18 Stanislas Rolland <typo3@sjbr.ca>
+
+ * Follow-up for feature #4686: htmlArea RTE Spell Checker: add u modifier to preg_* operations
+
2008-08-16 Stanislas Rolland <typo3@sjbr.ca>
* Added feature #9109: Enable altMountPoints feature in RTE element browser (Thanks to Steffen Kamper)
2008-08-16 Stanislas Rolland <typo3@sjbr.ca>
* Added feature #9109: Enable altMountPoints feature in RTE element browser (Thanks to Steffen Kamper)
/***************************************************************
* Copyright notice
*
/***************************************************************
* Copyright notice
*
-* (c) 2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+* (c) 2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
/**
* Spell Checker plugin for htmlArea RTE
*
/**
* Spell Checker plugin for htmlArea RTE
*
- * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+ * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
public function main($parentObject) {
global $TYPO3_CONF_VARS;
public function main($parentObject) {
global $TYPO3_CONF_VARS;
- return parent::main($parentObject) && t3lib_extMgm::isLoaded('static_info_tables') && !in_array($this->htmlAreaRTE->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->htmlAreaRTE->ID]['noSpellCheckLanguages']));
+ return parent::main($parentObject)
+ && t3lib_extMgm::isLoaded('static_info_tables')
+ && !in_array($this->htmlAreaRTE->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->htmlAreaRTE->ID]['noSpellCheckLanguages']))
+ && ($this->htmlAreaRTE->contentCharset == 'iso-8859-1' || $this->htmlAreaRTE->contentCharset == 'utf-8');
/***************************************************************
* Copyright notice
*
/***************************************************************
* Copyright notice
*
-* (c) 2003-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+* (c) 2003-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
/**
* Spell checking plugin 'tx_rtehtmlarea_pi1' for the htmlArea RTE extension.
*
/**
* Spell checking plugin 'tx_rtehtmlarea_pi1' for the htmlArea RTE extension.
*
- * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+ * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
if (!xml_set_element_handler($parser, 'startHandler', 'endHandler')) echo('Bad xml handler setting');
if (!xml_set_character_data_handler($parser, 'collectDataHandler')) echo('Bad xml handler setting');
if (!xml_set_default_handler($parser, 'defaultHandler')) echo('Bad xml handler setting');
if (!xml_set_element_handler($parser, 'startHandler', 'endHandler')) echo('Bad xml handler setting');
if (!xml_set_character_data_handler($parser, 'collectDataHandler')) 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> ' . str_replace(' ', ' ', $content) . ' </spellchecker>')) echo('Bad parsing');
+ if (!xml_parse($parser,'<?xml version="1.0" encoding="' . $this->parserCharset . '"?><spellchecker> ' . preg_replace('/ /'.(($this->parserCharset == 'utf-8')?'u':''), ' ', $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)));
}
if (xml_get_error_code($parser)) {
die('Line '.xml_get_current_line_number($parser).': '.xml_error_string(xml_get_error_code($parser)));
}
</head>
';
$this->result .= '<body onload="window.parent.finishedSpellChecking();">';
</head>
';
$this->result .= '<body onload="window.parent.finishedSpellChecking();">';
- $this->result .= preg_replace('/'.preg_quote('<?xml').'.*'.preg_quote('?>').'['.preg_quote(chr(10).chr(13).chr(32)).']*/', '', $this->text);
+ $this->result .= preg_replace('/'.preg_quote('<?xml').'.*'.preg_quote('?>').'['.preg_quote(chr(10).chr(13).chr(32)).']*/'.(($this->parserCharset == 'utf-8')?'u':''), '', $this->text);
$this->result .= '<div id="HA-spellcheck-dictionaries">'.$dictionaries.'</div>';
// Closing
$this->result .= '<div id="HA-spellcheck-dictionaries">'.$dictionaries.'</div>';
// Closing
function spellCheckHandler($xml_parser, $string) {
$incurrent=array();
$stringText = $string;
function spellCheckHandler($xml_parser, $string) {
$incurrent=array();
$stringText = $string;
- $words = preg_split('/\W+/', $stringText);
+ $words = preg_split((($this->parserCharset == 'utf-8')?'/\P{L}+/u':'/\W+/'), $stringText);
while( list(,$word) = each($words) ) {
while( list(,$word) = each($words) ) {
- $word = str_replace(' ', '', $word);
+ $word = preg_replace('/ /'.(($this->parserCharset == 'utf-8')?'u':''), '', $word);
if( $word && !is_numeric($word)) {
if($this->pspell_is_available && !$this->forceCommandMode) {
if (!pspell_check($this->pspell_link, $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) ) {
unset($suggest);
}
if( !in_array($word, $incurrent) ) {
- $stringText = preg_replace('/\b'.$word.'\b/', '<span class="HA-spellcheck-error">'.$word.'</span>', $stringText);
+ $stringText = preg_replace('/\b'.$word.'\b/'.(($this->parserCharset == 'utf-8')?'u':''), '<span class="HA-spellcheck-error">'.$word.'</span>', $stringText);
$incurrent[] = $word;
}
}
$incurrent[] = $word;
}
}
unset($suggestions);
}
if (!in_array($word, $incurrent)) {
unset($suggestions);
}
if (!in_array($word, $incurrent)) {
- $stringText = preg_replace('/\b'.$word.'\b/', '<span class="HA-spellcheck-error">'.$word.'</span>', $stringText);
+ $stringText = preg_replace('/\b'.$word.'\b/'.(($this->parserCharset == 'utf-8')?'u':''), '<span class="HA-spellcheck-error">'.$word.'</span>', $stringText);
$incurrent[] = $word;
}
}
$incurrent[] = $word;
}
}