analytics-page.php
Analytics dashboard — the tabbed "Statistik" submenu page.
Table of Contents
Functions
- creationell_captcha_register_analytics_page() : void
- Registers the "Statistik" submenu page under the CreaCaptcha menu.
- creationell_captcha_analytics_labels() : array<string, string>
- Human-readable labels for the seven event types.
-
creationell_captcha_analytics_groups()
: array<int, array{title: string, description: string, types: array
}> - Thematic groups for the overview tab: title, explanation and the member event types with their short in-group labels.
- creationell_captcha_analytics_tabs() : array<string, string>
- The three tabs of the analytics page.
- creationell_captcha_sum_recent_days() : array<string, int>
- Sums the $days most recent day buckets, per event type.
- creationell_captcha_sum_recent_hours() : array<string, int>
- Sums the $hours most recent hour buckets, per event type.
- creationell_captcha_render_analytics_page() : void
- Renders the tabbed analytics dashboard page.
- creationell_captcha_render_analytics_overview() : void
- Renders the "Übersicht" tab: four 24-hour KPI tiles and one four-window comparison table per thematic group.
- creationell_captcha_render_analytics_history() : void
- Renders the "Verlauf" tab: the day-by-day table for the last 30 days.
- creationell_captcha_events_query_args() : array{search: string, event_type: string, date_from: string, date_to: string}
- Reads and sanitises the event-log filter from the request.
- creationell_captcha_render_analytics_events() : void
- Renders the "Ereignisse" tab: filter toolbar, the event table with a detail link per row, the embedded event data and the detail modal.
- creationell_captcha_render_event_modal() : void
- Renders the (initially hidden) event-detail modal skeleton.
- creationell_captcha_render_events_toolbar() : void
- Renders the event-log filter toolbar: search, type filter, date range, the "Filtern"/"Zurücksetzen" controls and the CSV export link.
- creationell_captcha_render_events_pagination() : void
- Renders the pagination navigation below the event-log table.
Functions
creationell_captcha_register_analytics_page()
Registers the "Statistik" submenu page under the CreaCaptcha menu.
creationell_captcha_register_analytics_page() : void
creationell_captcha_analytics_labels()
Human-readable labels for the seven event types.
creationell_captcha_analytics_labels() : array<string, string>
Return values
array<string, string>creationell_captcha_analytics_groups()
Thematic groups for the overview tab: title, explanation and the member event types with their short in-group labels.
creationell_captcha_analytics_groups() : array<int, array{title: string, description: string, types: array}>
Together the groups cover all seven event types exactly once. The long labels from creationell_captcha_analytics_labels() stay untouched for the filter dropdown, CSV export, CLI and history tab.
Return values
array<int, array{title: string, description: string, types: arraycreationell_captcha_analytics_tabs()
The three tabs of the analytics page.
creationell_captcha_analytics_tabs() : array<string, string>
Return values
array<string, string> —Tab id => visible label.
creationell_captcha_sum_recent_days()
Sums the $days most recent day buckets, per event type.
creationell_captcha_sum_recent_days(array<string, array<string, int>> $daily, int $days) : array<string, int>
Iterates today plus the ($days - 1) preceding days — the same window the 30-day history table walks.
Parameters
- $daily : array<string, array<string, int>>
-
Daily counters keyed by 'Y-m-d'.
- $days : int
-
Number of day buckets to sum.
Return values
array<string, int> —Event type => sum.
creationell_captcha_sum_recent_hours()
Sums the $hours most recent hour buckets, per event type.
creationell_captcha_sum_recent_hours(array<string, array<string, int>> $hourly, int $hours) : array<string, int>
Iterates the current hour plus the ($hours - 1) preceding hours.
Parameters
- $hourly : array<string, array<string, int>>
-
Hourly counters keyed by 'Y-m-d H'.
- $hours : int
-
Number of hour buckets to sum.
Return values
array<string, int> —Event type => sum.
creationell_captcha_render_analytics_page()
Renders the tabbed analytics dashboard page.
creationell_captcha_render_analytics_page() : void
creationell_captcha_render_analytics_overview()
Renders the "Übersicht" tab: four 24-hour KPI tiles and one four-window comparison table per thematic group.
creationell_captcha_render_analytics_overview() : void
creationell_captcha_render_analytics_history()
Renders the "Verlauf" tab: the day-by-day table for the last 30 days.
creationell_captcha_render_analytics_history() : void
creationell_captcha_events_query_args()
Reads and sanitises the event-log filter from the request.
creationell_captcha_events_query_args() : array{search: string, event_type: string, date_from: string, date_to: string}
Used by the "Ereignisse" tab and by the CSV export handler. The values only narrow a read-only query and are bound via $wpdb->prepare downstream, so no nonce check is required here; the page number is read separately by the tab.
Return values
array{search: string, event_type: string, date_from: string, date_to: string}creationell_captcha_render_analytics_events()
Renders the "Ereignisse" tab: filter toolbar, the event table with a detail link per row, the embedded event data and the detail modal.
creationell_captcha_render_analytics_events() : void
creationell_captcha_render_event_modal()
Renders the (initially hidden) event-detail modal skeleton.
creationell_captcha_render_event_modal() : void
The value cells carry a data-field matching the event record key; the modal
JavaScript fills them client-side from the embedded JSON map.
creationell_captcha_render_events_toolbar()
Renders the event-log filter toolbar: search, type filter, date range, the "Filtern"/"Zurücksetzen" controls and the CSV export link.
creationell_captcha_render_events_toolbar(array{search: string, event_type: string, date_from: string, date_to: string} $filter) : void
Parameters
- $filter : array{search: string, event_type: string, date_from: string, date_to: string}
-
Active filter.
creationell_captcha_render_events_pagination()
Renders the pagination navigation below the event-log table.
creationell_captcha_render_events_pagination(array{search: string, event_type: string, date_from: string, date_to: string} $filter, int $paged, int $total_pages) : void
Parameters
- $filter : array{search: string, event_type: string, date_from: string, date_to: string}
-
Active filter.
- $paged : int
-
Current page (1-based).
- $total_pages : int
-
Total page count.