forked from ylabio/ylab.ddata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
include.php
44 lines (40 loc) · 1.61 KB
/
include.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
spl_autoload_register(function ($className) {
preg_match('/^(.*?)([\w]+)$/i', $className, $matches);
if (count($matches) < 3) {
return;
}
$filePath = implode(DIRECTORY_SEPARATOR, array(
__DIR__,
"lib",
str_replace('\\', DIRECTORY_SEPARATOR, trim($matches[1], '\\')),
str_replace('_', DIRECTORY_SEPARATOR, $matches[2]) . '.php'
));
$filePath = str_replace('Ylab\Ddata' . DIRECTORY_SEPARATOR, '', $filePath);
$filePath = preg_replace('#Ylab/\Ddata\/#', '', $filePath);
$filePath = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $filePath);
if (is_readable($filePath) && is_file($filePath)) {
/** @noinspection PhpIncludeInspection */
require_once $filePath;
}
});
$arJsLibs = [
'WindowEntityPrepareForm' => [
'js' => '/bitrix/themes/ylab.ddata/js/WindowEntityPrepareForm.js',
'lang' => '/bitrix/themes/ylab.ddata/lang/' . LANGUAGE_ID . '/WindowEntityPrepareForm.php',
'rel' => ['ajax', 'window']
],
'WindowEntityDataForm' => [
'js' => '/bitrix/themes/ylab.ddata/js/WindowEntityDataForm.js',
'lang' => '/bitrix/themes/ylab.ddata/lang/' . LANGUAGE_ID . '/WindowEntityDataForm.php',
'rel' => ['ajax', 'window']
],
'WindowEntityProfileGen' => [
'js' => '/bitrix/themes/ylab.ddata/js/WindowEntityProfileGen.js',
'lang' => '/bitrix/themes/ylab.ddata/lang/' . LANGUAGE_ID . '/WindowEntityProfileGen.php',
'rel' => ['ajax', 'window']
]
];
foreach ($arJsLibs as $jsLib => $arJsLib) {
CJSCore::RegisterExt($jsLib, $arJsLib);
}