3 * Tiny Spelling Interface for TinyMCE Spell Checking.
\r
5 * Copyright © 2006 Moxiecode Systems AB
\r
20 function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
\r
21 $this->lang = $lang;
\r
22 $this->mode = $mode;
\r
23 $this->plink = false;
\r
24 $this->errorMsg = array();
\r
26 if (!function_exists("pspell_new")) {
\r
27 $this->errorMsg[] = "PSpell not found.";
\r
31 $this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
\r
34 // Returns array with bad words or false if failed.
\r
35 function checkWords($wordArray) {
\r
36 if (!$this->plink) {
\r
37 $this->errorMsg[] = "No PSpell link found for checkWords.";
\r
41 $wordError = array();
\r
42 foreach($wordArray as $word) {
\r
43 if(!pspell_check($this->plink, trim($word)))
\r
44 $wordError[] = $word;
\r
50 // Returns array with suggestions or false if failed.
\r
51 function getSuggestion($word) {
\r
52 if (!$this->plink) {
\r
53 $this->errorMsg[] = "No PSpell link found for getSuggestion.";
\r
57 return pspell_suggest($this->plink, $word);
\r
61 // Setup classname, should be the same as the name of the spellchecker class
\r
62 $spellCheckerConfig['class'] = "TinyPspell";
\r