-
Notifications
You must be signed in to change notification settings - Fork 5
/
boot.php
70 lines (56 loc) · 2.64 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* This file is part of the redactor package.
*
* @author (c) Friends Of REDAXO
* @author <friendsof@redaxo.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/** @var rex_addon $this */
$addon = rex_addon::get('redactor');
if (rex::isBackend() && rex::getUser()) {
rex_extension::register('PACKAGES_INCLUDED', function() use ($addon) {
if ($this->getProperty('compile')) {
$compiler = new rex_scss_compiler();
$compiler->setRootDir($this->getPath('scss/'));
$compiler->setScssFile($this->getPath('scss/redactor.scss'));
$compiler->setCssFile($this->getPath('assets/redactor.css'));
$compiler->compile();
rex_dir::copy($this->getPath('assets'), $this->getAssetsPath()); // copy whole assets directory
}
$userLang = rex::getUser()->getLanguage();
if ('' === trim($userLang)) {
$userLang = rex::getProperty('lang');
}
$cacheFile = $addon->getCachePath('profiles.js');
if (!file_exists($cacheFile)) {
Redactor::createProfileFiles();
}
$cacheFile = $addon->getCachePath('plugins.'.$userLang.'.js');
if (!file_exists($cacheFile)) {
Redactor::createPluginFile();
}
rex_view::addCssFile($addon->getAssetsUrl('vendor/redactor/redactor.css'));
rex_view::addCssFile($addon->getAssetsUrl('redactor.css'));
rex_view::addJsFile($addon->getAssetsUrl('vendor/redactor/redactor.js'));
rex_view::addJsFile($addon->getAssetsUrl('vendor/redactor/langs/'.substr($userLang, 0, 2).'.js'));
rex_view::addJsFile($addon->getAssetsUrl('cache/plugins.'.$userLang.'.js'));
rex_view::addJsFile($addon->getAssetsUrl('cache/profiles.js'));
rex_view::addJsFile($addon->getAssetsUrl('redactor.js'));
rex_view::setJsProperty('redactor_rex_clang_getCurrentId', rex_clang::getCurrentId());
rex_view::setJsProperty('redactor_rex_url_media', '/media/');
if (rex_addon::get('mediapool')->isAvailable()) {
rex_view::setJsProperty('redactor_rex_media_getImageTypes', rex_media::getImageTypes());
}
$imageUrlPath = rex_url::media();
if (rex_addon::get('media_manager')->isAvailable()) {
$imageUrlPath = 'index.php?rex_media_type=redactorImage&rex_media_file=';
if (rex_addon::get('yrewrite')->isAvailable()) {
$imageUrlPath = '/media/redactorImage/';
}
}
rex_view::setJsProperty('redactor_imageUrlPath', $imageUrlPath);
}, rex_extension::LATE);
}