1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
bitrix.php
См. документацию.
1<?php
8
10
14
15if (!defined("BITRIX_CLOUD_ADV_URL"))
16{
17 $domain = (new \Bitrix\Main\License\UrlProvider())->getTechDomain();
18 $cloudAdvUrl = 'https://cloud-adv.' . $domain;
19
20 define("BITRIX_CLOUD_ADV_URL", $cloudAdvUrl);
21}
22
23if (!defined("SEO_BITRIX_API_URL"))
24{
25 define("SEO_BITRIX_API_URL", BITRIX_CLOUD_ADV_URL . "/rest/");
26}
27
28class Bitrix extends Engine implements IEngine
29{
30 const ENGINE_ID = 'bitrix';
31
32 protected $engineId = 'bitrix';
33
34 const API_URL = SEO_BITRIX_API_URL;
35
36 public function __construct()
37 {
38 $this->findEngine();
39 if ($this->engine)
40 {
41 parent::__construct();
42 }
43 }
44
45 protected function findEngine(): void
46 {
47 $this->engine = static::getEngine($this->engineId);
48 }
49
55 public function isRegistered(): bool
56 {
57 $this->findEngine();
58
59 return (bool) $this->engine;
60 }
61
62 public function getInterface()
63 {
64 $this->findEngine();
65
66 if (!$this->engine || !Loader::includeModule('socialservices'))
67 {
68 return null;
69 }
70
71 if ($this->authInterface === null)
72 {
73 $this->authInterface =
74 new \CBitrixSeoOAuthInterface($this->engine['CLIENT_ID'], $this->engine['CLIENT_SECRET']);
75
76 $this->authInterface->setProxyUrl($this->getAuthSettings()['PROXY_URL'] ?? '');
77 }
78
79 return $this->authInterface;
80 }
81
82 public function setAuthSettings($settings = null): void
83 {
84 if (!$this->isRegistered())
85 {
86 return;
87 }
88
89 if (is_array($settings) && array_key_exists("expires_in", $settings))
90 {
91 $settings["expires_in"] += time();
92 }
93
94 $this->engineSettings['AUTH'] = $settings;
95 $this->engineSettings['PROXY_URL'] = $settings['PROXY_URL'] ;
96 $this->saveSettings();
97 }
98}
Определения loader.php:13
__construct()
Определения bitrix.php:36
getInterface()
Определения bitrix.php:62
isRegistered()
Определения bitrix.php:55
setAuthSettings($settings=null)
Определения bitrix.php:82
$engineId
Определения bitrix.php:32
findEngine()
Определения bitrix.php:45
const API_URL
Определения bitrix.php:34
const ENGINE_ID
Определения bitrix.php:30
saveSettings()
Определения engine.php:83
getAuthSettings()
Определения engine.php:72
Определения iengine.php:11
Определения action.php:3
Определения bitrix.php:9
$settings
Определения product_settings.php:43
$engine
Определения options.php:121