1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
code_editor.php
См. документацию.
1
<?
2
IncludeModuleLangFile
(__FILE__);
3
class
CCodeEditor
// CE
4
{
5
public
static
function
Show
(
$params
)
6
{
7
global
$APPLICATION
,
$USER
;
8
CUtil::InitJSCore(
array
(
'window'
,
'ajax'
));
9
10
$APPLICATION
->AddHeadScript(
'/bitrix/js/fileman/code_editor/code-editor.js'
);
11
$APPLICATION
->SetAdditionalCSS(
'/bitrix/js/fileman/code_editor/code-editor.css'
);
12
13
$id = (isset(
$params
[
'id'
]) &&
$params
[
'id'
] <>
''
) ?
$params
[
'id'
] :
'bxce-'
.mb_substr(uniqid(mt_rand(),
true
), 0, 4);
14
$theme = isset(
$params
[
'defaultTheme'
]) ?
$params
[
'defaultTheme'
] :
'light'
;
15
$highlight = isset(
$params
[
'defaultHighlight'
]) ?
$params
[
'defaultHighlight'
] :
true
;
16
$saveSettings = (
$params
[
'saveSettings'
] ??
null
) !==
false
&&
$USER
&&
$USER
->IsAuthorized();
17
18
if
($saveSettings)
19
{
20
$Settings = CUserOptions::GetOption(
"fileman"
,
"code_editor"
);
21
$theme = ($Settings[
'theme'
] ??
null
) ==
'dark'
?
'dark'
:
'light'
;
22
$highlight = !isset($Settings[
'highlight'
]) || $Settings[
'highlight'
];
23
}
24
25
if
(!in_array($theme,
array
(
'dark'
,
'light'
)))
26
$theme =
'dark'
;
27
$highlight = $highlight ===
false
?
false
:
true
;
28
29
$JSConfig =
array
(
30
'id'
=> $id,
31
'textareaId'
=>
$params
[
'textareaId'
],
32
'theme'
=> $theme,
33
'highlightMode'
=> $highlight,
34
'saveSettings'
=> $saveSettings
35
);
36
37
if
(isset(
$params
[
'width'
]) && intval(
$params
[
'width'
]) > 0)
38
$JSConfig[
'width'
] =
$params
[
'width'
];
39
if
(isset(
$params
[
'height'
]) && intval(
$params
[
'height'
]) > 0)
40
$JSConfig[
'height'
] =
$params
[
'height'
];
41
42
if
(isset(
$params
[
'forceSyntax'
]) && in_array(
$params
[
'forceSyntax'
],
array
(
'php'
,
'js'
,
'sql'
,
'css'
)))
43
$JSConfig[
'forceSyntax'
] =
$params
[
'forceSyntax'
];
44
else
45
$JSConfig[
'forceSyntax'
] =
false
;
46
?>
47
<script>
48
49
BX.ready(
function
()
50
{
51
if
(!
top
.BXCodeEditors)
52
top
.BXCodeEditors = window.BXCodeEditors = {};
53
54
function
codeEditorLoaded()
55
{
56
var CE =
new
window.JCCodeEditor(<?= CUtil::PhpToJSObject($JSConfig)?>, <?= self::GetLangMessage()?>);
57
top
.BXCodeEditors[
'<?= $id?>'
] = window.BXCodeEditors[
'<?= $id?>'
] = CE;
58
BX.onCustomEvent(window,
"OnCodeEditorReady"
, [
'<?= $id?>'
]);
59
}
60
61
if
(!window.JCCodeEditor)
62
{
63
BX.loadScript(
'/bitrix/js/fileman/code_editor/code-editor.js?<?= @filemtime($_SERVER['
DOCUMENT_ROOT
'].'
/bitrix/js/fileman/code_editor/code-editor.js
')?>'
, codeEditorLoaded);
64
BX.loadCSS(
'/bitrix/js/fileman/code_editor/code-editor.css'
);
65
}
66
else
67
{
68
codeEditorLoaded();
69
}
70
71
});
72
</script>
73
<?
74
return
$id;
75
}
76
77
public
static
function
GetLangMessage
()
78
{
79
/*
80
$langPath = $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/fileman/lang/'.LANGUAGE_ID.'/classes/general/code_editor_js.php';
81
if(file_exists($langPath))
82
include($langPath);
83
else
84
$langPath = $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/fileman/lang/en/classes/general/code_editor_js.php';
85
*/
86
$MESS
=
\Bitrix\Main\Localization\Loc::loadLanguageFile
(
$_SERVER
[
"DOCUMENT_ROOT"
].
'/bitrix/modules/fileman/classes/general/code_editor_js.php'
);
87
88
echo CUtil::PhpToJSObject(
$MESS
);
89
}
90
}
91
?>
$APPLICATION
global $APPLICATION
Определения
include.php:80
Bitrix\Main\Localization\Loc\loadLanguageFile
static loadLanguageFile($file, $language=null, $normalize=true)
Определения
loc.php:225
CCodeEditor
Определения
code_editor.php:4
CCodeEditor\Show
static Show($params)
Определения
code_editor.php:5
CCodeEditor\GetLangMessage
static GetLangMessage()
Определения
code_editor.php:77
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
top
bx_acc_lim_group_list limitGroupList[] multiple<?=$group[ 'ID']?> ID selected margin top
Определения
file_new.php:657
$MESS
global $MESS
Определения
bill.php:2
$_SERVER
$_SERVER["DOCUMENT_ROOT"]
Определения
cron_frame.php:9
$USER
global $USER
Определения
csv_new_run.php:40
IncludeModuleLangFile
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения
tools.php:3778
false
return false
Определения
prolog_main_admin.php:185
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
fileman
classes
general
code_editor.php
Создано системой
1.14.0