1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
authadapter.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Seo\Checkout
;
4
5
use
Bitrix\Main\Loader
;
6
use
Bitrix\Main\Web\Uri
;
7
use
Bitrix\Main\SystemException
;
8
use
Bitrix\Seo\Service
as SeoService;
9
14
class
AuthAdapter
15
{
17
protected
$service
;
18
protected
$type
;
19
protected
$data
;
20
22
protected
$parameters
= [
'URL_PARAMETERS'
=> []];
23
28
public
function
__construct
(
$type
)
29
{
30
$this->type =
$type
;
31
}
32
40
public
static
function
create
(
$type
,
IService
$service
=
null
)
41
{
42
if
(!Loader::includeModule(
'socialservices'
))
43
{
44
throw
new
SystemException
(
'Module "socialservices" not installed.'
);
45
}
46
$instance
=
new
static
(
$type
);
47
if
(
$service
)
48
{
49
$instance
->setService(
$service
);
50
}
51
52
return
$instance
;
53
}
54
59
public
function
setService
(
IService
$service
)
60
{
61
$this->service =
$service
;
62
return
$this;
63
}
64
69
public
function
setParameters
(
array
$parameters
= [])
70
{
71
$this->parameters =
$parameters
+
$this->parameters
;
72
return
$this;
73
}
74
79
public
function
getAuthUrl
()
80
{
81
if
(!
SeoService::isRegistered
())
82
{
83
try
84
{
85
SeoService::register
();
86
}
87
catch
(
SystemException
$e)
88
{
89
return
''
;
90
}
91
}
92
93
$authorizeUrl =
SeoService::getAuthorizeLink
();
94
$authorizeData =
SeoService::getAuthorizeData
($this->
getEngineCode
());
95
$uri
=
new
Uri
($authorizeUrl);
96
if
(!empty($this->parameters[
'URL_PARAMETERS'
]))
97
{
98
$authorizeData[
'urlParameters'
] = $this->parameters[
'URL_PARAMETERS'
];
99
}
100
$uri
->addParams($authorizeData);
101
102
return
$uri
->getLocator();
103
}
104
109
protected
function
getAuthData
($isUseCache =
true
)
110
{
111
if
(!$isUseCache || !$this->data ||
count
($this->data) == 0)
112
{
113
$this->data =
SeoService::getAuth
($this->
getEngineCode
());
114
}
115
116
return
$this->data
;
117
}
118
119
public
function
removeAuth
()
120
{
121
$this->data =
array
();
122
123
if
($existedAuthData = $this->
getAuthData
(
false
))
124
{
125
SeoService::clearAuth
($this->
getEngineCode
());
126
}
127
}
128
132
protected
function
getEngineCode
()
133
{
134
if
($this->service)
135
{
136
return
$this->service->getEngineCode($this->type);
137
}
138
else
139
{
140
return
Service::getEngineCode
($this->type);
141
}
142
}
143
147
public
function
getType
()
148
{
149
return
$this->type
;
150
}
151
155
public
function
getToken
()
156
{
157
$data
= $this->
getAuthData
();
158
return
$data
?
$data
[
'access_token'
] :
null
;
159
}
160
164
public
function
hasAuth
()
165
{
166
return
$this->
getToken
() <>
''
;
167
}
168
}
Bitrix\Main\Loader
Определения
loader.php:13
Bitrix\Main\SystemException
Определения
SystemException.php:9
Bitrix\Main\Web\Uri
Определения
uri.php:17
Bitrix\Seo\Checkout\AuthAdapter
Определения
authadapter.php:15
Bitrix\Seo\Checkout\AuthAdapter\create
static create($type, IService $service=null)
Определения
authadapter.php:40
Bitrix\Seo\Checkout\AuthAdapter\getToken
getToken()
Определения
authadapter.php:155
Bitrix\Seo\Checkout\AuthAdapter\getAuthData
getAuthData($isUseCache=true)
Определения
authadapter.php:109
Bitrix\Seo\Checkout\AuthAdapter\setParameters
setParameters(array $parameters=[])
Определения
authadapter.php:69
Bitrix\Seo\Checkout\AuthAdapter\getEngineCode
getEngineCode()
Определения
authadapter.php:132
Bitrix\Seo\Checkout\AuthAdapter\removeAuth
removeAuth()
Определения
authadapter.php:119
Bitrix\Seo\Checkout\AuthAdapter\$data
$data
Определения
authadapter.php:19
Bitrix\Seo\Checkout\AuthAdapter\getType
getType()
Определения
authadapter.php:147
Bitrix\Seo\Checkout\AuthAdapter\hasAuth
hasAuth()
Определения
authadapter.php:164
Bitrix\Seo\Checkout\AuthAdapter\getAuthUrl
getAuthUrl()
Определения
authadapter.php:79
Bitrix\Seo\Checkout\AuthAdapter\setService
setService(IService $service)
Определения
authadapter.php:59
Bitrix\Seo\Checkout\AuthAdapter\$type
$type
Определения
authadapter.php:18
Bitrix\Seo\Checkout\AuthAdapter\$parameters
$parameters
Определения
authadapter.php:22
Bitrix\Seo\Checkout\AuthAdapter\$service
$service
Определения
authadapter.php:17
Bitrix\Seo\Checkout\AuthAdapter\__construct
__construct($type)
Определения
authadapter.php:28
Bitrix\Seo\Checkout\Service\getEngineCode
static getEngineCode($type)
Определения
service.php:36
Bitrix\Seo\Service\getAuthorizeLink
static getAuthorizeLink()
Определения
service.php:370
Bitrix\Seo\Service\getAuth
static getAuth(string $engineCode)
Определения
service.php:78
Bitrix\Seo\Service\register
static register(string $serviceUrl='')
Определения
service.php:318
Bitrix\Seo\Service\isRegistered
static isRegistered()
Определения
service.php:65
Bitrix\Seo\Service\clearAuth
static clearAuth($engineCode, $localOnly=false)
Определения
service.php:225
Bitrix\Seo\Service\getAuthorizeData
static getAuthorizeData($engine, $clientType=false)
Определения
service.php:381
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Seo\Checkout\IService
Определения
iservice.php:10
$uri
if(file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) $uri
Определения
urlrewrite.php:61
Bitrix\Main\Service
Bitrix\Seo\Checkout
Определения
authadapter.php:3
$instance
$instance
Определения
ps_b24_final.php:14
count
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения
waybill.php:936
bitrix
modules
seo
lib
checkout
authadapter.php
Создано системой
1.14.0