select(); $select->from(Qs_Db::getTableName(Qs_Db_Language::$_tableAlias)); $select->where('`enabled` = "y"'); $select->order(array('def', 'sorter')); $list = $db->fetchAll($select); Qs_Db_Language::$_list = array(); foreach ($list as $language) { Qs_Db_Language::$_list[$language['name']] = $language; } } return Qs_Db_Language::$_list; } public static function getDefault() { if (null === Qs_Db_Language::$_default) { $list = Qs_Db_Language::getList(); foreach ($list as $language) { if ($language['def'] == 'y') { Qs_Db_Language::$_default = $language['name']; break; } } } return Qs_Db_Language::$_default; } public static function exists($language) { $list = Qs_Db_Language::getList(); return isset($list[$language]); } public static function getLang($lang, $field = null, $default = null) { $list = Qs_Db_Language::getList(); if (empty($list[$lang])) { return null; } $data = $list[$lang]; if (null === $field) { return $data; } return array_key_exists($field, $data) ? $data[$field] : $default; } public static function get($field = null, $default = null) { return static::getLang(CURRENT_LANGUAGE, $field, $default); } }