Use new git Horde_SpellChecker
authorMichael M Slusarz <slusarz@curecanti.org>
Sun, 22 Feb 2009 01:33:14 +0000 (18:33 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Sun, 22 Feb 2009 01:33:14 +0000 (18:33 -0700)
imp/compose.php
imp/lib/Imple/SpellChecker.php

index c3e3389..d8b6e32 100644 (file)
@@ -619,9 +619,12 @@ if ($has_js) {
         }
         $imp_ui->attachAutoCompleter($auto_complete);
         if (!empty($conf['spell']['driver'])) {
-            if (Horde_SpellChecker::factory($conf['spell']['driver'], array()) !== false) {
+            try {
+                Horde_SpellChecker::getInstance($conf['spell']['driver'], array());
                 $spellcheck = true;
                 $imp_ui->attachSpellChecker('imp', true);
+            } catch (Exception $e) {
+                Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR);
             }
         }
         Horde::addScriptFile('ieEscGuard.js', 'horde', true);
index f3b20a5..62bb068 100644 (file)
@@ -87,18 +87,18 @@ class IMP_Imple_SpellChecker extends IMP_Imple
             $spellArgs['html'] = true;
         }
 
-        $speller = Horde_SpellChecker::factory(
-            $GLOBALS['conf']['spell']['driver'], $spellArgs);
-        if ($speller === false) {
+        try {
+            $speller = Horde_SpellChecker::getInstance($GLOBALS['conf']['spell']['driver'], $spellArgs);
+        } catch (Exception $e) {
+            Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR);
             return array();
         }
 
-        $result = $speller->spellCheck(Util::getPost($args['input']));
-        if (is_a($result, 'PEAR_Error')) {
-            Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
+        try {
+            return $speller->spellCheck(Util::getPost($args['input']));
+        } catch (Exception $e) {
+            Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR);
             return array('bad' => array(), 'suggestions' => array());
-        } else {
-            return $result;
         }
     }