summaryrefslogtreecommitdiff
path: root/program/include/rcube_spellchecker.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-05-30 17:08:47 +0000
committeralecpl <alec@alec.pl>2011-05-30 17:08:47 +0000
commit644e3ad91250c0cb7b291b48e3b5cef401bffd90 (patch)
tree6027a214fe6a422e19a397e30c260f1a4129203a /program/include/rcube_spellchecker.php
parent1d5779b2577453a1000f38fa987bb0eafd3c554f (diff)
- Fix setting language for spellchecker on spellcheck_before_send
Diffstat (limited to 'program/include/rcube_spellchecker.php')
-rw-r--r--program/include/rcube_spellchecker.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/program/include/rcube_spellchecker.php b/program/include/rcube_spellchecker.php
index 7acb70095..828240678 100644
--- a/program/include/rcube_spellchecker.php
+++ b/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