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