849bdf42 |
1 | <?php |
d112ed5a |
2 | /** |
3 | * setup.php |
4 | * ----------- |
5 | * Squirrelspell setup file, as defined by the SquirrelMail-1.2 API. |
6 | * |
76911253 |
7 | * Copyright (c) 1999-2003 The SquirrelMail development 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$ |
14 | */ |
849bdf42 |
15 | |
d112ed5a |
16 | /** |
17 | * Standard squirrelmail plugin initialization API. |
18 | * |
19 | * @return void |
20 | */ |
21 | function squirrelmail_plugin_init_squirrelspell() { |
22 | global $squirrelmail_plugin_hooks; |
23 | $squirrelmail_plugin_hooks['compose_button_row']['squirrelspell'] = |
24 | 'squirrelspell_setup'; |
25 | $squirrelmail_plugin_hooks['optpage_register_block']['squirrelspell'] = |
26 | 'squirrelspell_optpage_register_block'; |
27 | $squirrelmail_plugin_hooks['options_link_and_description']['squirrelspell'] = |
28 | 'squirrelspell_options'; |
29 | } |
849bdf42 |
30 | |
d112ed5a |
31 | /** |
32 | * This function formats and adds the plugin and its description to the |
33 | * Options screen. |
34 | * |
35 | * @return void |
36 | */ |
37 | function squirrelspell_optpage_register_block() { |
38 | global $optpage_blocks; |
39 | /** |
40 | * soupNazi checks if this browser is capable of using the plugin. |
41 | */ |
42 | if (!soupNazi()) { |
43 | /** |
44 | * The browser checks out. |
45 | * Register Squirrelspell with the $optionpages array. |
46 | */ |
47 | $optpage_blocks[] = |
48 | array( |
49 | 'name' => _("SpellChecker Options"), |
50 | 'url' => '../plugins/squirrelspell/sqspell_options.php', |
2a917bbc |
51 | '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."), |
d112ed5a |
52 | 'js' => TRUE); |
53 | } |
54 | } |
849bdf42 |
55 | |
d112ed5a |
56 | /** |
57 | * This function adds a "Check Spelling" link to the "Compose" row |
58 | * during message composition. |
59 | * |
60 | * @return void |
61 | */ |
62 | function squirrelspell_setup() { |
63 | /** |
64 | * Check if this browser is capable of displaying SquirrelSpell |
65 | * correctly. |
66 | */ |
67 | if (!soupNazi()) { |
68 | /** |
69 | * Some people may choose to disable javascript even though their |
70 | * browser is capable of using it. So these freaks don't complain, |
71 | * use document.write() so the "Check Spelling" button is not |
72 | * displayed if js is off in the browser. |
73 | */ |
4e37bc18 |
74 | echo "<script type=\"text/javascript\">\n" |
75 | . "<!--\n" |
d112ed5a |
76 | . 'document.write("<input type=\"button\" value=\"' |
77 | . _("Check Spelling") |
78 | . '\" onclick=\"window.open(\'../plugins/squirrelspell/sqspell_' |
79 | . 'interface.php\', \'sqspell\', \'status=yes,width=550,height=370,' |
4e37bc18 |
80 | . 'resizable=yes\')\">");' . "\n" |
81 | . "//-->\n" |
d112ed5a |
82 | . "</script>\n"; |
83 | } |
84 | } |
2a15152a |
85 | ?> |