]> BookStack Code Mirror - bookstack/blobdiff - app/Theming/ThemeEvents.php
Guest create page: name field autofocus
[bookstack] / app / Theming / ThemeEvents.php
index 48073416ca6d72661685cae210623e0ea5faf53b..0a8efaee4c75093f1f63b301e1d6cd2201b03215 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace BookStack\Theming;
 
+use BookStack\Entities\Models\Page;
+
 /**
  * The ThemeEvents used within BookStack.
  *
@@ -16,36 +18,25 @@ namespace BookStack\Theming;
 class ThemeEvents
 {
     /**
-     * Application boot-up.
-     * After main services are registered.
-     *
-     * @param \BookStack\Application $app
-     */
-    const APP_BOOT = 'app_boot';
-
-    /**
-     * Web before middleware action.
-     * Runs before the request is handled but after all other middleware apart from those
-     * that depend on the current session user (Localization for example).
-     * Provides the original request to use.
-     * Return values, if provided, will be used as a new response to use.
+     * Activity logged event.
+     * Runs right after an activity is logged by bookstack.
+     * These are the activities that can be seen in the audit log area of BookStack.
+     * Activity types can be seen listed in the \BookStack\Actions\ActivityType class.
+     * The provided $detail can be a string or a loggable type of model. You should check
+     * the type before making use of this parameter.
      *
-     * @param \Illuminate\Http\Request $request
-     * @returns \Illuminate\Http\Response|null
+     * @param string                                $type
+     * @param string|\BookStack\Interfaces\Loggable $detail
      */
-    const WEB_MIDDLEWARE_BEFORE = 'web_middleware_before';
+    const ACTIVITY_LOGGED = 'activity_logged';
 
     /**
-     * Web after middleware action.
-     * Runs after the request is handled but before the response is sent.
-     * Provides both the original request and the currently resolved response.
-     * Return values, if provided, will be used as a new response to use.
+     * Application boot-up.
+     * After main services are registered.
      *
-     * @param \Illuminate\Http\Request                                                      $request
-     * @param \Illuminate\Http\Response|Symfony\Component\HttpFoundation\BinaryFileResponse $response
-     * @returns \Illuminate\Http\Response|null
+     * @param \BookStack\Application $app
      */
-    const WEB_MIDDLEWARE_AFTER = 'web_middleware_after';
+    const APP_BOOT = 'app_boot';
 
     /**
      * Auth login event.
@@ -71,8 +62,7 @@ class ThemeEvents
 
     /**
      * Commonmark environment configure.
-     * Provides the commonmark library environment for customization
-     * before its used to render markdown content.
+     * Provides the commonmark library environment for customization before it's used to render markdown content.
      * If the listener returns a non-null value, that will be used as an environment instead.
      *
      * @param \League\CommonMark\ConfigurableEnvironmentInterface $environment
@@ -80,6 +70,45 @@ class ThemeEvents
      */
     const COMMONMARK_ENVIRONMENT_CONFIGURE = 'commonmark_environment_configure';
 
+    /**
+     * Page include parse event.
+     * Runs when a page include tag is being parsed, typically when page content is being processed for viewing.
+     * Provides the "include tag" reference string, the default BookStack replacement content for the tag,
+     * the current page being processed, and the page that's being referenced by the include tag.
+     * The referenced page may be null where the page does not exist or where permissions prevent visibility.
+     * If the listener returns a non-null value, that will be used as the replacement HTML content instead.
+     *
+     * @param string $tagReference
+     * @param string $replacementHTML
+     * @param Page   $currentPage
+     * @param ?Page  $referencedPage
+     */
+    const PAGE_INCLUDE_PARSE = 'page_include_parse';
+
+    /**
+     * Web before middleware action.
+     * Runs before the request is handled but after all other middleware apart from those
+     * that depend on the current session user (Localization for example).
+     * Provides the original request to use.
+     * Return values, if provided, will be used as a new response to use.
+     *
+     * @param \Illuminate\Http\Request $request
+     * @returns \Illuminate\Http\Response|null
+     */
+    const WEB_MIDDLEWARE_BEFORE = 'web_middleware_before';
+
+    /**
+     * Web after middleware action.
+     * Runs after the request is handled but before the response is sent.
+     * Provides both the original request and the currently resolved response.
+     * Return values, if provided, will be used as a new response to use.
+     *
+     * @param \Illuminate\Http\Request                                                       $request
+     * @param \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\BinaryFileResponse $response
+     * @returns \Illuminate\Http\Response|null
+     */
+    const WEB_MIDDLEWARE_AFTER = 'web_middleware_after';
+
     /**
      * Webhook call before event.
      * Runs before a webhook endpoint is called. Allows for customization
@@ -93,6 +122,8 @@ class ThemeEvents
      * @param string                                $event
      * @param \BookStack\Actions\Webhook            $webhook
      * @param string|\BookStack\Interfaces\Loggable $detail
+     * @param \BookStack\Auth\User                  $initiator
+     * @param int                                   $initiatedTime
      */
     const WEBHOOK_CALL_BEFORE = 'webhook_call_before';
 }