3 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
\r
5 * This class was contributed by Michel Weimerskirch.
\r
8 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
\r
11 class EnchantSpell extends SpellChecker {
\r
13 * Spellchecks an array of words.
\r
15 * @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
\r
16 * @param Array $words Array of words to check.
\r
17 * @return Array of misspelled words.
\r
19 function &checkWords($lang, $words) {
\r
20 $r = enchant_broker_init();
\r
22 if (enchant_broker_dict_exists($r,$lang)) {
\r
23 $d = enchant_broker_request_dict($r, $lang);
\r
25 $returnData = array();
\r
26 foreach($words as $key => $value) {
\r
27 $correct = enchant_dict_check($d, $value);
\r
29 $returnData[] = trim($value);
\r
34 enchant_broker_free_dict($d);
\r
38 enchant_broker_free($r);
\r
42 * Returns suggestions for a specific word.
\r
44 * @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
\r
45 * @param String $word Specific word to get suggestions for.
\r
46 * @return Array of suggestions for the specified word.
\r
48 function &getSuggestions($lang, $word) {
\r
49 $r = enchant_broker_init();
\r
52 if (enchant_broker_dict_exists($r,$lang)) {
\r
53 $d = enchant_broker_request_dict($r, $lang);
\r
54 $suggs = enchant_dict_suggest($d, $word);
\r
56 enchant_broker_free_dict($d);
\r
60 enchant_broker_free($r);
\r