- Модуль: seo
- Путь к файлу: ~/bitrix/modules/seo/lib/marketing/configurator.php
- Класс: BitrixSeoMarketingConfigurator
- Вызов: Configurator::getServiceProviders
static function getServiceProviders(array $types = null)
{
$typeList = static::getServiceTypes();
$providers = array();
foreach ($typeList as $type)
{
if ($types && !in_array($type, $types))
{
continue;
}
if($type === Service::TYPE_INSTAGRAM)
{
$type = Service::TYPE_FACEBOOK;
}
$service = static::getService();
$authAdapter = $service->getAuthAdapter($type);
$account = $service->getAccount($type);
$canUserMultiClients = $authAdapter->canUseMultipleClients();
$providers[$type] = array(
'TYPE' => $type,
'HAS_AUTH' => $authAdapter->hasAuth(),
'AUTH_URL' => $authAdapter->getAuthUrl(),
'PROFILE' => $authAdapter->getToken() ? $account->getProfileCached() : false,
'IS_SUPPORT_ACCOUNT' => true,
'ENGINE_CODE' => $service::getEngineCode($type)
);
if ($canUserMultiClients)
{
$providers[$type]['CLIENTS'] = static::getClientsProfiles($authAdapter);
if (empty($providers[$type]['CLIENTS']))
{
$providers[$type]['HAS_AUTH'] = false;
}
}
// check if no profile, then may be auth was removed in service
if ($providers[$type]['HAS_AUTH'] && empty($providers[$type]['PROFILE']))
{
static::removeAuth($type);
if (!$canUserMultiClients)
{
$providers[$type]['HAS_AUTH'] = false;
}
}
}
return $providers;
}