1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
rest.php
См. документацию.
1<?php
2
3namespace Bitrix\Rest\Preset\Data;
4
5use Bitrix\Main\Config\Configuration;
6use Bitrix\Main\Data\Cache;
7use Bitrix\Main\ModuleManager;
8use Bitrix\Rest\Engine\RestManager;
9use CRestProvider;
10use Bitrix\Rest\Engine\ScopeManager;
11
16class Rest
17{
18 public const SCOPE = 'SCOPE';
19 public const METHOD = 'METHOD';
20 public const PLACEMENT = 'PLACEMENT';
21 public const EVENT = 'EVENT';
22 private const CACHE_TIME = 86400;
23 private const CACHE_DIR = '/rest/integration/data/rest/';
24
28 public static function getAllBasicDescription() : array
29 {
30 $result = [
31 static::SCOPE => [],
32 static::METHOD => [],
33 static::PLACEMENT => [],
34 static::EVENT => [],
35 ];
36 $cache = Cache::createInstance();
37 if ($cache->initCache(static::CACHE_TIME, 'allRestDescription' . LANGUAGE_ID, static::CACHE_DIR))
38 {
39 $result = $cache->getVars();
40 }
41 elseif ($cache->startDataCache())
42 {
43 $provider = new CRestProvider();
44 $allScope = $provider->getDescription();
45
46 foreach ($allScope as $scope => $list)
47 {
48 foreach ($list as $method => $data)
49 {
50 if ($method === '_events')
51 {
52 if (!isset($result[static::EVENT][$scope]))
53 {
54 $result[static::EVENT][$scope] = [];
55 }
56 $result[static::EVENT][$scope] = array_merge($result[static::EVENT][$scope], array_keys($data));
57 }
58 elseif ($method === '_placements')
59 {
60 if (!isset($result[static::PLACEMENT][$scope]))
61 {
62 $result[static::PLACEMENT][$scope] = [];
63 }
64 $result[static::PLACEMENT][$scope] = array_merge($result[static::PLACEMENT][$scope], array_keys($data));
65 }
66 else
67 {
68 $result[static::METHOD][$scope][] = $method;
69 }
70 }
71 }
72 $result[static::SCOPE] = array_keys($allScope);
73 $installedModuleList = ModuleManager::getInstalledModules();
74 foreach ($installedModuleList as $moduleId => $moduleDescription)
75 {
76 if (!isset($description[$moduleId]))
77 {
78 $controllersConfig = Configuration::getInstance($moduleId);
79
80 if (!empty($controllersConfig['controllers']['restIntegration']['enabled']))
81 {
83 }
84 }
85 }
86 $result[static::SCOPE] = array_values(array_unique($result[static::SCOPE]));
87
88 $cache->endDataCache($result);
89 }
90
91 return $result;
92 }
93
99 public static function getAccessPlacement($scopeList) : array
100 {
101 $result = [];
102 if (!is_array($scopeList))
103 {
104 return $result;
105 }
106 $placementList = static::getAllBasicDescription()[static::PLACEMENT];
107
108 $placementList = array_intersect_key($placementList, array_flip($scopeList));
109 foreach ($placementList as $values)
110 {
111 $result = array_merge($result, $values);
112 }
113
114 return $result;
115 }
116
120 public static function getBaseMethod() : array
121 {
122 $result = [];
123 $data = static::getAllBasicDescription();
124 if (!empty($data[static::METHOD]))
125 {
126 $result = $data[static::METHOD];
127 }
128
129 return $result;
130 }
131
135 public static function getBasePlacement() : array
136 {
137 $result = [];
138 $data = static::getAllBasicDescription();
139 if (!empty($data[static::PLACEMENT]))
140 {
141 $result = $data[static::PLACEMENT];
142 }
143
144 return $result;
145 }
146
150 public static function getScope() : array
151 {
152 return ScopeManager::getInstance()->listScope();
153 }
154}
if(!Loader::includeModule('messageservice')) $provider
Определения callback_ednaruimhpx.php:21
static getInstance()
Определения application.php:98
static getInstalledModules()
Определения modulemanager.php:9
static getModuleScopeAlias($moduleId)
Определения restmanager.php:67
static getBaseMethod()
Определения rest.php:120
const EVENT
Определения rest.php:21
const PLACEMENT
Определения rest.php:20
static getBasePlacement()
Определения rest.php:135
static getAllBasicDescription()
Определения rest.php:28
const SCOPE
Определения rest.php:18
const METHOD
Определения rest.php:19
static getAccessPlacement($scopeList)
Определения rest.php:99
static getScope()
Определения rest.php:150
$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
$moduleId
if(Loader::includeModule( 'bitrix24')) elseif(Loader::includeModule('intranet') &&CIntranetUtils::getPortalZone() !=='ru') $description
Определения .description.php:24
Определения handlers.php:8
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$method
Определения index.php:27