} else { enchant_broker_free($enchant); throw new Exception("Enchant spellchecker could not find dictionary for language: " . $lang); } return $suggestions; } /** * Return true/false if the engine is supported by the server. * * @return boolean True/false if the engine is supported. */ public function isSupported() { return function_exists("enchant_broker_init"); } private function normalizeLangCode($enchant, $lang) { $variants = array("en" => array("en_US", "en_GB")); if (isset($variants[$lang])) { array_unshift($variants, $lang); foreach ($variants[$lang] as $variant) { if (enchant_broker_dict_exists($enchant, $variant)) { return $variant; } } } return $lang; } } TinyMCE_Spellchecker_Engine::add("enchant", "TinyMCE_SpellChecker_EnchantEngine");
case "slow": $mode = PSPELL_SLOW; break; default: $mode = PSPELL_NORMAL; } // Setup PSpell link $plink = pspell_new($lang, $config['pspell.spelling'], $config['pspell.jargon'], $config['pspell.encoding'], $mode); if (!$plink) { throw new Exception("No PSpell link found opened."); } $outWords = array(); foreach ($words as $word) { if (!pspell_check($plink, trim($word))) { $outWords[] = utf8_encode($word); } } return $outWords; } /** * Return true/false if the engine is supported by the server. * * @return boolean True/false if the engine is supported. */ public function isSupported() { return function_exists("pspell_new"); } } TinyMCE_Spellchecker_Engine::add("pspell", "TinyMCE_SpellChecker_PSpellEngine");