-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathextend.php
63 lines (55 loc) · 1.66 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
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
use Flarum\Extend;
use Flarum\Http\Middleware as HttpMiddleware;
use Flarum\User\Event\Saving;
use Flarum\User\Search\UserSearcher;
use Illuminate\Contracts\Events\Dispatcher;
use AlexanderOMara\FlarumWPUsers\Core;
use AlexanderOMara\FlarumWPUsers\Extenders;
use AlexanderOMara\FlarumWPUsers\Events;
use AlexanderOMara\FlarumWPUsers\Listener;
use AlexanderOMara\FlarumWPUsers\Middleware;
use AlexanderOMara\FlarumWPUsers\DisplayName;
use AlexanderOMara\FlarumWPUsers\Provider;
return [
// Register core class as a service (a singleton).
(new Extend\ServiceProvider())
->register(Provider\CoreProvider::class),
// Client-side code.
(new Extend\Frontend('forum'))
->js(__DIR__ . '/js/dist/forum.js')
->content(Listener\AddData::class),
(new Extend\Frontend('admin'))
->js(__DIR__ . '/js/dist/admin.js')
->content(Listener\AddData::class),
// Middleware.
(new Extend\Middleware('forum'))
->insertAfter(
HttpMiddleware\AuthenticateWithSession::class,
Middleware\Authenticate::class
),
(new Extend\Middleware('admin'))
->insertAfter(
HttpMiddleware\AuthenticateWithSession::class,
Middleware\Authenticate::class
),
(new Extend\Middleware('api'))
->insertAfter(
HttpMiddleware\AuthenticateWithHeader::class,
Middleware\Authenticate::class
),
// Events.
(new Extend\Event())
->listen(Saving::class, Events\UserSaving::class),
// Extenders.
new Extenders\RoutesApi(),
new Extenders\RoutesForum(),
// Display name.
(new Extend\User())
->displayNameDriver(
Core::DISPLAY_NAME_DRIVER,
DisplayName\Driver::class
),
(new Extend\SimpleFlarumSearch(UserSearcher::class))
->setFullTextGambit(DisplayName\FullTextGambit::class)
];