-
Notifications
You must be signed in to change notification settings - Fork 0
/
FWebApplication.php
executable file
·46 lines (41 loc) · 1.04 KB
/
FWebApplication.php
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
<?php
/**
* Base class for our web application.
*
* Here will be the tweaks affecting the behavior of all entry points.
*
* @package oqila.core
*/
class FWebApplication extends CWebApplication
{
/**
*
* @var string codes like en, ru or uz
*/
private $_defaultLanguage = null;
/**
*
* @var array of key-values: en=>English, ...
*/
private $_languages = null;
public function getDefaultLanguage()
{
if($this->_defaultLanguage === null)
$this->initData();
return $this->_defaultLanguage;
}
public function getLanguages()
{
if($this->_languages === null)
$this->initData();
return $this->_languages;
}
public function initData()
{
$data = FLanguageModel::find()->getProcessedData();
if (empty($data))
throw new CHttpException(404, Yii::t('core', 'no_language_found'));
$this->_defaultLanguage = $data['is_default'];
$this->_languages = $data['data'];
}
}