setup.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * setup.php
  4. * -----------
  5. * Squirrelspell setup file, as defined by the SquirrelMail-1.2 API.
  6. *
  7. * Copyright (c) 1999-2004 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. * @package plugins
  15. * @subpackage squirrelspell
  16. */
  17. /**
  18. * Standard squirrelmail plugin initialization API.
  19. *
  20. * @return void
  21. */
  22. function squirrelmail_plugin_init_squirrelspell() {
  23. global $squirrelmail_plugin_hooks;
  24. $squirrelmail_plugin_hooks['compose_button_row']['squirrelspell'] =
  25. 'squirrelspell_setup';
  26. $squirrelmail_plugin_hooks['optpage_register_block']['squirrelspell'] =
  27. 'squirrelspell_optpage_register_block';
  28. $squirrelmail_plugin_hooks['options_link_and_description']['squirrelspell'] =
  29. 'squirrelspell_options';
  30. }
  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. * Check if this browser is capable of using the plugin
  41. */
  42. if (checkForJavascript()) {
  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',
  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."),
  52. 'js' => TRUE);
  53. }
  54. }
  55. /**
  56. * This function adds a "Check Spelling" link to the "Compose" row
  57. * during message composition.
  58. *
  59. * @return void
  60. */
  61. function squirrelspell_setup() {
  62. /**
  63. * Check if this browser is capable of displaying SquirrelSpell
  64. * correctly.
  65. */
  66. if (checkForJavascript()) {
  67. /**
  68. * Some people may choose to disable javascript even though their
  69. * browser is capable of using it. So these freaks don't complain,
  70. * use document.write() so the "Check Spelling" button is not
  71. * displayed if js is off in the browser.
  72. */
  73. echo "<script type=\"text/javascript\">\n"
  74. . "<!--\n"
  75. . 'document.write("<input type=\"button\" value=\"'
  76. . _("Check Spelling")
  77. . '\" onclick=\"window.open(\'../plugins/squirrelspell/sqspell_'
  78. . 'interface.php\', \'sqspell\', \'status=yes,width=550,height=370,'
  79. . 'resizable=yes\')\">");' . "\n"
  80. . "//-->\n"
  81. . "</script>\n";
  82. }
  83. }
  84. ?>