849bdf42 |
1 | <?php |
d112ed5a |
2 | /** |
3 | * setup.php |
4 | * ----------- |
5 | * Squirrelspell setup file, as defined by the SquirrelMail-1.2 API. |
91e0dccc |
6 | * |
9eb3fcb3 |
7 | * Copyright (c) 1999-2005 The SquirrelMail Project Team |
d112ed5a |
8 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
9 | * |
10 | * $Id$ |
11 | * |
12 | * @author Konstantin Riabitsev <icon@duke.edu> ($Author$) |
13 | * @version $Date$ |
ea5f4b8e |
14 | * @package plugins |
15 | * @subpackage squirrelspell |
d112ed5a |
16 | */ |
849bdf42 |
17 | |
d112ed5a |
18 | /** |
598294a7 |
19 | * Standard SquirrelMail plugin initialization API. |
d112ed5a |
20 | * |
21 | * @return void |
22 | */ |
23 | function squirrelmail_plugin_init_squirrelspell() { |
04fa3c41 |
24 | global $squirrelmail_plugin_hooks; |
91e0dccc |
25 | $squirrelmail_plugin_hooks['compose_button_row']['squirrelspell'] = |
04fa3c41 |
26 | 'squirrelspell_setup'; |
91e0dccc |
27 | $squirrelmail_plugin_hooks['optpage_register_block']['squirrelspell'] = |
04fa3c41 |
28 | 'squirrelspell_optpage_register_block'; |
29 | $squirrelmail_plugin_hooks['options_link_and_description']['squirrelspell'] = |
30 | 'squirrelspell_options'; |
d112ed5a |
31 | } |
849bdf42 |
32 | |
d112ed5a |
33 | /** |
34 | * This function formats and adds the plugin and its description to the |
35 | * Options screen. |
36 | * |
37 | * @return void |
38 | */ |
39 | function squirrelspell_optpage_register_block() { |
04fa3c41 |
40 | global $optpage_blocks; |
d112ed5a |
41 | /** |
04fa3c41 |
42 | * Check if this browser is capable of using the plugin |
d112ed5a |
43 | */ |
04fa3c41 |
44 | if (checkForJavascript()) { |
45 | /** |
46 | * The browser checks out. |
91e0dccc |
47 | * Register Squirrelspell with the $optionpages array. |
04fa3c41 |
48 | */ |
49 | $optpage_blocks[] = |
50 | array( |
51 | 'name' => _("SpellChecker Options"), |
52 | 'url' => '../plugins/squirrelspell/sqspell_options.php', |
53 | 'desc' => _("Here you may set up how your personal dictionary is stored, edit it, or choose which languages should be available to you when spell-checking."), |
54 | 'js' => TRUE); |
55 | } |
d112ed5a |
56 | } |
849bdf42 |
57 | |
d112ed5a |
58 | /** |
59 | * This function adds a "Check Spelling" link to the "Compose" row |
60 | * during message composition. |
61 | * |
62 | * @return void |
63 | */ |
64 | function squirrelspell_setup() { |
d112ed5a |
65 | /** |
04fa3c41 |
66 | * Check if this browser is capable of displaying SquirrelSpell |
67 | * correctly. |
d112ed5a |
68 | */ |
04fa3c41 |
69 | if (checkForJavascript()) { |
70 | /** |
71 | * Some people may choose to disable javascript even though their |
72 | * browser is capable of using it. So these freaks don't complain, |
73 | * use document.write() so the "Check Spelling" button is not |
74 | * displayed if js is off in the browser. |
75 | */ |
76 | echo "<script type=\"text/javascript\">\n". |
77 | "<!--\n". |
78 | 'document.write("<input type=\"button\" value=\"'. |
79 | _("Check Spelling"). |
6e81363d |
80 | '\" name=\"check_spelling\" onclick=\"window.open(\'../plugins/squirrelspell/sqspell_'. |
04fa3c41 |
81 | 'interface.php\', \'sqspell\', \'status=yes,width=550,height=370,'. |
82 | 'resizable=yes\')\" />");' . "\n". |
83 | "//-->\n". |
84 | "</script>\n"; |
85 | } |
d112ed5a |
86 | } |
f8a1ed5a |
87 | ?> |