Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
mask.php
1
<?php
2
namespace
Bitrix\Im\Call
;
3
4
use
Bitrix\Im\Common
;
5
use
Bitrix\Main\Localization\Loc
;
6
7
class
Mask
8
{
9
private
static
$path =
'/bitrix/js/im/images/masks'
;
10
11
public
static
function
get
()
12
{
13
return
array_merge(
14
self::getBaseList()
15
);
16
}
17
18
private
static
function
getBaseList()
19
{
20
$result = [
21
[
22
'id'
=>
'bear1'
,
23
'active'
=>
true
,
24
],
25
[
26
'id'
=>
'owl2'
,
27
'active'
=>
true
,
28
],
29
[
30
'id'
=>
'fox1'
,
31
'active'
=>
true
,
32
],
33
[
34
'id'
=>
'panther1'
,
35
'active'
=>
true
,
36
],
37
[
38
'id'
=>
'polebear1'
,
39
'active'
=>
true
,
40
],
41
[
42
'id'
=>
'santa2'
,
43
'active'
=>
true
,
44
],
45
[
46
'id'
=>
'bear2'
,
47
'active'
=>
true
,
48
],
49
[
50
'id'
=>
'owl1'
,
51
'active'
=>
true
,
52
],
53
[
54
'id'
=>
'fox3'
,
55
'active'
=>
true
,
56
],
57
[
58
'id'
=>
'panther2'
,
59
'active'
=>
true
,
60
],
61
[
62
'id'
=>
'polebear2'
,
63
'active'
=>
true
,
64
],
65
[
66
'id'
=>
'santa4'
,
67
'active'
=>
true
,
68
],
69
[
70
'id'
=>
'bear4'
,
71
'active'
=>
true
,
72
],
73
[
74
'id'
=>
'owl3'
,
75
'active'
=>
true
,
76
],
77
[
78
'id'
=>
'fox2'
,
79
'active'
=>
true
,
80
],
81
[
82
'id'
=>
'panther4'
,
83
'active'
=>
true
,
84
],
85
[
86
'id'
=>
'polebear4'
,
87
'active'
=>
true
,
88
],
89
[
90
'id'
=>
'santa1'
,
91
'active'
=>
true
,
92
],
93
[
94
'id'
=>
'bear3'
,
95
'active'
=>
true
,
96
],
97
[
98
'id'
=>
'fox4'
,
99
'active'
=>
true
,
100
],
101
[
102
'id'
=>
'panther3'
,
103
'active'
=>
true
,
104
],
105
[
106
'id'
=>
'polebear3'
,
107
'active'
=>
true
,
108
],
109
[
110
'id'
=>
'santa3'
,
111
'active'
=>
true
,
112
],
113
];
114
115
foreach
($result as &$value)
116
{
117
$value[
'title'
] = preg_replace_callback(
"/(\D+)(\d+)/i"
,
static
function
($matches){
118
return
Loc::getMessage
(
'IM_CALL_MASK_'
. mb_strtoupper($matches[1]) .
'_'
. $matches[2]);
119
}, $value[
'id'
]);
120
121
$value[
'preview'
] = self::$path .
"/"
. $value[
'id'
] .
'.png'
;
122
123
if
($value[
'active'
])
124
{
125
$version = isset($value[
'version'
]) ?
'?v'
. $value[
'version'
]:
''
;
126
127
$value[
'mask'
] =
self::getCdnPath
().
"/"
. $value[
'id'
] .
'.bam.gz'
. $version;
128
129
$value[
'background'
] = preg_replace_callback(
"/(\D+)(\d+)/i"
,
static
function
($matches){
130
return
self::getCdnPath
() .
"/"
. $matches[1] .
'.jpg'
;
131
}, $value[
'id'
]);
132
}
133
else
134
{
135
$value[
'mask'
] =
''
;
136
$value[
'background'
] =
''
;
137
}
138
unset($value[
'version'
]);
139
}
140
141
return
$result;
142
}
143
144
public
static
function
getCdnPath
()
145
{
146
$settings = \Bitrix\Main\Config\Configuration::getValue(
'im'
);
147
if
(!empty($settings[
'call'
][
'mask_url'
]) && mb_strpos($settings[
'call'
][
'mask_url'
],
'https'
) === 0)
148
{
149
return
$settings[
'call'
][
'mask_url'
];
150
}
151
152
if
(\
Bitrix
\Main\Loader::includeModule(
'bitrix24'
))
153
{
154
$zone = \CBitrix24::getCurrentAreaConfig();
155
$domain =
'www'
. $zone[
'DEFAULT_DOMAIN'
];
156
}
157
else
158
{
159
$zoneCode = LANGUAGE_ID;
160
if
(in_array(LANGUAGE_ID, [
'ru'
,
'by'
,
'kz'
],
true
))
161
{
162
$domain =
'www.bitrix24.'
. LANGUAGE_ID;
163
}
164
else
165
{
166
$domain =
'www.bitrix24.com'
;
167
}
168
}
169
170
return
'https://'
. $domain .
'/util/mask'
;
171
}
172
}
173
Bitrix\Im\Call\Mask
Definition
mask.php:8
Bitrix\Im\Call\Mask\getCdnPath
static getCdnPath()
Definition
mask.php:144
Bitrix\Im\Common
Definition
common.php:7
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Im\Call
Definition
auth.php:9
Bitrix
modules
im
lib
call
mask.php
Создано системой
1.10.0