Aleksander Machniak
2012-08-08 10db0aaf3806686540aea4dcaeb0fa4faffebb8d
program/include/rcube_spellchecker.php
@@ -57,13 +57,6 @@
        $this->engine = $this->rc->config->get('spellcheck_engine', 'googie');
        $this->lang   = $lang ? $lang : 'en';
        if ($this->engine == 'pspell' && !extension_loaded('pspell')) {
            rcube::raise_error(array(
                'code' => 500, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Pspell extension not available"), true, true);
        }
        $this->options = array(
            'ignore_syms' => $this->rc->config->get('spellcheck_ignore_syms'),
            'ignore_nums' => $this->rc->config->get('spellcheck_ignore_nums'),
@@ -131,12 +124,12 @@
    /**
     * Returns mispelled words
     * Returns misspelled words
     *
     * @param string $text The content for spellchecking. If empty content
     *                     used for check() method will be used.
     *
     * @return array List of mispelled words
     * @return array List of misspelled words
     */
    function get_words($text = null, $is_html=false)
    {
@@ -171,7 +164,7 @@
    /**
     * Returns checking result (mispelled words with suggestions)
     * Returns checking result (misspelled words with suggestions)
     *
     * @return array Spellchecking result. An array indexed by word.
     */
@@ -250,7 +243,7 @@
    /**
     * Returns the mispelled words
     * Returns the misspelled words
     */
    private function _pspell_words($text = null, $is_html=false)
    {
@@ -264,7 +257,7 @@
                return array();
            }
            // With PSpell we don't need to get suggestions to return mispelled words
            // With PSpell we don't need to get suggestions to return misspelled words
            if ($is_html) {
                $text = $this->html2text($text);
            }
@@ -296,7 +289,7 @@
    /**
     * Returns suggestions for mispelled word
     * Returns suggestions for misspelled word
     */
    private function _pspell_suggestions($word)
    {
@@ -322,6 +315,16 @@
    private function _pspell_init()
    {
        if (!$this->plink) {
            if (!extension_loaded('pspell')) {
                $this->error = "Pspell extension not available";
                rcube::raise_error(array(
                    'code' => 500, 'type' => 'php',
                    'file' => __FILE__, 'line' => __LINE__,
                    'message' => $this->error), true, false);
                return;
            }
            $this->plink = pspell_new($this->lang, null, null, RCMAIL_CHARSET, PSPELL_FAST);
        }