Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/seo/lib/controller/business/ |
Upload File : |
<?php namespace Bitrix\Seo\Controller\Business; use Bitrix\Main; use Bitrix\Seo\BusinessSuite\ServiceAdapter; use Bitrix\Seo\BusinessSuite\Utils; use Bitrix\Seo\BusinessSuite; use Bitrix\Main\Engine\Response\AjaxJson; use Bitrix\Seo\BusinessSuite\Configuration\Facebook; final class Extension extends Main\Engine\Controller { /** * Install fbe action * @param $engineCode * @param $setup * @param $config * * @return AjaxJson */ public function installAction($engineCode, $setup, $config): AjaxJson { $response = null; try { if (is_string($engineCode) && is_array($setup) && is_array($config)) { $meta = BusinessSuite\ServiceMetaData::create() ->setService($service = Utils\ServiceFactory::getServiceByEngineCode($engineCode)) ->setEngineCode($engineCode) ->setType($service::getTypeByEngine($engineCode)); $serviceContainer = ServiceAdapter::createServiceWrapperContainer()->setMeta($meta); $response = AjaxJson::createSuccess([ 'authUrl' => $serviceContainer->getAuthAdapter($meta->getType()) ->setConfig($config = Facebook\Config::loadFromArray($config)) ->setSetup($setup = Facebook\Setup::loadFromArray($setup)) ->setInstalls(Facebook\Installs::load()) ->getAuthUrl() ]); $response = ($setup->save()? $response : AjaxJson::createError(null,[])); } } catch (BusinessSuite\Exception\ConfigException $exception) { $handler = BusinessSuite\Exception\ConfigExceptionHandler::handle($exception); $response = AjaxJson::createError($handler->getErrorCollection(),$handler->getCustomData()); } catch (\Throwable $exception) { $response = AjaxJson::createError(); } finally { return $response; } } }