Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
util.php
1<?
2namespace Bitrix\UI;
3
6
7Loc::loadMessages(__FILE__);
8
13class Util
14{
15 private const HELPDESK_DOMAIN = [
16 'en' => 'https://helpdesk.bitrix24.com',
17 'br' => 'https://helpdesk.bitrix24.com.br',
18 'de' => 'https://helpdesk.bitrix24.de',
19 'es' => 'https://helpdesk.bitrix24.es',
20 'fr' => 'https://helpdesk.bitrix24.fr',
21 'it' => 'https://helpdesk.bitrix24.it',
22 'pl' => 'https://helpdesk.bitrix24.pl',
23 'ru' => 'https://helpdesk.bitrix24.ru',
24 ];
25
26 public static function getHelpdeskUrl($byLang = false)
27 {
28 $lang = LANGUAGE_ID;
29 if (Loader::includeModule('bitrix24'))
30 {
31 $licensePrefix = \CBitrix24::getLicensePrefix();
32 if(!$byLang || $licensePrefix === 'ua')
33 {
34 $lang = $licensePrefix;
35 }
36 }
37
38 switch ($lang)
39 {
40 case "ru":
41 case "by":
42 case "kz":
43 $helpdeskUrl = static::HELPDESK_DOMAIN['ru'];
44 break;
45
46 case "de":
47 $helpdeskUrl = static::HELPDESK_DOMAIN['de'];
48 break;
49
50 case "br":
51 $helpdeskUrl = static::HELPDESK_DOMAIN['br'];
52 break;
53
54 case "fr":
55 $helpdeskUrl = static::HELPDESK_DOMAIN['fr'];
56 break;
57
58 case "la":
59 $helpdeskUrl = static::HELPDESK_DOMAIN['es'];
60 break;
61
62 case "pl":
63 $helpdeskUrl = static::HELPDESK_DOMAIN['pl'];
64 break;
65
66 case "it":
67 $helpdeskUrl = static::HELPDESK_DOMAIN['it'];
68 break;
69
70 default:
71 $helpdeskUrl = static::HELPDESK_DOMAIN['en'];
72 }
73
74 return $helpdeskUrl;
75 }
76
82 public static function listDomain()
83 {
84 return array_values(static::HELPDESK_DOMAIN);
85 }
86
91 public static function getArticleUrlByCode(string $code): ?string
92 {
93 if (preg_match('/([\w]+)/', $code, $matches))
94 {
95 $articleUrl = self::getHelpdeskUrl();
96 $articleUrl .= '/open/code_' . $code . '/';
97
98 return $articleUrl;
99 }
100
101 return null;
102 }
103}
104
static loadMessages($file)
Definition loc.php:64
static getHelpdeskUrl($byLang=false)
Definition util.php:26
static listDomain()
Definition util.php:82
static getArticleUrlByCode(string $code)
Definition util.php:91