Developers

Hooks

Actions

admira_before_init

Action fired before the plugin is initialized during the WordPress init hook.

admira_init

Action fired after the plugin is initialized during the WordPress init hook.

admira_loaded

Action fired when the plugin has been loaded, after adding the necessary actions/filters to WordPress hooks.

admira_proxy_response

Action fired when the admira API Proxy returns a non-local non-cached response. This action is fired after the response has been returned to the user, during the WordPress shutdown action.

The arguments are as follows:

  1. Array: An associative array containing the following keys:

    • method: (string) The HTTP method used for the request (e.g., 'GET', 'POST').
    • uri: (string) The URI of the request.
    • options: (array) Additional options or parameters for the request.
    • route: (string) The matched route for the request.
    • route_regex: (string) The regular expression pattern used to match the route.
    • cart_modified: (?string) Indicates the cart that was modified during the request. Null if no cart modified.
  2. $response: (mixed) The response generated by the API router and sent to the client.

admira_reserved_route

Action fired before a reserved route page template is loaded during the WordPress filter template_include.

One use case for this hook is to add custom styles as seen in TODO: Design link.

The arguments are as follows:

  1. Array: An associative array of the route data containing the following keys:
    1. path: (string) The path of the reserved route.
    2. template: (string) The template path for the reserved route.
    3. post_title: (string) The title of the reserved route.

admira_before_tickets_template

Action fired in the Tickets reserved route page template, before the main HTML Tickets element is added to the HTML. Allows for extra content before the main Tickets element.

The arguments are as follows:

  1. Boolean: Whether the ticket office is in maintenance mode.

admira_after_tickets_template

Action fired in the Tickets reserved route page template, after the main HTML Tickets element is added to the HTML. Allows for extra content after the main Tickets element.

The arguments are as follows:

  1. Boolean: Whether the ticket office is in maintenance mode.

admira_before_store_template

Action fired in the Store reserved route page template, before the main HTML Store element is added to the HTML. Allows for extra content before the main Store element.

The arguments are as follows:

  1. Boolean: Whether the store is in maintenance mode.

admira_after_store_template

Action fired in the Store reserved route page template, after the main HTML Store element is added to the HTML. Allows for extra content after the main Store element.

The arguments are as follows:

  1. Boolean: Whether the store is in maintenance mode.

Filters

admira_init_priority

Filters the priority of admira's hook into init to initialize the plugin.

The arguments are as follows:

  1. Integer: Priority of the admira init.

admira_cart_max_refresh_time

Filters the refresh time window that an admira cart needs to refreshed for the cart not to expire.

The arguments are as follows:

  1. String: English textual datetime description accepted by PHP's strtotime. Example: '5 minutes'.

admira_cart_max_alive_time

Filters the maximum time an admira cart can be kept alive for.

The arguments are as follows:

  1. String: English textual datetime description accepted by PHP's strtotime. Example: '40 minutes'.

admira_cart_cleanup_time

Filters the time an expired cart will be kept in the database before being removed via the cart cleanup cron.

The arguments are as follows:

  1. String: English textual datetime description accepted by PHP's strtotime. Example: '7 days'.

admira_config_{key}

Filters the value returned from the plugin's configuration file for a given key.

The arguments are as follows:

  1. Mixed: Value in the configuration for the given key.

admira_proxy_permissions_{route}

Filters whether a given api proxy route request has the permission to be handled by the router, with the specific route in the filter name.

The arguments are as follows:

  1. Boolean: Permission granted to handle request.
  2. WP_REST_Request: WordPress request object received for the route.

admira_proxy_permissions

Filters whether a given api proxy route request has the permission to be handled by the router.

The arguments are as follows:

  1. Boolean: Permission granted to handle request.
  2. String: Route of the request.
  3. WP_REST_Request: WordPress request object received for the route.

admira_proxy_local_response

Filters the local response for an api proxy route request. The local response is checked before the cached responses and the admira API calls. Useful for returning responses that are not cached but are made with local information, like our local Carts system.

The arguments are as follows:

  1. Null|WP_REST_Response|mixed: Value to returns as response. Null means no local response will be returned. A WP_REST_Response will be returned as is. Any other value will be put inside the body of a new WP_REST_Response with status 200.
  2. Array: An associative array with proxy route request data containing the following keys:
    • method: (string) The HTTP method used for the request (e.g., 'GET', 'POST').
    • route: (string) The matched route for the request.
  3. WP_REST_Request: WordPress request object received for the route.

admira_proxy_routes

Filters what admira routes are available to the proxy api.

The arguments are as follows:

  1. Array: An associative array containing the routes. Each key is the route regex and the value is an array of internal configurations with the following entries:
    1. Array: An array containing the allowed methods for the route (e.g. GET, POST, etc).
    2. Null|Integer: Cache time in seconds. Null means the route is not cached.
    3. Null|Integer: Index of the matched route regex that contains a cart that is being modified. Used by our internal local Carts system to invalidate modified Carts.

admira_reserved_route_matched

Filters what reserved route has been matched for the current url. Useful for internal use.

The arguments are as follows:

  1. False|Route: Reserved route matched. False means no route has been matched, otherwise a ReservedRoutes\Route object is expected.

admira_tickets_route_path

Filters the reserved route path for the tickets page.

The arguments are as follows:

  1. String: Tickets route path.

admira_tickets_template_path

Filters the template path for the tickets page.

The arguments are as follows:

  1. String: Template path. Root element is required in the path for the frontend application to work.

admira_store_route_path

Filters the reserved route path for the store page.

The arguments are as follows:

  1. String: Store route path.

admira_store_template_path

Filters the template path for the store page.

The arguments are as follows:

  1. String: Template path. Root element is required in the path for the frontend application to work.

admira_reserved_route_data

Filters the data for a reserved route.

The arguments are as follows:

  1. Array: An associative array with the data for the reserved route.
  2. String: Class of the reserved route.

Dynamic route filters

For the proxy API, via the class API/Filters, we run two filters with the following dynamic names:

  1. {filter_name}
  2. {filter_name}-{route}

The first value, the filtered value, is passed to the first filter and its returned value is then passed to the second filter.

We have the following filters that use this system:

admira_proxy_body

Filters the body of a proxy request before it is sent to admira.

Two filters are applied sequentially:

  1. admira_proxy_body - Generic filter for all routes.

    1. String: The body of the request.
    2. String: The route of the request.
    3. WP_REST_Request: WordPress request object received for the route.
  2. admira_proxy_body-{route} - Specific filter for the route.

    1. String: The body of the request.
    2. WP_REST_Request: WordPress request object received for the route.

admira_proxy_headers

Filters the headers of a proxy request before it is sent to admira.

Two filters are applied sequentially:

  1. admira_proxy_headers - Generic filter for all routes.

    1. Array: The headers of the request.
    2. String: The route of the request.
    3. WP_REST_Request: WordPress request object received for the route.
  2. admira_proxy_headers-{route} - Specific filter for the route.

    1. Array: The headers of the request.
    2. WP_REST_Request: WordPress request object received for the route.

admira_proxy_params

Filters the query parameters of a proxy request before it is sent to admira.

Two filters are applied sequentially:

  1. admira_proxy_params - Generic filter for all routes.

    1. Array: The query params of the request.
    2. String: The route of the request.
    3. WP_REST_Request: WordPress request object received for the route.
  2. admira_proxy_params-{route} - Specific filter for the route.

    1. Array: The query params of the request.
    2. WP_REST_Request: WordPress request object received for the route.

admira_proxy_prepare_response_body

Filters the body of the proxy response.

Two filters are applied sequentially:

  1. admira_proxy_prepare_response_body - Generic filter for all routes.

    1. String: The body of the request.
    2. String: The route of the request.
    3. ResponseInterface: The Guzzle response from admira.
    4. WP_REST_Request: WordPress request object received for the route.
  2. admira_proxy_prepare_response_body-{route} - Specific filter for the route.

    1. String: The body of the request.
    2. ResponseInterface: The Guzzle response from admira.
    3. WP_REST_Request: WordPress request object received for the route.

admira_proxy_prepare_response_headers

Filters the headers of the proxy response.

Two filters are applied sequentially:

  1. admira_proxy_prepare_response_headers - Generic filter for all routes.

    1. Array: The headers of the request.
    2. String: The route of the request.
    3. ResponseInterface: The Guzzle response from admira.
    4. WP_REST_Request: WordPress request object received for the route.
  2. admira_proxy_prepare_response_headers-{route} - Specific filter for the route.

    1. Array: The headers of the request.
    2. ResponseInterface: The Guzzle response from admira.
    3. WP_REST_Request: WordPress request object received for the route.

admira_proxy_prepare_response

Filters the proxy response object (WP_REST_Response).

Two filters are applied sequentially:

  1. admira_proxy_prepare_response - Generic filter for all routes.

    1. WP_REST_Response: The WordPress Rest response object for the proxy response.
    2. String: The route of the request.
    3. WP_REST_Request: WordPress request object received for the route.
  2. admira_proxy_prepare_response-{route} - Specific filter for the route.

    1. WP_REST_Response: The WordPress Rest response object for the proxy response.
    2. WP_REST_Request: WordPress request object received for the route.
Previous
Texts and Translations