1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
rest.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Rest\Preset\Data;
4
5
use Bitrix\Main\Config\Configuration;
6
use Bitrix\Main\Data\Cache;
7
use Bitrix\Main\ModuleManager;
8
use Bitrix\Rest\Engine\RestManager;
9
use CRestProvider;
10
use Bitrix\Rest\Engine\ScopeManager;
11
16
class
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
{
82
$result
[static::SCOPE][] =
RestManager::getModuleScopeAlias
(
$moduleId
);
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
}
$provider
if(!Loader::includeModule('messageservice')) $provider
Определения
callback_ednaruimhpx.php:21
Bitrix\Main\Application\getInstance
static getInstance()
Определения
application.php:98
Bitrix\Main\ModuleManager\getInstalledModules
static getInstalledModules()
Определения
modulemanager.php:9
Bitrix\Rest\Engine\RestManager\getModuleScopeAlias
static getModuleScopeAlias($moduleId)
Определения
restmanager.php:67
Bitrix\Rest\Preset\Data\Rest\getBaseMethod
static getBaseMethod()
Определения
rest.php:120
Bitrix\Rest\Preset\Data\Rest\EVENT
const EVENT
Определения
rest.php:21
Bitrix\Rest\Preset\Data\Rest\PLACEMENT
const PLACEMENT
Определения
rest.php:20
Bitrix\Rest\Preset\Data\Rest\getBasePlacement
static getBasePlacement()
Определения
rest.php:135
Bitrix\Rest\Preset\Data\Rest\getAllBasicDescription
static getAllBasicDescription()
Определения
rest.php:28
Bitrix\Rest\Preset\Data\Rest\SCOPE
const SCOPE
Определения
rest.php:18
Bitrix\Rest\Preset\Data\Rest\METHOD
const METHOD
Определения
rest.php:19
Bitrix\Rest\Preset\Data\Rest\getAccessPlacement
static getAccessPlacement($scopeList)
Определения
rest.php:99
Bitrix\Rest\Preset\Data\Rest\getScope
static getScope()
Определения
rest.php:150
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$moduleId
$moduleId
Определения
group_bizproc_workflow_delete.php:16
$description
if(Loader::includeModule( 'bitrix24')) elseif(Loader::includeModule('intranet') &&CIntranetUtils::getPortalZone() !=='ru') $description
Определения
.description.php:24
Bitrix\Main\Rest
Определения
handlers.php:8
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$method
$method
Определения
index.php:27
bitrix
modules
rest
lib
preset
data
rest.php
Создано системой
1.14.0