aboutsummaryrefslogtreecommitdiff
path: root/mod/translation_editor/actions/delete_language.php
blob: 77b8441f5e0a4e53aa2a4b65acbffcb7b83ba361 (plain)
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
<?php 

	admin_gatekeeper();
	
	$language = get_input("language");
	if(!empty($language) && ($language != "en")){
		
		$completeness = translation_editor_get_language_completeness($language);
		if($completeness == 0){
			if($custom_languages = elgg_get_plugin_setting("custom_languages", "translation_editor")){
				$custom_languages = explode(",", $custom_languages);
				
				$index = array_search($language, $custom_languages);
				if($index !== false ){
					unset($custom_languages[$index]);
					
					$code = implode(",", array_unique($custom_languages));
	
					elgg_set_plugin_setting("custom_languages", $code, "translation_editor");
					system_message(elgg_echo("translation_editor:action:delete_language:success"));
				}
			}
		}
	}
	
	forward(REFERER);