1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
accountfacebook.php
См. документацию.
1<?php
2
4
8
10{
12
13 public const URL_ACCOUNT_LIST = 'https://www.facebook.com/bookmarks/pages';
14
15 public const URL_INFO = 'https://www.facebook.com/business/a/lead-ads';
16
17 protected static $listRowMap = array(
18 'ID' => 'ID',
19 'NAME' => 'NAME',
20 );
21
25 public function getList()
26 {
27 $paginator = new Paginator(
28 $this->getRequest(),
29 [
30 'methodName' => 'leadads.accounts.get',
31 'parameters' => [
32 'fields' => ['id','name','category','access_token','tasks'],
33 "params" => [
34 "limit" => 50
35 ]
36 ],
37 ]
38 );
39
40 $result = null;
41 $data = [];
42
43 foreach ($paginator as $request)
44 {
45 if (!$request->isSuccess())
46 {
47 return $request;
48 }
49
50 foreach ($request->getData() as $item)
51 {
52 if (array_intersect($item['tasks'] ?? [], ['MODERATE', 'CREATE_CONTENT', 'MANAGE']))
53 {
54 $data[] = $item;
55 }
56 }
58 }
59
60 !$result?:$result->setData($data);
61
62 return $result;
63 }
64
69 public function getProfile(): ?array
70 {
71 $response = $this->getRequest()->send([
72 'methodName' => 'leadads.profile.get',
73 'parameters' => [
74 'fields' => ['id','name','picture','link']
75 ]
76 ]);
77
78 if ($response->isSuccess() && $data = $response->fetch())
79 {
80
81 return [
82 'ID' => $data['ID'],
83 'NAME' => $data['NAME'],
84 'LINK' => $data['LINK'],
85 'PICTURE' => $data['PICTURE'] ? $data['PICTURE']['data']['url'] : null,
86 ];
87 }
88
89 return null;
90 }
91}
const TYPE_FACEBOOK
Определения service.php:18
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
Определения account.php:3
$response
Определения result.php:21