aboutsummaryrefslogtreecommitdiffstats
path: root/htdocs/application/models/Languages.php
blob: dfc7fb9fba58dccfabbee88b789530c82292221e (plain) (blame)
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
53
54
55
56
57
58
59
60
61
62
<?php
/**
 * Class and Function List:
 * Function list:
 * - __construct()
 * - valid_language()
 * - get_languages()
 * - code_to_description()
 * Classes list:
 * - Languages extends CI_Model
 */

class Languages extends CI_Model
{
	
	function __construct() 
	{
		parent::__construct();
		$this->load->config('geshi_languages');
		$this->geshi_languages = $this->config->item('geshi_languages');
		$this->favorite_languages = $this->config->item('favorite_languages');
		
		if ($this->favorite_languages === NULL) 
		{
			$this->load->config('config');
			$this->favorite_languages = $this->config->item('favorite_languages');
		}
	}
	
	function valid_language($lang) 
	{
		return array_key_exists($lang, $this->geshi_languages);
	}
	
	function get_languages() 
	{
		$data = array();
		
		if (is_array($this->favorite_languages)) 
		{
			foreach ($this->favorite_languages as $key) 
			{
				$data[$key] = $this->geshi_languages[$key];
			}
			$data["0"] = "-----------------";
		}
		foreach ($this->geshi_languages as $key => $value) 
		{
			
			if (!in_array($key, $data)) 
			{
				$data[$key] = $value;
			}
		}
		return $data;
	}
	
	function code_to_description($code) 
	{
		return $this->geshi_languages[$code];
	}
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy