-
Notifications
You must be signed in to change notification settings - Fork 2
/
bootstrap.php
44 lines (39 loc) · 1.35 KB
/
bootstrap.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
<?php
namespace WiseClock\Login2See;
use DirectoryIterator;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\Event\ConfigureClientView;
use Flarum\Event\ConfigureLocales;
return function (Dispatcher $events)
{
$events->subscribe(Listeners\LoadSettingsFromDatabase::class);
$events->listen(ConfigureLocales::class, function (ConfigureLocales $event)
{
foreach (new DirectoryIterator(__DIR__ . '/locale') as $file)
{
if ($file->isFile() && in_array($file->getExtension(), ['yml', 'yaml']))
{
$event->locales->addTranslations($file->getBasename('.' . $file->getExtension()), $file->getPathname());
}
}
});
$events->listen(ConfigureClientView::class, function (ConfigureClientView $event)
{
if ($event->isForum())
{
$event->addAssets([
__DIR__.'/js/forum/dist/extension.js',
__DIR__.'/less/login2see.less',
]);
$event->addBootstrapper('wiseclock/flarum-ext-login2see/main');
}
else if ($event->isAdmin())
{
$event->addAssets([
__DIR__.'/js/admin/dist/extension.js',
__DIR__.'/less/login2see-settings.less',
]);
$event->addBootstrapper('wiseclock/flarum-ext-login2see/main');
}
});
};