start.php ➔ language_selector_plugins_boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
require_once(dirname(__FILE__) . "/lib/functions.php");
4
5
/**
6
 * Init function for the language selector
7
 * 
8
 * @return void
9
 */
10
function language_selector_plugins_boot() {
11
	language_selector_set_logged_out_user_language();
12
	elgg_extend_view("css/elgg", "language_selector/css/site");
13
}
14
15
/**
16
 * Extends the header with the language selector
17
 * 
18
 * @return void
19
 */
20
function language_selector_pagesetup() {
21
	if (elgg_get_plugin_setting("show_in_header", "language_selector") == "yes") {
22
		elgg_extend_view("page/elements/header", "language_selector/default");
23
	}
24
}
25
26
// register hooks
27
elgg_register_plugin_hook_handler("all", "plugin", "language_selector_invalidate_setting");
28
29
// register events
30
elgg_register_event_handler("language:merge", "translation_editor", "language_selector_invalidate_setting");
31
elgg_register_event_handler("all", "plugin", "language_selector_invalidate_setting");
32
33
// Default event handlers for plugin functionality
34
elgg_register_event_handler('plugins_boot', 'system', 'language_selector_plugins_boot');
35
elgg_register_event_handler('pagesetup', 'system', 'language_selector_pagesetup');
36
elgg_register_event_handler('upgrade', 'system', 'language_selector_invalidate_setting');
37
38
// actions
39
elgg_register_action('language_selector/change', dirname(__FILE__) . '/actions/change.php', "logged_in");
40