author | Dan |
Sun, 21 Dec 2008 17:56:32 -0500 | |
changeset 784 | 72df14a56a03 |
permissions | -rw-r--r-- |
784
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
1 |
<?php |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
2 |
/** |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
3 |
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
4 |
* |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
5 |
* @author Moxiecode |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
6 |
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
7 |
*/ |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
8 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
9 |
class SpellChecker { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
10 |
/** |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
11 |
* Constructor. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
12 |
* |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
13 |
* @param $config Configuration name/value array. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
14 |
*/ |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
15 |
function SpellChecker(&$config) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
16 |
$this->_config = $config; |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
17 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
18 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
19 |
/** |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
20 |
* Simple loopback function everything that gets in will be send back. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
21 |
* |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
22 |
* @param $args.. Arguments. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
23 |
* @return {Array} Array of all input arguments. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
24 |
*/ |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
25 |
function &loopback(/* args.. */) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
26 |
return func_get_args(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
27 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
28 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
29 |
/** |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
30 |
* Spellchecks an array of words. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
31 |
* |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
32 |
* @param {String} $lang Language code like sv or en. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
33 |
* @param {Array} $words Array of words to spellcheck. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
34 |
* @return {Array} Array of misspelled words. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
35 |
*/ |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
36 |
function &checkWords($lang, $words) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
37 |
return $words; |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
38 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
39 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
40 |
/** |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
41 |
* Returns suggestions of for a specific word. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
42 |
* |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
43 |
* @param {String} $lang Language code like sv or en. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
44 |
* @param {String} $word Specific word to get suggestions for. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
45 |
* @return {Array} Array of suggestions for the specified word. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
46 |
*/ |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
47 |
function &getSuggestions($lang, $word) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
48 |
return array(); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
49 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
50 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
51 |
/** |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
52 |
* Throws an error message back to the user. This will stop all execution. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
53 |
* |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
54 |
* @param {String} $str Message to send back to user. |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
55 |
*/ |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
56 |
function throwError($str) { |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
57 |
die('{"result":null,"id":null,"error":{"errstr":"' . addslashes($str) . '","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}'); |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
58 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
59 |
} |
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
60 |
|
72df14a56a03
Added spell-checking support for TinyMCE on user request (see: http://forum.enanocms.org/topic/11/)
Dan
parents:
diff
changeset
|
61 |
?> |