1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
MarketUrl.php
См. документацию.
1<?php
2
3namespace Bitrix\Rest\Infrastructure\Market;
4
5use Bitrix\Main\Application;
6use Bitrix\Main\License\UrlProvider;
7use Bitrix\Main\Web\Uri;
8
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}
Определения uri.php:17
__construct(private readonly Uri $productUrl, private readonly ?string $region,)
Определения MarketUrl.php:14
$region
Определения .description.php:13
$url
Определения iframe.php:7