• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/analytics/service.php
  • Класс: BitrixSeoAnalyticsService
  • Вызов: Service::getServiceProviders
static function getServiceProviders(array $types = null)
{
	$typeList = static::getTypes();

	$providers = array();
	foreach ($typeList as $type)
	{
		if ($types && !in_array($type, $types))
		{
			continue;
		}

		if (in_array($type, [static::TYPE_FACEBOOK, static::TYPE_INSTAGRAM]) && self::isRegionRussian(true))
		{
			continue;
		}

		$authAdapter = static::getInstance()->getAuthAdapter($type);
		$account = static::getInstance()->getAccount($type);

		$providers[$type] = array(
			'TYPE' => $type,
			'HAS_AUTH' => $authAdapter->hasAuth(),
			'AUTH_URL' => $authAdapter->getAuthUrl(),
			'HAS_ACCOUNTS' => $account->hasAccounts(),
			'PROFILE' => $account->getProfileCached(),
			'ENGINE_CODE' => static::getEngineCode($type),
			'CLIENTS' => static::getClientsProfiles($authAdapter)
		);

		// check if no profile, then may be auth was removed in service
		if ($providers[$type]['HAS_AUTH'] && empty($providers[$type]['PROFILE']))
		{
			static::removeAuth($type);
			$providers[$type]['HAS_AUTH'] = false;
		}
	}

	return $providers;
}