1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
businessauthadapter.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Seo\BusinessSuite\AuthAdapter\Facebook
;
4
5
use
Bitrix\Main\SystemException
;
6
use
Bitrix\Seo
;
7
use
Bitrix\Main\Web\Json
;
8
use
Bitrix\Main\Web\Uri
;
9
use
Bitrix\Seo\BusinessSuite\AuthAdapter\IAuthSettings
;
10
use
Bitrix\Seo\Retargeting
;
11
use
Bitrix\Seo\BusinessSuite\Configuration\Facebook
;
12
use InvalidArgumentException;
13
14
final
class
BusinessAuthAdapter
extends
Retargeting\AuthAdapter
15
{
17
private
$setup;
18
20
private
$config;
21
23
private
$installs;
24
25
public
function
getAuthUrl
()
26
{
27
$serviceUrl = (
new
Retargeting\ProxyRequest
())->getServiceUrl(
Seo
\
Service::SERVICE_URL
);
28
29
if
(!
Seo
\
Service::isRegistered
())
30
{
31
try
32
{
33
Seo\Service::register
($serviceUrl);
34
}
35
catch
(
SystemException
$e)
36
{
37
return
''
;
38
}
39
}
40
41
$authorizeUrl = (
new
Retargeting\ProxyRequest
())->getServiceUrl(
Seo
\
Service::getAuthorizeLink
());
42
43
$authorizeData =
Seo\Service::getAuthorizeData
(
44
$this->
getEngineCode
(),
45
$this->
canUseMultipleClients
() ?
Seo
\
Service::CLIENT_TYPE_MULTIPLE
:
Seo
\
Service::CLIENT_TYPE_SINGLE
46
);
47
$uri
=
new
Uri
($authorizeUrl);
48
if
(!empty($this->parameters[
'URL_PARAMETERS'
]))
49
{
50
$authorizeData[
'urlParameters'
] = $this->parameters[
'URL_PARAMETERS'
];
51
}
52
if
($this->setup && $this->config)
53
{
54
$authorizeData[
'settings'
] = Json::encode([
55
'setup'
=> $this->setup->toArray() + ($this->installs? $this->installs->toArray() : []),
56
'business_config'
=> $this->config->toArray(),
57
'repeat'
=>
false
58
]);
59
}
60
61
$uri
->addParams($authorizeData);
62
return
$uri
->getLocator();
63
}
64
70
public
function
setSetup
(
IAuthSettings
$setup =
null
): self
71
{
72
if
($setup instanceof
Facebook
\
Setup
)
73
{
74
$this->setup = $setup;
75
return
$this;
76
}
77
throw
new
InvalidArgumentException(
"Argument is not instance of Facebook/Setup"
);
78
}
79
85
public
function
setConfig
(
IAuthSettings
$config =
null
): self
86
{
87
if
($config instanceof
Facebook
\
Config
)
88
{
89
$this->config = $config;
90
return
$this;
91
}
92
throw
new
InvalidArgumentException(
"Argument is not instance of Facebook/Config"
);
93
}
94
95
public
function
setInstalls
(?
IAuthSettings
$installs) : self
96
{
97
if
($installs instanceof
Facebook
\
Installs
)
98
{
99
$this->installs = $installs;
100
return
$this;
101
}
102
throw
new
InvalidArgumentException(
"Argument is not instance of Facebook/Installs"
);
103
}
104
}
Bitrix\Main\SystemException
Определения
SystemException.php:9
Bitrix\Main\Web\Json
Определения
json.php:9
Bitrix\Main\Web\Uri
Определения
uri.php:17
Bitrix\Seo\BusinessSuite\AuthAdapter\Facebook\BusinessAuthAdapter
Определения
businessauthadapter.php:15
Bitrix\Seo\BusinessSuite\AuthAdapter\Facebook\BusinessAuthAdapter\setInstalls
setInstalls(?IAuthSettings $installs)
Определения
businessauthadapter.php:95
Bitrix\Seo\BusinessSuite\AuthAdapter\Facebook\BusinessAuthAdapter\getAuthUrl
getAuthUrl()
Определения
businessauthadapter.php:25
Bitrix\Seo\BusinessSuite\AuthAdapter\Facebook\BusinessAuthAdapter\setConfig
setConfig(IAuthSettings $config=null)
Определения
businessauthadapter.php:85
Bitrix\Seo\BusinessSuite\AuthAdapter\Facebook\BusinessAuthAdapter\setSetup
setSetup(IAuthSettings $setup=null)
Определения
businessauthadapter.php:70
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Installs
Определения
installs.php:12
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Setup
Определения
setup.php:12
Bitrix\Seo\Retargeting\AuthAdapter
Определения
authadapter.php:13
Bitrix\Seo\Retargeting\AuthAdapter\getEngineCode
getEngineCode()
Определения
authadapter.php:165
Bitrix\Seo\Retargeting\AuthAdapter\canUseMultipleClients
canUseMultipleClients()
Определения
authadapter.php:201
Bitrix\Seo\Retargeting\ProxyRequest
Определения
proxyrequest.php:9
Bitrix\Seo\Service\getAuthorizeLink
static getAuthorizeLink()
Определения
service.php:370
Bitrix\Seo\Service\register
static register(string $serviceUrl='')
Определения
service.php:318
Bitrix\Seo\Service\isRegistered
static isRegistered()
Определения
service.php:65
Bitrix\Seo\Service\SERVICE_URL
const SERVICE_URL
Определения
service.php:40
Bitrix\Seo\Service\getAuthorizeData
static getAuthorizeData($engine, $clientType=false)
Определения
service.php:381
Bitrix\Seo\Service\CLIENT_TYPE_SINGLE
const CLIENT_TYPE_SINGLE
Определения
service.php:53
Bitrix\Seo\Service\CLIENT_TYPE_MULTIPLE
const CLIENT_TYPE_MULTIPLE
Определения
service.php:54
Bitrix\Seo\BusinessSuite\AuthAdapter\IAuthSettings
Определения
iauthsettings.php:6
$uri
if(file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) $uri
Определения
urlrewrite.php:61
Bitrix\Main\Config
Определения
configuration.php:3
Bitrix\Seo\BusinessSuite\AuthAdapter\Facebook
Определения
businessauthadapter.php:3
Bitrix\Seo\BusinessSuite\Configuration\Facebook
Определения
config.php:2
Bitrix\Seo\Retargeting
Определения
account.php:3
Bitrix\Seo
bitrix
modules
seo
lib
businesssuite
authadapter
facebook
businessauthadapter.php
Создано системой
1.14.0