]> BookStack Code Mirror - bookstack/blob - app/Theming/ThemeEvents.php
56e1fba1ccd70f4a3342047f6d20ec13d6f4822b
[bookstack] / app / Theming / ThemeEvents.php
1 <?php namespace BookStack\Theming;
2
3 /**
4  * The ThemeEvents used within BookStack.
5  *
6  * This file details the events that BookStack may fire via the custom
7  * theme system, including event names, parameters and expected return types.
8  *
9  * This system is regarded as semi-stable.
10  * We'll look to fix issues with it or migrate old event types but
11  * events and their signatures may change in new versions of BookStack.
12  * We'd advise testing any usage of these events upon upgrade.
13  */
14 class ThemeEvents
15 {
16     /**
17      * Application boot-up.
18      * After main services are registered.
19      * @param \BookStack\Application $app
20      */
21     const APP_BOOT = 'app_boot';
22
23     /**
24      * Web before middleware action.
25      * Runs before the request is handled but after all other middleware apart from those
26      * that depend on the current session user (Localization for example).
27      * Provides the original request to use.
28      * Return values, if provided, will be used as a new response to use.
29      * @param \Illuminate\Http\Request $request
30      * @returns \Illuminate\Http\Response|null
31      */
32     const WEB_MIDDLEWARE_BEFORE = 'web_middleware_before';
33
34     /**
35      * Web after middleware action.
36      * Runs after the request is handled but before the response is sent.
37      * Provides both the original request and the currently resolved response.
38      * Return values, if provided, will be used as a new response to use.
39      * @param \Illuminate\Http\Request $request
40      * @returns \Illuminate\Http\Response|null
41      */
42     const WEB_MIDDLEWARE_AFTER = 'web_middleware_after';
43
44     /**
45      * Auth login event.
46      * Runs right after a user is logged-in to the application by any authentication
47      * system as a standard app user. This includes a user becoming logged in
48      * after registration. This is not emitted upon API usage.
49      * @param string $authSystem
50      * @param \BookStack\Auth\User $user
51      */
52     const AUTH_LOGIN = 'auth_login';
53
54     /**
55      * Auth register event.
56      * Runs right after a user is newly registered to the application by any authentication
57      * system as a standard app user. This includes auto-registration systems used
58      * by LDAP, SAML and social systems. It only includes self-registrations.
59      * @param string $authSystem
60      * @param \BookStack\Auth\User $user
61      */
62     const AUTH_REGISTER = 'auth_register';
63
64     /**
65      * Commonmark environment configure.
66      * Provides the commonmark library environment for customization
67      * before its used to render markdown content.
68      * If the listener returns a non-null value, that will be used as an environment instead.
69      * @param \League\CommonMark\ConfigurableEnvironmentInterface $environment
70      * @returns \League\CommonMark\ConfigurableEnvironmentInterface|null
71      */
72     const COMMONMARK_ENVIRONMENT_CONFIGURE = 'commonmark_environment_configure';
73 }