0fa28f2262fd3169d9e4fce63474a91ba4f1db27
[squirrelmail.git] / plugins / bug_report / setup.php
1 <?php
2
3 /**
4 * setup.php
5 *
6 * Copyright (c) 1999-2005 The SquirrelMail Project 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 * @version $Id$
12 * @package plugins
13 * @subpackage bug_report
14 */
15
16 /**
17 * Initialize the bug report plugin
18 * @return void
19 * @access private
20 */
21 function squirrelmail_plugin_init_bug_report() {
22 global $squirrelmail_plugin_hooks;
23
24 $squirrelmail_plugin_hooks['menuline']['bug_report'] = 'bug_report_button';
25 $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load';
26 $squirrelmail_plugin_hooks['optpage_loadhook_display']['bug_report'] = 'bug_report_block';
27 }
28
29
30 /**
31 * Show the button in the main bar
32 * @access private
33 */
34 function bug_report_button() {
35 global $bug_report_visible;
36
37 if (! $bug_report_visible) {
38 return;
39 }
40
41 displayInternalLink('plugins/bug_report/bug_report.php', _("Bug"), '');
42 echo "&nbsp;&nbsp;\n";
43 }
44
45 /**
46 * Loads bug report options
47 * @access private
48 */
49 function bug_report_load() {
50 global $username, $data_dir;
51 global $bug_report_visible;
52
53 $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false);
54 }
55
56 /**
57 * Register bug report option block
58 * @since 1.5.1
59 * @access private
60 */
61 function bug_report_block() {
62 global $optpage_data;
63 $optpage_data['grps']['bug_report'] = _("Bug Reports");
64 $optionValues = array();
65 // FIXME: option needs refresh in SMOPT_REFRESH_RIGHT
66 // (menulink is processed before options are saved/loaded)
67 $optionValues[] = array(
68 'name' => 'bug_report_visible',
69 'caption' => _("Show button in toolbar"),
70 'type' => SMOPT_TYPE_BOOLEAN,
71 'refresh' => SMOPT_REFRESH_ALL,
72 'initial_value' => false
73 );
74 $optpage_data['vals']['bug_report'] = $optionValues;
75 }
76
77 ?>