1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
authadapter.php
См. документацию.
1<?php
2
4
8use Bitrix\Seo\Service as SeoService;
9
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 {
82 {
83 try
84 {
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 {
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}
Определения loader.php:13
Определения uri.php:17
static create($type, IService $service=null)
Определения authadapter.php:40
getAuthData($isUseCache=true)
Определения authadapter.php:109
setParameters(array $parameters=[])
Определения authadapter.php:69
setService(IService $service)
Определения authadapter.php:59
__construct($type)
Определения authadapter.php:28
static getEngineCode($type)
Определения service.php:36
static getAuthorizeLink()
Определения service.php:370
static getAuth(string $engineCode)
Определения service.php:78
static register(string $serviceUrl='')
Определения service.php:318
static isRegistered()
Определения service.php:65
static clearAuth($engineCode, $localOnly=false)
Определения service.php:225
static getAuthorizeData($engine, $clientType=false)
Определения service.php:381
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if(file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) $uri
Определения urlrewrite.php:61
$instance
Определения ps_b24_final.php:14
</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