diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-05-30 17:08:47 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-05-30 17:08:47 +0000 |
| commit | b99d09dd1b1b7d964b9726104cd6bdd82de9cef1 (patch) | |
| tree | 35cac318f8066dbba6c305717803aa8909eb52c4 /roundcubemail/program/include/rcube_spellchecker.php | |
| parent | 42ab7c04862ecd06ee178e005fa41d3654256f1b (diff) | |
- Fix setting language for spellchecker on spellcheck_before_send
git-svn-id: https://svn.roundcube.net/trunk@4817 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_spellchecker.php')
| -rw-r--r-- | roundcubemail/program/include/rcube_spellchecker.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/roundcubemail/program/include/rcube_spellchecker.php b/roundcubemail/program/include/rcube_spellchecker.php index 7acb70095..828240678 100644 --- a/roundcubemail/program/include/rcube_spellchecker.php +++ b/roundcubemail/program/include/rcube_spellchecker.php @@ -52,7 +52,7 @@ class rcube_spellchecker { $this->rc = rcmail::get_instance(); $this->engine = $this->rc->config->get('spellcheck_engine', 'googie'); - $this->lang = $lang; + $this->lang = $lang ? $lang : 'en'; if ($this->engine == 'pspell' && !extension_loaded('pspell')) { raise_error(array( @@ -161,6 +161,29 @@ class rcube_spellchecker /** + * Returns checking result (mispelled words with suggestions) + * + * @return array Spellchecking result. An array indexed by word. + */ + function get() + { + $result = array(); + + foreach ($this->matches as $item) { + if ($this->engine == 'pspell') { + $word = $item[0]; + } + else { + $word = mb_substr($this->content, $item[1], $item[2], RCMAIL_CHARSET); + } + $result[$word] = is_array($item[4]) ? implode("\t", $item[4]) : $item[4]; + } + + return $out; + } + + + /** * Returns error message * * @return string Error message |
