-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
extend.php
50 lines (40 loc) · 1.39 KB
/
extend.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
<?php
/*
* This file is part of fof/filter.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FoF\Filter;
use Flarum\Extend;
use Flarum\Post\Event\Posted;
use Flarum\Post\Event\Saving as PostSaving;
use Flarum\Post\Post;
use Flarum\Settings\Event\Saving as SettingSaving;
use FoF\Filter\Listener\AddCensorChecks;
use FoF\Filter\Listener\AutoMerge;
use FoF\Filter\Listener\CheckPost;
return [
(new Extend\Frontend('admin'))
->css(__DIR__.'/resources/less/admin/admin.less')
->js(__DIR__.'/js/dist/admin.js'),
(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js'),
new Extend\Locales(__DIR__.'/resources/locale'),
(new Extend\View())
->namespace('fof-filter', __DIR__.'/views'),
(new Extend\Model(Post::class))
->cast('auto_mod', 'bool')
->cast('emailed', 'bool'),
(new Extend\Event())
->listen(SettingSaving::class, AddCensorChecks::class)
->listen(PostSaving::class, CheckPost::class)
->listen(Posted::class, AutoMerge::class),
(new Extend\Settings())
->default('fof-filter.autoDeletePosts', false)
->default('fof-filter.autoMergePosts', false)
->default('fof-filter.cooldown', 15)
->default('fof-filter.emailWhenFlagged', false),
];