849bdf42 |
1 | <?php |
2 | |
9804bcde |
3 | /** |
4 | ** setup.php -- Squirrelspell setup file |
5 | ** |
6 | ** Copyright (c) 1999-2001 The SquirrelMail development team |
7 | ** Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | ** |
9 | ** This is a standard Squirrelmail-1.2 API for plugins. |
10 | ** |
11 | ** $Id$ |
12 | **/ |
849bdf42 |
13 | |
9804bcde |
14 | /** |
15 | * This function checks whether the user's USER_AGENT is known to |
16 | * be broken. If so, returns true and the plugin is invisible to the |
17 | * offending browser. |
18 | */ |
19 | function soupNazi(){ |
849bdf42 |
20 | |
2a15152a |
21 | global $HTTP_USER_AGENT, $SQSPELL_SOUP_NAZI; |
9804bcde |
22 | |
23 | require_once('../plugins/squirrelspell/sqspell_config.php'); |
849bdf42 |
24 | |
9804bcde |
25 | $soup_menu = explode( ',', $SQSPELL_SOUP_NAZI ); |
26 | return( in_array( trim( $HTTP_USER_AGENT ), $soup_menu ) ); |
27 | } |
849bdf42 |
28 | |
9804bcde |
29 | function squirrelmail_plugin_init_squirrelspell() { |
30 | /* Standard initialization API. */ |
31 | global $squirrelmail_plugin_hooks; |
849bdf42 |
32 | |
9804bcde |
33 | $squirrelmail_plugin_hooks['compose_button_row']['squirrelspell'] = 'squirrelspell_setup'; |
34 | $squirrelmail_plugin_hooks['options_register']['squirrelspell'] = 'squirrelspell_options'; |
35 | $squirrelmail_plugin_hooks['options_link_and_description']['squirrelspell'] = 'squirrelspell_options'; |
36 | } |
849bdf42 |
37 | |
9804bcde |
38 | function squirrelspell_options() { |
39 | // Gets added to the user's OPTIONS page. |
40 | global $optionpages; |
849bdf42 |
41 | |
9804bcde |
42 | if ( !soupNazi() ) { |
849bdf42 |
43 | |
9804bcde |
44 | /* Register Squirrelspell with the $optionpages array. */ |
45 | $optionpages[] = array( |
46 | 'name' => _("SpellChecker Options"), |
47 | 'url' => '../plugins/squirrelspell/sqspell_options.php', |
48 | '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."), |
49 | 'js' => TRUE |
50 | ); |
51 | } |
52 | } |
849bdf42 |
53 | |
9804bcde |
54 | function squirrelspell_setup() { |
55 | /* Gets added to the COMPOSE buttons row. */ |
56 | if ( !soupNazi() ) { |
57 | /* |
58 | ** using document.write to hide this functionality from people |
59 | ** with JavaScript turned off. |
60 | */ |
61 | echo "<script type=\"text/javascript\">\n". |
62 | "<!--\n". |
63 | 'document.write("<input type=\"button\" value=\"' . |
64 | _("Check Spelling") . '\" onclick=\"window.open(\'../plugins/squirrelspell/sqspell_interface.php\', \'sqspell\', \'status=yes,width=550,height=370,resizable=yes\')\">");'. "\n" . |
65 | "//-->\n". |
66 | "</script>\n"; |
67 | } |
68 | } |
849bdf42 |
69 | |
2a15152a |
70 | ?> |