403Webshell
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/rospirotorg.ru/bitrix/modules/seo/lib/retargeting/services/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/seo/lib/retargeting/services/audiencegoogle.php
<?php

namespace Bitrix\Seo\Retargeting\Services;

use \Bitrix\Seo\Retargeting\Audience;

class AudienceGoogle extends Audience
{
	const TYPE_CODE = 'google';

	const MAX_CONTACTS_PER_PACKET = 0;
	const MIN_CONTACTS_FOR_ACTIVATING = 5000;
	const URL_AUDIENCE_LIST = 'https://ads.google.com/aw/audiences/management';

	protected static $listRowMap = array(
		'ID' => 'ID',
		'NAME' => 'NAME',
		'SUPPORTED_CONTACT_TYPES' => array(
			self::ENUM_CONTACT_TYPE_EMAIL,
			self::ENUM_CONTACT_TYPE_IDFA_GAID
		),
	);

	public static function normalizeListRow(array $row)
	{
		$map = array(
			'email' => self::ENUM_CONTACT_TYPE_EMAIL,
		);
		static::$listRowMap['SUPPORTED_CONTACT_TYPES'] = array($map[$row['CONTENT_TYPE']]);
		return parent::normalizeListRow($row);
	}

	public static function isSupportMultiTypeContacts()
	{
		return true;
	}

	public static function isSupportAccount()
	{
		return true;
	}

	public static function isSupportRemoveContacts()
	{
		return true;
	}

	public function add(array $data)
	{
		$response = $this->request->send(array(
			'methodName' => 'audience.add',
			'parameters' => array(
				'ACCOUNT_ID' => $this->accountId,
				'NAME' => $data['NAME'],
				'DESCRIPTION' => ''
			)
		));

		$responseData = $response->getData();
		if (isset($responseData['id']))
		{
			$response->setId($responseData['id']);
		}

		return $response;
	}

	protected function prepareContacts(array $contacts = array(), $type = null)
	{
		if ($type && isset($contacts[$type]))
		{
			return $contacts[$type];
		}

		$data = array();
		foreach (static::$listRowMap['SUPPORTED_CONTACT_TYPES'] as $contactType)
		{
			if (!isset($contacts[$contactType]) || !is_array($contacts[$contactType]))
			{
				continue;
			}

			$data = $contacts[$contactType];
		}

		return $data;
	}

	public function importContacts($audienceId, array $contacts, array $options)
	{
		$response = $this->request->send(array(
			'methodName' => 'audience.importcontacts',
			'parameters' => array(
				'ACCOUNT_ID' => $this->accountId,
				'AUDIENCE_ID' => $audienceId,
				'LIST' => $this->prepareContacts($contacts, $options['type'])
			)
		));

		return $response;
	}

	public function removeContacts($audienceId, array $contacts, array $options)
	{
		$response = $this->request->send(array(
			'methodName' => 'audience.removecontacts',
			'parameters' => array(
				'ACCOUNT_ID' => $this->accountId,
				'AUDIENCE_ID' => $audienceId,
				'LIST' => $this->prepareContacts($contacts, $options['type'])
			)
		));

		return $response;
	}

	public function getList()
	{
		$response = $this->request->send(array(
			'methodName' => 'audience.list',
			'parameters' => array(
				'ACCOUNT_ID' => $this->accountId,
			)
		));

		return $response;
	}

	public function getAudienceIdFromRow(array $row = null)
	{
		$key = 'ID';
		return (is_array($row) && $row[$key]) ? $row[$key] : null;
	}

	public static function isSupportAddAudience()
	{
		return true;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit