См. определение в файле seo/lib/service.php строка 32
◆ clearAuth()
static clearAuth |
( |
|
$engineCode, |
|
|
|
$localOnly = false |
|
) |
| |
|
static |
- Аргументы
-
string | $engineCode | Provider code. |
bool | $localOnly | Do not delete client in seoproxy service. |
- Возвращает
- void @use \Bitrix\Seo\Service::clearAuthForClient(...)
- Исключения
-
- Уст.:
См. определение в файле seo/lib/service.php строка 195
197 static::clearClientsCache($engineCode);
201 static::getEngine()->getInterface()->clearClientAuth($engineCode);
◆ clearAuthForClient()
static clearAuthForClient |
( |
|
$client, |
|
|
|
$localOnly = false |
|
) |
| |
|
static |
Remove auth for a client.
- Аргументы
-
array | $client | Client data. |
bool | $localOnly | Only clear cache. |
- Возвращает
- void
- Исключения
-
См. определение в файле seo/lib/service.php строка 212
217 static::getEngine()->getInterface()->clearClientAuth($client[
'engine_code'], $client[
'proxy_client_id']);
219 static::clearClientsCache($client[
'engine_code'], $client[
'proxy_client_id']);
◆ clearClientsCache()
static clearClientsCache |
( |
|
$engine = null , |
|
|
|
$clientId = null |
|
) |
| |
|
static |
Clear clients list cache.
- Аргументы
-
string | null | $engine | Engine code. |
int | null | $clientId | Proxy client id. |
- Возвращает
- void
- Исключения
-
См. определение в файле seo/lib/service.php строка 166
169 $cache->Clean(static::CLIENT_LIST_CACHE_ID);
170 $cache->Clean(static::SERVICE_AUTH_CACHE_ID);
172 list($group, $type) = explode(
'.',
$engine, 2);
174 if ($group == \
Bitrix\Seo\Retargeting\Service::GROUP)
177 $service->setClientId($clientId);
178 $account = $service->getAccount($type);
180 $account->clearCache();
183 static::$clientList =
null;
184 static::$auth =
null;
◆ clearLocalAuth()
static clearLocalAuth |
( |
| ) |
|
|
static |
- Возвращает
- void @use \Bitrix\Seo\Service::clearClientsCache()
- Уст.:
См. определение в файле seo/lib/service.php строка 150
152 global $CACHE_MANAGER;
154 $CACHE_MANAGER->Clean(static::SERVICE_AUTH_CACHE_ID);
156 static::$auth =
null;
◆ getAuth()
static getAuth |
( |
|
$engineCode | ) |
|
|
static |
Get client info @use \Bitrix\Seo\Service::getClientList(...)
- Аргументы
-
string | $engineCode | Provider code. |
- Возвращает
- array
- Уст.:
См. определение в файле seo/lib/service.php строка 69
71 global $CACHE_MANAGER;
72 if(static::$auth ===
null)
74 if($CACHE_MANAGER->Read(static::SERVICE_AUTH_CACHE_TLL, static::SERVICE_AUTH_CACHE_ID))
76 static::$auth = $CACHE_MANAGER->Get(static::SERVICE_AUTH_CACHE_ID);
80 static::$auth = static::getEngine()->getInterface()->getClientInfo();
81 $CACHE_MANAGER->Set(static::SERVICE_AUTH_CACHE_ID, static::$auth);
87 return static::$auth[
"engine"][$engineCode];
◆ getAuthorizeData()
static getAuthorizeData |
( |
|
$engine, |
|
|
|
$clientType = false |
|
) |
| |
|
static |
- Аргументы
-
string | $engine | Provider code. |
bool | $clientType | Client type. |
- Возвращает
- array
- Исключения
-
См. определение в файле seo/lib/service.php строка 330
335 $checkKey = \CSocServAuthManager::GetUniqueKey();
341 "action" =>
"authorize",
342 "type" => $clientType,
344 "client_id" => static::getEngine()->getClientId(),
345 "client_secret" => static::getEngine()->getClientSecret(),
346 "key" => static::getLicense(),
347 "check_key" => urlencode($checkKey)
◆ getAuthorizeLink()
static getAuthorizeLink |
( |
| ) |
|
|
static |
- Возвращает
- string
См. определение в файле seo/lib/service.php строка 319
321 return static::SERVICE_URL.static::AUTHORIZE;
◆ getClientList()
static getClientList |
( |
|
$engineCode = false | ) |
|
|
static |
Get clients list.
- Аргументы
-
string | bool | $engineCode | Provider code. |
- Возвращает
- array
- Исключения
-
См. определение в файле seo/lib/service.php строка 99
101 if( static::$clientList ==
null)
104 if ($cache->read(static::CLIENT_LIST_CACHE_TLL, static::CLIENT_LIST_CACHE_ID))
106 static::$clientList = $cache->get(static::CLIENT_LIST_CACHE_ID);
107 static::$clientList = is_array(static::$clientList) ? static::$clientList : [];
111 $clientDataProvider = static::getEngine()->getInterface();
112 $result = $clientDataProvider->getClientList();
113 if (!is_array($result))
116 $data = $clientDataProvider->getClientInfo();
119 foreach ($data as $code => $client)
121 $data[
'proxy_client_type'] = static::CLIENT_TYPE_COMPATIBLE;
122 $data[
'engine_code'] = $code;
123 $data[
'proxy_client_id'] =
null;
130 $result = $result[
'items'];
132 $cache->set(static::CLIENT_LIST_CACHE_ID, $result);
133 static::$clientList = $result;
138 return array_filter(static::$clientList,
function ($item) use ($engineCode) {
139 return $item[
'engine_code'] == $engineCode;
142 return static::$clientList;
◆ getEngine()
- Возвращает
- \Bitrix\Seo\Engine\Bitrix
См. определение в файле seo/lib/service.php строка 262
266 static::$engine =
new Bitrix();
269 return static::$engine;
◆ getLicense()
◆ getRedirectUri()
static getRedirectUri |
( |
| ) |
|
|
staticprotected |
- Возвращает
- string
См. определение в файле seo/lib/service.php строка 354
361 return ($isHttps ?
'https' :
'http').
'://'.$host.static::REDIRECT_URI;
◆ isRegistered()
CAn connect to seoproxy?
- Возвращает
- bool
См. определение в файле seo/lib/service.php строка 57
59 return static::getEngine() ? static::getEngine()->isRegistered() :
false;
◆ register()
- Возвращает
- void
- Исключения
-
См. определение в файле seo/lib/service.php строка 277
279 static::clearClientsCache();
281 $httpClient =
new HttpClient();
283 $queryParams = array(
284 "key" => static::getLicense(),
285 "scope" => static::getEngine()->getInterface()->getScopeEncode(),
286 "redirect_uri" => static::getRedirectUri(),
289 $result = $httpClient->post(static::SERVICE_URL.static::REGISTER, $queryParams);
294 throw new SystemException($result[
"error"]);
298 static::setAccessSettings($result);
◆ setAccessSettings()
static setAccessSettings |
( |
array |
$accessParams | ) |
|
|
staticprotected |
Set access settings.
- Аргументы
-
array | $accessParams | Access params. |
- Возвращает
- void
- Исключения
-
См. определение в файле seo/lib/service.php строка 228
230 if(static::isRegistered())
232 $id = static::getEngine()->getId();
234 $result = SearchEngineTable::update($id, array(
235 "CLIENT_ID" => $accessParams[
"client_id"],
236 "CLIENT_SECRET" => $accessParams[
"client_secret"],
242 $result = SearchEngineTable::add(array(
246 "CLIENT_ID" => $accessParams[
"client_id"],
247 "CLIENT_SECRET" => $accessParams[
"client_secret"],
248 "REDIRECT_URI" => static::getRedirectUri(),
252 if($result->isSuccess())
255 static::$engine =
null;
◆ unregister()
- Возвращает
- void
- Исключения
-
См. определение в файле seo/lib/service.php строка 306
308 if(static::isRegistered())
310 $id = static::getEngine()->getId();
311 SearchEngineTable::delete($id);
312 static::clearClientsCache();
◆ $auth
◆ $clientList
◆ $engine
◆ AUTHORIZE
const AUTHORIZE = "/register/" |
◆ CLIENT_LIST_CACHE_ID
const CLIENT_LIST_CACHE_ID = 'seo|client_list' |
◆ CLIENT_LIST_CACHE_TLL
const CLIENT_LIST_CACHE_TLL = 86400 |
◆ CLIENT_TYPE_COMPATIBLE
const CLIENT_TYPE_COMPATIBLE = 'C' |
◆ CLIENT_TYPE_MULTIPLE
const CLIENT_TYPE_MULTIPLE = 'M' |
◆ CLIENT_TYPE_SINGLE
const CLIENT_TYPE_SINGLE = 'S' |
◆ REDIRECT_URI
const REDIRECT_URI = "/bitrix/tools/seo_client.php" |
◆ REGISTER
◆ SERVICE_AUTH_CACHE_ID
const SERVICE_AUTH_CACHE_ID = 'seo|service_auth' |
◆ SERVICE_AUTH_CACHE_TLL
const SERVICE_AUTH_CACHE_TLL = 86400 |
◆ SERVICE_URL
const SERVICE_URL = SEO_SERVICE_URL |
Объявления и описания членов класса находятся в файле: