-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings_disable_sections.php
More file actions
52 lines (45 loc) · 1.66 KB
/
settings_disable_sections.php
File metadata and controls
52 lines (45 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
+-----------------------------------------------------------------------+
| Copyright (C) 2017, Carlo Vollebregt |
| |
| Licensed under the GNU General Public License version 2 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
| |
| PURPOSE: |
| remove complete settings sections |
+-----------------------------------------------------------------------+
| Author: Carlo Vollebregt <carlovollebregt@eleven.nl> |
+-----------------------------------------------------------------------+
*/
/**
* settings_disable_sections plugin
*/
class settings_disable_sections extends rcube_plugin
{
public $task = 'settings';
/**
* initialize plugin
*/
public function init()
{
$this->add_hook('preferences_sections_list', array($this, 'disable_sections'));
}
/**
* @param $args
* @return mixed
*/
public function disable_sections($args)
{
// get sections to disable from config
$disable_sections = rcmail::get_instance()->config->get('settings_disable_sections', array());
// go trough all sections provided by the hook and remove the ones that should be disabled according to the config
foreach ($args["list"] as $section => $value) {
if (in_array($section, $disable_sections)) {
unset($args['list'][$section]);
}
}
return($args);
}
}