setup.php 2.5 KB

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