summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-22 18:31:50 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-22 18:31:50 +0000
commitd48e85e0ac5e675ca33fac173f30c75403d1033f (patch)
tree1164430fa3b83a4d9283961b09c1576f2885e6b2 /wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php
parent086dcde66603301531efc6d8087bd06d0546f148 (diff)
downloadwordpress-mu-d48e85e0ac5e675ca33fac173f30c75403d1033f.tar.gz
wordpress-mu-d48e85e0ac5e675ca33fac173f30c75403d1033f.tar.xz
wordpress-mu-d48e85e0ac5e675ca33fac173f30c75403d1033f.zip
Moved everything in wp-inst down a directory.
Uses's Ryan Boren's htaccess rules and mods If you're upgrading, try this on a test server first! git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@591 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php')
-rwxr-xr-xwp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php
new file mode 100755
index 0000000..21fb194
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php
@@ -0,0 +1,64 @@
+<?php
+/* *
+ * Tiny Spelling Interface for TinyMCE Spell Checking.
+ *
+ * Copyright © 2006 Moxiecode Systems AB
+ *
+ */
+
+class TinyPSpell {
+ var $lang;
+ var $mode;
+ var $string;
+ var $plink;
+ var $errorMsg;
+
+ var $jargon;
+ var $spelling;
+ var $encoding;
+
+ function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
+ $this->lang = $lang;
+ $this->mode = $mode;
+ $this->plink = false;
+ $this->errorMsg = array();
+
+ if (!function_exists("pspell_new")) {
+ $this->errorMsg[] = "PSpell not found.";
+ return;
+ }
+
+ $this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
+ }
+
+ // Returns array with bad words or false if failed.
+ function checkWords($wordArray) {
+ if (!$this->plink) {
+ $this->errorMsg[] = "No PSpell link found for checkWords.";
+ return array();
+ }
+
+ $wordError = array();
+ foreach($wordArray as $word) {
+ if(!pspell_check($this->plink, trim($word)))
+ $wordError[] = $word;
+ }
+
+ return $wordError;
+ }
+
+ // Returns array with suggestions or false if failed.
+ function getSuggestion($word) {
+ if (!$this->plink) {
+ $this->errorMsg[] = "No PSpell link found for getSuggestion.";
+ return array();
+ }
+
+ return pspell_suggest($this->plink, $word);
+ }
+}
+
+// Setup classname, should be the same as the name of the spellchecker class
+$spellCheckerConfig['class'] = "TinyPspell";
+
+?> \ No newline at end of file