1C-Bitrix
25.700.0
Toggle main menu visibility
Титульная страница
Пространства имен
Пространства имен
Члены пространств имен
Указатель
$
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Функции
_
a
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
w
Переменные
$
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
v
w
Перечисления
a
b
c
d
e
f
g
l
m
n
o
p
r
s
t
u
v
w
Элементы перечислений
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Структуры данных
Структуры данных
Алфавитный указатель структур данных
Иерархия классов
Поля структур
Указатель
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Функции
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Перечисления
Элементы перечислений
Файлы
Файлы
Список членов всех файлов
Указатель
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
б
в
к
л
о
п
с
т
ю
Функции
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
б
в
к
л
о
п
с
т
ю
Блог
Хостинг
•
Указатель
Структуры данных
Пространства имен
Файлы
Функции
Переменные
Перечисления
Элементы перечислений
Страницы
Загрузка...
Поиск...
Не найдено
extension.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\MobileApp\Janative\Entity;
4
5
use Bitrix\Main\IO\File;
6
use Bitrix\Main\IO\Path;
7
use Bitrix\Main\SystemException;
8
use Bitrix\Main\Web\Json;
9
use Bitrix\MobileApp\Janative\Manager;
10
use Bitrix\MobileApp\Janative\Utils;
11
12
class
Extension
extends
Base
13
{
14
protected
static
array
$modificationDates
= [];
15
protected
static
array
$dependencies
= [];
16
protected
static
array
$resolvedDependencies
= [];
17
protected
static
array
$extensionCache
= [];
18
protected
static
$paths
= [];
19
public
?
string
$result
=
null
;
20
27
public
static
function
getInstance
($identifier):
Extension
28
{
29
if
(!isset(self::$extensionCache[$identifier]))
30
{
31
self::$extensionCache[$identifier] =
new
Extension
($identifier);
32
}
33
34
return
self::$extensionCache[$identifier];
35
}
27
public
static
function
getInstance
($identifier):
Extension
{
…
}
36
37
public
function
__construct
($identifier)
38
{
39
$identifier = Path::normalize($identifier);
40
$this->baseFileName =
'extension'
;
41
$desc
=
Utils::extractEntityDescription
($identifier);
42
$this->name =
$desc
[
'name'
];
43
$this->
namespace
=
$desc
['namespace'];
44
if
(isset(self::$paths[
$desc
[
'fullname'
]]))
45
{
46
$this->
path
= self::$paths[
$desc
[
'fullname'
]];
47
}
48
else
49
{
50
$this->
path
=
Manager::getExtensionPath
($identifier);
51
self::$paths[
$desc
[
'fullname'
]] =
$this->path
;
52
}
53
54
if
(!$this->
path
)
55
{
56
throw
new
SystemException
(
"Extension '{$desc['fullname']}' doesn't exists"
);
57
}
58
}
37
public
function
__construct
($identifier) {
…
}
59
60
private
function
getBundleContent(): string
61
{
62
$files
= $this->
getBundleFiles
();
63
$content
=
""
;
64
foreach
(
$files
as
$path
)
65
{
66
$file =
new
File
(
$path
);
67
if
($file->isExists())
68
{
69
$content
.=
"\n"
.$file->getContents().
"\n"
;
70
}
71
}
72
73
return
$content
;
74
}
75
82
public
function
getContent
($excludeResult =
false
): string
83
{
84
$content
=
""
;
85
$extensionFile =
new
File
($this->
path
.
'/'
. $this->baseFileName .
'.js'
);
86
if
($excludeResult !==
true
) {
87
$content
.= $this->
getResultExpression
();
88
}
89
else
90
{
91
$this->result = $this->getResult();
92
}
93
94
if
($extensionFile->isExists() && $extensionContent = $extensionFile->getContents())
95
{
96
$content
.= $this->getBundleContent();
97
$content
.= $extensionContent;
98
}
99
100
$content
.=
"\n\n"
;
101
102
return
$content
;
103
}
82
public
function
getContent
($excludeResult =
false
): string {
…
}
104
105
public
function
getResultExpression
(): string {
106
$this->result = $this->getResult();
107
if
($this->result !=
null
&& $this->result !==
''
)
108
{
109
$name
= ($this->
namespace
!= "bitrix
"? $this->namespace."
:" : "").$this->name;
110
return <<<JS
111
this.jnExtensionData.set("{$name}", {$this->result});
112
JS;
113
}
114
115
return "";
116
}
105
public
function
getResultExpression
(): string {
…
}
117
118
private function getResult(): ?string
119
{
120
$file = new File($this->path . '/extension.php');
121
$result = null;
122
if ($file->isExists())
123
{
124
$result
= include($file->getPath());
125
}
126
127
if
(!empty(
$result
) && is_array(
$result
))
128
{
129
return
Json::encode(
$result
);
130
}
131
132
return
null
;
133
}
134
135
public
function
getIncludeExpression
($callbackName =
'onExtensionsLoaded'
): string
136
{
137
$relativePath = $this->
getPath
() .
'extension.js'
;
138
$localizationPhrases = $this->
getLangDefinitionExpression
();
139
$content
=
"\n//extension '{$this->name}'\n"
;
140
$content
.=
"{$localizationPhrases}\n"
;
141
$content
.=
"loadScript(\"{$relativePath}\", false, {$callbackName});"
;
142
143
return
$content
;
144
}
135
public
function
getIncludeExpression
($callbackName =
'onExtensionsLoaded'
): string {
…
}
145
155
public
static
function
getResolvedDependencyList
(
$name
, &$list = [], &$alreadyResolved = [],
$margin
= 0):
array
156
{
157
$baseExtension =
Extension::getInstance
(
$name
);
158
$depsList = $baseExtension->getDependencyList();
159
$alreadyResolved[] =
$name
;
160
if
(!empty($depsList))
161
{
162
$margin
++;
163
foreach
($depsList as $ext)
164
{
165
$depExtension =
Extension::getInstance
($ext);
166
$extDepsList = $depExtension->getDependencyList();
167
if
(empty($extDepsList))
168
{
169
array_unshift($list, $ext);
170
}
171
elseif
(!in_array($ext, $alreadyResolved))
172
{
173
self::getResolvedDependencyList
($ext, $list, $alreadyResolved,
$margin
);
174
}
175
}
176
}
177
178
$list[] =
$name
;
179
180
return
array_unique($list);
181
}
155
public
static
function
getResolvedDependencyList
(
$name
, &$list = [], &$alreadyResolved = [],
$margin
= 0):
array
{
…
}
182
183
protected
function
onBeforeModificationMarkerSave
(
array
&$value)
184
{
185
$files
= $this->
getBundleFiles
();
186
foreach
(
$files
as
$path
)
187
{
188
$file =
new
File
(
$path
);
189
if
($file->isExists())
190
{
191
$value[] =
Utils::getFileHash
($file);
192
}
193
}
194
}
183
protected
function
onBeforeModificationMarkerSave
(
array
&$value) {
…
}
195
200
protected
function
resolveDependencies
():
array
201
{
202
$name
= ($this->
namespace
!== "bitrix
" ? $this->namespace . "
:" : "") . $this->name;
203
return self::getResolvedDependencyList($name);
204
}
200
protected
function
resolveDependencies
():
array
{
…
}
205
206
public
function
getDependencies
():
array
207
{
208
$fullyQualifiedName = $this->
getFullyQualifiedName
();
209
self::$resolvedDependencies[$fullyQualifiedName] ??= array_values($this->
resolveDependencies
());
210
211
return
self::$resolvedDependencies[$fullyQualifiedName];
212
}
206
public
function
getDependencies
():
array
{
…
}
213
214
public
function
getDependencyList
()
215
{
216
$fullyQualifiedName = $this->
getFullyQualifiedName
();
217
self::$dependencies[$fullyQualifiedName] ??= parent::getDependencyList();
218
219
return
self::$dependencies[$fullyQualifiedName];
220
}
214
public
function
getDependencyList
() {
…
}
221
}
12
class
Extension
extends
Base
{
…
};
$path
$path
Определения
access_edit.php:21
Bitrix\Main\SystemException
Определения
SystemException.php:9
Bitrix\MobileApp\Janative\Entity\Base
Определения
base.php:16
Bitrix\MobileApp\Janative\Entity\Base\$path
$path
Определения
base.php:21
Bitrix\MobileApp\Janative\Entity\Base\getPath
getPath()
Определения
base.php:116
Bitrix\MobileApp\Janative\Entity\Base\getLangDefinitionExpression
getLangDefinitionExpression()
Определения
base.php:286
Bitrix\MobileApp\Janative\Entity\Base\$name
$name
Определения
base.php:24
Bitrix\MobileApp\Janative\Entity\Base\getBundleFiles
getBundleFiles()
Определения
base.php:172
Bitrix\MobileApp\Janative\Entity\Base\getFullyQualifiedName
getFullyQualifiedName()
Определения
base.php:103
Bitrix\MobileApp\Janative\Entity\Extension
Определения
extension.php:13
Bitrix\MobileApp\Janative\Entity\Extension\onBeforeModificationMarkerSave
onBeforeModificationMarkerSave(array &$value)
Определения
extension.php:183
Bitrix\MobileApp\Janative\Entity\Extension\$extensionCache
static array $extensionCache
Определения
extension.php:17
Bitrix\MobileApp\Janative\Entity\Extension\$paths
static $paths
Определения
extension.php:18
Bitrix\MobileApp\Janative\Entity\Extension\getResolvedDependencyList
static getResolvedDependencyList($name, &$list=[], &$alreadyResolved=[], $margin=0)
Определения
extension.php:155
Bitrix\MobileApp\Janative\Entity\Extension\$resolvedDependencies
static array $resolvedDependencies
Определения
extension.php:16
Bitrix\MobileApp\Janative\Entity\Extension\resolveDependencies
resolveDependencies()
Определения
extension.php:200
Bitrix\MobileApp\Janative\Entity\Extension\getIncludeExpression
getIncludeExpression($callbackName='onExtensionsLoaded')
Определения
extension.php:135
Bitrix\MobileApp\Janative\Entity\Extension\getDependencies
getDependencies()
Определения
extension.php:206
Bitrix\MobileApp\Janative\Entity\Extension\getInstance
static getInstance($identifier)
Определения
extension.php:27
Bitrix\MobileApp\Janative\Entity\Extension\$dependencies
static array $dependencies
Определения
extension.php:15
Bitrix\MobileApp\Janative\Entity\Extension\__construct
__construct($identifier)
Определения
extension.php:37
Bitrix\MobileApp\Janative\Entity\Extension\$modificationDates
static array $modificationDates
Определения
extension.php:14
Bitrix\MobileApp\Janative\Entity\Extension\getContent
getContent($excludeResult=false)
Определения
extension.php:82
Bitrix\MobileApp\Janative\Entity\Extension\getDependencyList
getDependencyList()
Определения
extension.php:214
Bitrix\MobileApp\Janative\Entity\Extension\$result
string $result
Определения
extension.php:19
Bitrix\MobileApp\Janative\Entity\Extension\getResultExpression
getResultExpression()
Определения
extension.php:105
Bitrix\MobileApp\Janative\Manager\getExtensionPath
static getExtensionPath($ext)
Определения
manager.php:97
Bitrix\MobileApp\Janative\Utils\getFileHash
static getFileHash(File $file)
Определения
utils.php:52
Bitrix\MobileApp\Janative\Utils\extractEntityDescription
static extractEntityDescription($entityIdentifier, string $defaultNamespace="bitrix")
Определения
utils.php:16
$content
$content
Определения
commerceml.php:144
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Main\File
Определения
Image.php:9
Bitrix\Main\$files
$files
Определения
mysql_to_pgsql.php:30
$desc
if(mb_strlen($order)< 6) $desc
Определения
payment.php:44
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$margin
if(CSalePaySystemAction::GetParamValue('BACKGROUND', false)) $margin
Определения
html.php:61
path
path
Определения
template_copy.php:201
bitrix
modules
mobileapp
lib
janative
entity
extension.php
Создано системой
1.14.0