Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
localize.php
1<?php
3
5{
6 static $MESS = Array();
7
8 const FILE_LIB_CHAT = 'FILE_LIB_CHAT';
9
10 private static function resolveType($type)
11 {
12 $types = Array(
13 'FILE_LIB_CHAT' => '/bitrix/modules/imopenlines/lib/chat.php',
14 );
15
16 return isset($types[$type])? $types[$type]: false;
17 }
18
19 public static function get($type, $phraseCode = null, $lang = null)
20 {
21 $path = self::resolveType($type);
22 if (!$path)
23 {
24 return is_string($phraseCode)? '': Array();
25 }
26
27 if (!is_string($lang))
28 {
29 $lang = null;
30 }
31
32 if (!isset(self::$MESS[$type][$lang]))
33 {
34 self::$MESS[$type][$lang] = \Bitrix\Main\Localization\Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'].$path, $lang);
35 }
36
37 if (is_string($phraseCode))
38 {
39 return isset(self::$MESS[$type][$lang][$phraseCode])? self::$MESS[$type][$lang][$phraseCode]: '';
40 }
41 else
42 {
43 return isset(self::$MESS[$type][$lang])? self::$MESS[$type][$lang]: Array();
44 }
45 }
46}