Update the spellchecker plugin for TinyMCE to 2.0.6, fixes #19105

git-svn-id: http://svn.automattic.com/wordpress/trunk@19178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-11-05 18:32:47 +00:00
parent f7fa2684e8
commit 120e6563df
6 changed files with 25 additions and 12 deletions

View File

@ -1,3 +1,8 @@
Version 2.0.6 (2011-09-29)
Fixed incorrect position of suggestion menu.
Fixed handling of mispelled words with no suggestions in PSpellShell engine.
Fixed PSpellShell command on Windows.
Fixed bug where Javascript error is produced when enchant_dict_suggest() returns unexpected result.
Version 2.0.5 (2011-03-24) Version 2.0.5 (2011-03-24)
Merged with the latest TinyMCE spellchecker version. Merged with the latest TinyMCE spellchecker version.
Version 2.0.4 (2010-12-20) Version 2.0.4 (2010-12-20)

View File

@ -48,16 +48,20 @@ class EnchantSpell extends SpellChecker {
*/ */
function &getSuggestions($lang, $word) { function &getSuggestions($lang, $word) {
$r = enchant_broker_init(); $r = enchant_broker_init();
$suggs = array();
if (enchant_broker_dict_exists($r,$lang)) { if (enchant_broker_dict_exists($r,$lang)) {
$d = enchant_broker_request_dict($r, $lang); $d = enchant_broker_request_dict($r, $lang);
$suggs = enchant_dict_suggest($d, $word); $suggs = enchant_dict_suggest($d, $word);
// enchant_dict_suggest() sometimes returns NULL
if (!is_array($suggs))
$suggs = array();
enchant_broker_free_dict($d); enchant_broker_free_dict($d);
} else { } else {
$suggs = array();
} }
enchant_broker_free($r); enchant_broker_free($r);
return $suggs; return $suggs;

View File

@ -38,13 +38,13 @@ class PSpellShell extends SpellChecker {
$matches = array(); $matches = array();
// Skip this line. // Skip this line.
if (strpos($dstr, "@") === 0) if ($dstr[0] == "@")
continue; continue;
preg_match("/\& ([^ ]+) .*/i", $dstr, $matches); preg_match("/(\&|#) ([^ ]+) .*/i", $dstr, $matches);
if (!empty($matches[1])) if (!empty($matches[2]))
$returnData[] = utf8_encode(trim($matches[1])); $returnData[] = utf8_encode(trim($matches[2]));
} }
return $returnData; return $returnData;
@ -82,7 +82,7 @@ class PSpellShell extends SpellChecker {
$matches = array(); $matches = array();
// Skip this line. // Skip this line.
if (strpos($dstr, "@") === 0) if ($dstr[0] == "@")
continue; continue;
preg_match("/\&[^:]+:(.*)/i", $dstr, $matches); preg_match("/\&[^:]+:(.*)/i", $dstr, $matches);
@ -103,10 +103,14 @@ class PSpellShell extends SpellChecker {
function _getCMD($lang) { function _getCMD($lang) {
$this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell"); $this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell");
if(preg_match("#win#i", php_uname())) $file = $this->_tmpfile;
return $this->_config['PSpellShell.aspell'] . " -a --lang=". escapeshellarg($lang) . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1"; $lang = preg_replace("/[^-_a-z]/", "", strtolower($lang));
$bin = $this->_config['PSpellShell.aspell'];
return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". escapeshellarg($lang); if (preg_match("#win#i", php_uname()))
return "$bin -a --lang=$lang --encoding=utf-8 -H < $file 2>&1";
return "cat $file | $bin -a --lang=$lang --encoding=utf-8 -H";
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ $wp_db_version = 19061;
* *
* @global string $tinymce_version * @global string $tinymce_version
*/ */
$tinymce_version = '345-20110918'; $tinymce_version = '345-20111105';
/** /**
* Holds the cache manifest version * Holds the cache manifest version