Добавляем все файлы
This commit is contained in:
40
main_plugin/form_editor/plug.php
Executable file
40
main_plugin/form_editor/plug.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @file plug.php
|
||||
* @brief Подключает плагин form_editor для администраторов, подставляет языковые строки и выводит HTML-код редактора форм
|
||||
*/
|
||||
|
||||
global $path, $_SESSION, $configAdmins;
|
||||
|
||||
/** @brief Языковой массив для плагина form_editor */
|
||||
$lang = include $path . 'main_plugin/form_editor/lang.php';
|
||||
|
||||
/** @brief Текущий язык пользователя, по умолчанию 'en' */
|
||||
$lng = $_SESSION['lng'] ?? 'en';
|
||||
|
||||
if (in_array($_SESSION['username'], $configAdmins, true)) {
|
||||
|
||||
$Html = file_get_contents($path . 'main_plugin/form_editor/form_editor.php');
|
||||
foreach ($lang[$lng] as $key => $value) {
|
||||
$Html = str_replace('{{' . $key . '}}', $value, $Html);
|
||||
}
|
||||
|
||||
echo $Html;
|
||||
|
||||
echo "<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const c = document.querySelector('.center-float');
|
||||
const d = document.getElementById('formEditor');
|
||||
if (c && d) {
|
||||
c.appendChild(document.createElement('br'));
|
||||
c.appendChild(d);
|
||||
} else if (d) {
|
||||
d.remove();
|
||||
}
|
||||
});
|
||||
</script>";
|
||||
|
||||
echo '<link rel="stylesheet" type="text/css" href="/main_plugin/form_editor/form_editor.css">';
|
||||
echo '<script type="text/javascript" src="/main_plugin/form_editor/lang.js.php?lng=' . $lng . '"></script>';
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user