Test Failed
Push — master ( 19e7e7...e85ccb )
by
unknown
07:48
created

Pluginkendox::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
/**
4
 * Kendox Plugin.
5
 *
6
 * Integrates Kendox into the grommunio environment.
7
 */
8
class Pluginkendox extends Plugin {
9
	/**
10
	 * Function initializes the Plugin and registers all hooks.
11
	 */
12
	public function init() {
13
		$this->registerHook('server.core.settings.init.before');
14
	}
15
16
	/**
17
	 * Function is executed when a hook is triggered by the PluginManager.
18
	 *
19
	 * @param string $eventID the id of the triggered hook
20
	 * @param mixed  $data    object(s) related to the hook
21
	 */
22
	public function execute($eventID, &$data) {
23
		switch ($eventID) {
24
			case 'server.core.settings.init.before':
25
				$this->injectPluginSettings($data);
26
				break;
27
		}
28
	}
29
30
	/**
31
	 * Called when the core Settings class is initialized and ready to accept sysadmin default
32
	 * settings. Registers the sysadmin defaults for the FILES plugin.
33
	 *
34
	 * @param array $data Reference to the data of the triggered hook
35
	 */
36
	public function injectPluginSettings(&$data) {
37
		$data['settingsObj']->addSysAdminDefaults([
38
			'zarafa' => [
39
				'v1' => [
40
					'plugins' => [
41
						'kendox' => [
42
							'enable' => PLUGIN_KENDOX_USER_DEFAULT_ENABLE,
43
							'environment' => PLUGIN_KENDOX_ENVIRONMENT,
44
							'api_url' => PLUGIN_KENDOX_API_URL,
45
							'api_url_test' => PLUGIN_KENDOX_API_URL_TEST,
46
							'dialog_url' => PLUGIN_KENDOX_DIALOG_URL,
47
							'dialog_url_test' => PLUGIN_KENDOX_DIALOG_URL_TEST,
48
							'path' => PATH_PLUGIN_DIR . '/kendox',
49
						],
50
					],
51
				],
52
			],
53
		]);
54
	}
55
}
56