This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.php
54 lines (36 loc) · 1.62 KB
/
index.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
<?php
use Symfony\Component\HttpFoundation\Response;
return [
'name' => 'tinymce',
'events' => [
'view.scripts' => function ($event, $scripts) use ($app) {
$scripts->register('tinymce-script', 'tinymce:app/bundle/tinymce.js', ['~editor']);
$scripts->register('tinymce-data', sprintf('var $tinymce = %s;', json_encode([
'root_url' => $app['url']->getStatic(__DIR__),
'skin_url' => $app['url']->getStatic(__DIR__ . '/app/assets/skin'),
'language_url' => $app['url']('@tinymce/intl', ['locale' => $app->module('system/intl')->getLocale()]),
'content_css' => $app['url']->getStatic($app['theme']->path . '/css/theme.css')
])
), ['~tinymce-script'], 'string');
},
],
'routes' => [
'tinymce/{locale}.js' => [
'name' => '@tinymce/intl',
'controller' => function ($locale) use ($app) {
$langFile = '';
foreach (glob(__DIR__ . '/languages/*.js') as $file) {
$candidate = substr(basename($file), 0, -3);
if ($candidate === $locale) {
$langFile = $file;
break;
}
if (strpos($locale, $candidate) === 0 || strpos($candidate, $locale) === 0) {
$langFile = $file;
}
}
return new Response($langFile ? file_get_contents($langFile) : '', 200, ['Content-Type' => 'application/javascript']);
}
]
]
];