forked from FriendsOfREDAXO/tinymce4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.php
52 lines (47 loc) · 2.19 KB
/
boot.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
45
46
47
48
49
50
51
52
<?php
if (rex::isBackend() && isset($_REQUEST['page']) && !isset($_REQUEST['_pjax'])) {
if (defined('rex_view::JS_IMMUTABLE')) {
// R5.7+ support
// disable asset-streaming, because tiny will load plugins after the main file which wouldn't work
rex_view::addJsFile(rex_url::addonAssets('tinymce4', 'tinymce/tinymce.min.js'), [rex_view::JS_IMMUTABLE => false]);
} else {
rex_view::addJsFile(rex_url::addonAssets('tinymce4', 'tinymce/tinymce.min.js'));
}
// css klappt noch nicht im Moment, weil Dialog und
// Filemanager die gleichen Klassen verwenden, das Innere des Dialogs aber
// nicht responsive ist.
//rex_view::addCssFile(rex_url::addonAssets('tinymce4', 'backend.css'));
$user = \rex::getUser();
if ($user) {
$lang = $user->getLanguage();
if ('' == $lang) {
$lang = strtolower($dbconfig = \rex::getProperty('lang'));
}
$service_container = Tinymce4\Services\ServiceContainer::getInstance();
$map = $service_container->getParameter('be_lang_map');
if (!isset($map[$lang])) {
$lang_pack = 'en_US';
} else {
$lang_pack = $map[$lang];
}
// Tinymce Übersetzungen laden
rex_view::addJsFile(rex_url::addonAssets('tinymce4', 'tinymce/langs/'.$lang_pack.'.js'));
// Tinymce init script
rex_view::addJsFile(rex_url::addonAssets('tinymce4', 'tinymce4_init.'.$lang_pack.'.js'));
// Wenn Tinymce neu installiert wurde, gibt es die Datei noch nicht
$filename = \rex_path::addonAssets('tinymce4', 'tinymce4_init.'.$lang_pack.'.js');
$modTime = (int) \rex_config::get('tinymce4', 'profile_upd_date', 1);
if ($modTime >= (int) @filemtime($filename)) {
$service_container->get('ProfileRepository')->rebuildInitScripts();
}
}
}
if (isset($_REQUEST['tinymce4_call'])) {
rex_extension::register('PACKAGES_INCLUDED', function($ep) {
if (isset($_REQUEST['tinymce4_call'])) {
$service_container = Tinymce4\Services\ServiceContainer::getInstance();
echo $service_container->handleRoute($_REQUEST['tinymce4_call']);
die();
}
});
}