]> BookStack Code Mirror - bookstack/blob - app/Theming/ThemeEvents.php
Only output hidden user filters when not set to 'me'
[bookstack] / app / Theming / ThemeEvents.php
1 <?php
2
3 namespace BookStack\Theming;
4
5 use BookStack\Entities\Models\Page;
6
7 /**
8  * The ThemeEvents used within BookStack.
9  *
10  * This file details the events that BookStack may fire via the custom
11  * theme system, including event names, parameters and expected return types.
12  *
13  * This system is regarded as semi-stable.
14  * We'll look to fix issues with it or migrate old event types but
15  * events and their signatures may change in new versions of BookStack.
16  * We'd advise testing any usage of these events upon upgrade.
17  */
18 class ThemeEvents
19 {
20     /**
21      * Activity logged event.
22      * Runs right after an activity is logged by bookstack.
23      * These are the activities that can be seen in the audit log area of BookStack.
24      * Activity types can be seen listed in the \BookStack\Actions\ActivityType class.
25      * The provided $detail can be a string or a loggable type of model. You should check
26      * the type before making use of this parameter.
27      *
28      * @param string                                $type
29      * @param string|\BookStack\Interfaces\Loggable $detail
30      */
31     const ACTIVITY_LOGGED = 'activity_logged';
32
33     /**
34      * Application boot-up.
35      * After main services are registered.
36      *
37      * @param \BookStack\Application $app
38      */
39     const APP_BOOT = 'app_boot';
40
41     /**
42      * Auth login event.
43      * Runs right after a user is logged-in to the application by any authentication
44      * system as a standard app user. This includes a user becoming logged in
45      * after registration. This is not emitted upon API usage.
46      *
47      * @param string               $authSystem
48      * @param \BookStack\Auth\User $user
49      */
50     const AUTH_LOGIN = 'auth_login';
51
52     /**
53      * Auth register event.
54      * Runs right after a user is newly registered to the application by any authentication
55      * system as a standard app user. This includes auto-registration systems used
56      * by LDAP, SAML and social systems. It only includes self-registrations.
57      *
58      * @param string               $authSystem
59      * @param \BookStack\Auth\User $user
60      */
61     const AUTH_REGISTER = 'auth_register';
62
63     /**
64      * Commonmark environment configure.
65      * Provides the commonmark library environment for customization before it's used to render markdown content.
66      * If the listener returns a non-null value, that will be used as an environment instead.
67      *
68      * @param \League\CommonMark\ConfigurableEnvironmentInterface $environment
69      * @returns \League\CommonMark\ConfigurableEnvironmentInterface|null
70      */
71     const COMMONMARK_ENVIRONMENT_CONFIGURE = 'commonmark_environment_configure';
72
73     /**
74      * Page include parse event.
75      * Runs when a page include tag is being parsed, typically when page content is being processed for viewing.
76      * Provides the "include tag" reference string, the default BookStack replacement content for the tag,
77      * the current page being processed, and the page that's being referenced by the include tag.
78      * The referenced page may be null where the page does not exist or where permissions prevent visibility.
79      * If the listener returns a non-null value, that will be used as the replacement HTML content instead.
80      *
81      * @param string $tagReference
82      * @param string $replacementHTML
83      * @param Page   $currentPage
84      * @param ?Page  $referencedPage
85      */
86     const PAGE_INCLUDE_PARSE = 'page_include_parse';
87
88     /**
89      * Web before middleware action.
90      * Runs before the request is handled but after all other middleware apart from those
91      * that depend on the current session user (Localization for example).
92      * Provides the original request to use.
93      * Return values, if provided, will be used as a new response to use.
94      *
95      * @param \Illuminate\Http\Request $request
96      * @returns \Illuminate\Http\Response|null
97      */
98     const WEB_MIDDLEWARE_BEFORE = 'web_middleware_before';
99
100     /**
101      * Web after middleware action.
102      * Runs after the request is handled but before the response is sent.
103      * Provides both the original request and the currently resolved response.
104      * Return values, if provided, will be used as a new response to use.
105      *
106      * @param \Illuminate\Http\Request                                                       $request
107      * @param \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\BinaryFileResponse $response
108      * @returns \Illuminate\Http\Response|null
109      */
110     const WEB_MIDDLEWARE_AFTER = 'web_middleware_after';
111
112     /**
113      * Webhook call before event.
114      * Runs before a webhook endpoint is called. Allows for customization
115      * of the data format & content within the webhook POST request.
116      * Provides the original event name as a string (see \BookStack\Actions\ActivityType)
117      * along with the webhook instance along with the event detail which may be a
118      * "Loggable" model type or a string.
119      * If the listener returns a non-null value, that will be used as the POST data instead
120      * of the system default.
121      *
122      * @param string                                $event
123      * @param \BookStack\Actions\Webhook            $webhook
124      * @param string|\BookStack\Interfaces\Loggable $detail
125      * @param \BookStack\Auth\User                  $initiator
126      * @param int                                   $initiatedTime
127      */
128     const WEBHOOK_CALL_BEFORE = 'webhook_call_before';
129 }