1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
MarketUrl.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Rest\Infrastructure\Market;
4
5
use Bitrix\Main\Application;
6
use Bitrix\Main\License\UrlProvider;
7
use Bitrix\Main\Web\Uri;
8
9
class
MarketUrl
10
{
11
private
const
EULA_REGION_WHITELIST = [
'ru'
,
'by'
];
12
private
const
TERMS_REGION_BLACKLIST = [
'ru'
,
'ua'
,
'kz'
,
'by'
];
13
14
public
function
__construct
(
15
private
readonly
Uri
$productUrl,
16
private
readonly ?
string
$region
,
17
)
18
{}
19
20
public
static
function
createByDefault
(): self
21
{
22
if
(method_exists(UrlProvider::class,
'getProductDomain'
))
23
{
24
return
new
self
(
25
(
new
UrlProvider
())->getProductDomain(),
26
Application::getInstance()->getLicense()->getRegion(),
27
);
28
}
29
30
return
new
self
(
31
new
Uri
(self::getProductDomain()),
32
Application::getInstance()->getLicense()->getRegion(),
33
);
34
}
35
36
public
function
getEulaUrl
(): ?
Uri
37
{
38
if
(!in_array($this->region, self::EULA_REGION_WHITELIST))
39
{
40
return
null
;
41
}
42
43
$url
= clone $this->productUrl;
44
$url
->setPath(
"/download/files/manuals/$this->region/EULA_1C_Bitrix24_Market.html"
);
45
46
return
$url
;
47
}
48
49
public
function
getTermsUrl
(): ?
Uri
50
{
51
if
(in_array($this->region, self::TERMS_REGION_BLACKLIST))
52
{
53
return
null
;
54
}
55
56
$url
= clone $this->productUrl;
57
$url
->setPath(
'/terms/apps24_terms_of_service.pdf'
);
58
59
return
$url
;
60
}
61
62
protected
static
function
getProductDomain
(): string
63
{
64
$region
= Application::getInstance()->getLicense()->getRegion();
65
66
return
match (
$region
)
67
{
68
'ru'
=>
'https://www.1c-bitrix.ru'
,
69
'by'
=>
'https://www.1c-bitrix.by'
,
70
default
=>
'https://www.bitrix24.com'
,
71
};
72
}
73
}
Bitrix\Main\License\UrlProvider
Определения
UrlProvider.php:10
Bitrix\Main\Web\Uri
Определения
uri.php:17
Bitrix\Rest\Infrastructure\Market\MarketUrl
Определения
MarketUrl.php:10
Bitrix\Rest\Infrastructure\Market\MarketUrl\getTermsUrl
getTermsUrl()
Определения
MarketUrl.php:49
Bitrix\Rest\Infrastructure\Market\MarketUrl\__construct
__construct(private readonly Uri $productUrl, private readonly ?string $region,)
Определения
MarketUrl.php:14
Bitrix\Rest\Infrastructure\Market\MarketUrl\getProductDomain
static getProductDomain()
Определения
MarketUrl.php:62
Bitrix\Rest\Infrastructure\Market\MarketUrl\createByDefault
static createByDefault()
Определения
MarketUrl.php:20
Bitrix\Rest\Infrastructure\Market\MarketUrl\getEulaUrl
getEulaUrl()
Определения
MarketUrl.php:36
$region
$region
Определения
.description.php:13
$url
$url
Определения
iframe.php:7
bitrix
modules
rest
lib
Infrastructure
Market
MarketUrl.php
Создано системой
1.14.0