PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.86
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.86
51.1.86 51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 All 40 releases
← All changes | includes/extensions/Maintenance_Mode/templates/view-analytics.php +186 -15 51.1.44 → 51.1.86 View file →
@@ -7,8 +7,48 @@
7 7
8 8 if (!defined('ABSPATH')) {
9 9 exit;
10 10 }
11 +
12 +$overview = $this->get_analytics_overview();
13 +
14 +$reason_labels = [
15 + 'wp_admin' => __('WP Admin', 'king-addons'),
16 + 'admin_ajax_allowed' => __('Admin AJAX allowed', 'king-addons'),
17 + 'rest_logged_in' => __('REST (logged-in user)', 'king-addons'),
18 + 'rest_allowed' => __('REST allowed', 'king-addons'),
19 + 'login_page' => __('Login page', 'king-addons'),
20 + 'elementor_editor' => __('Elementor editor', 'king-addons'),
21 + 'user_allowed' => __('Allowed user/role', 'king-addons'),
22 + 'ip_whitelist' => __('IP whitelist', 'king-addons'),
23 + 'path_whitelist' => __('Path whitelist', 'king-addons'),
24 + 'cron' => __('WP-Cron', 'king-addons'),
25 + 'wp_cli' => __('WP-CLI', 'king-addons'),
26 +];
27 +
28 +$bypass_total = $overview['bypass_by_reason_total'] ?? [];
29 +if (!is_array($bypass_total)) {
30 + $bypass_total = [];
31 +}
32 +
33 +$bypass_24h = $overview['bypass_by_reason_24h'] ?? [];
34 +if (!is_array($bypass_24h)) {
35 + $bypass_24h = [];
36 +}
37 +
38 +$top_blocked_paths = $overview['top_paths_24h_blocked'] ?? [];
39 +if (!is_array($top_blocked_paths)) {
40 + $top_blocked_paths = [];
41 +}
42 +
43 +$top_bypass_paths = $overview['top_paths_24h_bypass'] ?? [];
44 +if (!is_array($top_bypass_paths)) {
45 + $top_bypass_paths = [];
46 +}
47 +
48 +$reset_url = wp_nonce_url(add_query_arg([
49 + 'action' => 'kng_maintenance_reset_analytics',
50 +], admin_url('admin-post.php')), 'kng_maintenance_reset_analytics');
11 51 ?>
12 52
13 53 <div class="ka-card">
14 54 <div class="ka-card-header">
@@ -13,29 +53,160 @@
13 53 <div class="ka-card">
14 54 <div class="ka-card-header">
15 55 <span class="dashicons dashicons-chart-area purple"></span>
16 56 <h2><?php esc_html_e('Analytics Overview', 'king-addons'); ?></h2>
17 - <?php if (!$is_pro) : ?><span class="ka-pro-badge">PRO</span><?php endif; ?>
18 57 </div>
19 58 <div class="ka-card-body">
20 - <div class="kng-maintenance-analytics-placeholder">
21 - <div>
22 - <strong><?php esc_html_e('Blocked visits', 'king-addons'); ?></strong>
23 - <p><?php esc_html_e('Track how many requests were stopped.', 'king-addons'); ?></p>
59 + <div class="ka-stats-grid" style="margin-top: 0;">
60 + <div class="ka-stat-card">
61 + <div class="ka-stat-label"><?php esc_html_e('Blocked visits', 'king-addons'); ?></div>
62 + <div class="ka-stat-value"><?php echo esc_html(number_format_i18n((int) $overview['blocked_total'])); ?></div>
63 + <div class="ka-stat-note">
64 + <?php
65 + echo esc_html(sprintf(
66 + /* translators: %s: 24h count */
67 + __('Last 24h: %s', 'king-addons'),
68 + number_format_i18n((int) $overview['blocked_24h'])
69 + ));
70 + ?>
71 + </div>
24 72 </div>
25 - <div>
26 - <strong><?php esc_html_e('Unique visitors', 'king-addons'); ?></strong>
27 - <p><?php esc_html_e('Measure unique blocked IPs.', 'king-addons'); ?></p>
73 +
74 + <div class="ka-stat-card">
75 + <div class="ka-stat-label"><?php esc_html_e('Unique visitors', 'king-addons'); ?></div>
76 + <div class="ka-stat-value"><?php echo esc_html(number_format_i18n((int) $overview['unique_24h'])); ?></div>
77 + <div class="ka-stat-note"><?php esc_html_e('Unique blocked IPs in the last 24 hours (hashed).', 'king-addons'); ?></div>
28 78 </div>
29 - <div>
30 - <strong><?php esc_html_e('Bypass usage', 'king-addons'); ?></strong>
31 - <p><?php esc_html_e('See how often bypasses are used.', 'king-addons'); ?></p>
79 +
80 + <div class="ka-stat-card">
81 + <div class="ka-stat-label"><?php esc_html_e('Bypass usage', 'king-addons'); ?></div>
82 + <div class="ka-stat-value"><?php echo esc_html(number_format_i18n((int) $overview['bypass_total'])); ?></div>
83 + <div class="ka-stat-note">
84 + <?php
85 + echo esc_html(sprintf(
86 + /* translators: %s: 24h count */
87 + __('Last 24h: %s', 'king-addons'),
88 + number_format_i18n((int) $overview['bypass_24h'])
89 + ));
90 + ?>
91 + </div>
32 92 </div>
33 93 </div>
34 94
35 - <?php if (!$is_pro) : ?>
36 - <a href="https://kingaddons.com/pricing/" target="_blank" class="ka-btn ka-btn-pink">
37 - <?php esc_html_e('Upgrade to Pro', 'king-addons'); ?>
95 + <div class="kng-maintenance-section" style="margin-top: 16px;">
96 + <h3 style="margin: 0 0 10px;"><?php esc_html_e('Bypass breakdown', 'king-addons'); ?></h3>
97 +
98 + <?php if (empty($bypass_total) && empty($bypass_24h)) : ?>
99 + <p class="description" style="margin: 0;">
100 + <?php esc_html_e('No bypass events tracked yet.', 'king-addons'); ?>
101 + </p>
102 + <?php else : ?>
103 + <table class="widefat striped">
104 + <thead>
105 + <tr>
106 + <th><?php esc_html_e('Reason', 'king-addons'); ?></th>
107 + <th style="width: 140px;"><?php esc_html_e('Total', 'king-addons'); ?></th>
108 + <th style="width: 140px;"><?php esc_html_e('Last 24h', 'king-addons'); ?></th>
109 + </tr>
110 + </thead>
111 + <tbody>
112 + <?php
113 + $reasons = array_unique(array_merge(array_keys($bypass_total), array_keys($bypass_24h)));
114 + foreach ($reasons as $reason) :
115 + $label = $reason_labels[$reason] ?? $reason;
116 + $total = (int) ($bypass_total[$reason] ?? 0);
117 + $last24 = (int) ($bypass_24h[$reason] ?? 0);
118 + if ($total === 0 && $last24 === 0) {
119 + continue;
120 + }
121 + ?>
122 + <tr>
123 + <td><?php echo esc_html($label); ?></td>
124 + <td><?php echo esc_html(number_format_i18n($total)); ?></td>
125 + <td><?php echo esc_html(number_format_i18n($last24)); ?></td>
126 + </tr>
127 + <?php endforeach; ?>
128 + </tbody>
129 + </table>
130 + <?php endif; ?>
131 + </div>
132 +
133 + <div class="kng-maintenance-section" style="margin-top: 16px;">
134 + <h3 style="margin: 0 0 10px;"><?php esc_html_e('Top paths (last 24h)', 'king-addons'); ?></h3>
135 + <p class="description" style="margin: 0 0 10px;">
136 + <?php esc_html_e('Paths are privacy-masked and stored only as hashed keys + masked samples.', 'king-addons'); ?>
137 + </p>
138 +
139 + <div class="kng-maintenance-content-grid" style="margin-bottom: 0;">
140 + <div>
141 + <h4 style="margin: 0 0 8px;"><?php esc_html_e('Blocked', 'king-addons'); ?></h4>
142 + <?php if (empty($top_blocked_paths)) : ?>
143 + <p class="description" style="margin: 0;"><?php esc_html_e('No blocked paths tracked yet.', 'king-addons'); ?></p>
144 + <?php else : ?>
145 + <table class="widefat striped">
146 + <thead>
147 + <tr>
148 + <th><?php esc_html_e('Path', 'king-addons'); ?></th>
149 + <th style="width: 120px;"><?php esc_html_e('Hits', 'king-addons'); ?></th>
150 + </tr>
151 + </thead>
152 + <tbody>
153 + <?php foreach ($top_blocked_paths as $row) :
154 + $mask = isset($row['mask']) ? (string) $row['mask'] : '';
155 + $count = (int) ($row['count'] ?? 0);
156 + if ($mask === '' || $count <= 0) {
157 + continue;
158 + }
159 + ?>
160 + <tr>
161 + <td><code><?php echo esc_html($mask); ?></code></td>
162 + <td><?php echo esc_html(number_format_i18n($count)); ?></td>
163 + </tr>
164 + <?php endforeach; ?>
165 + </tbody>
166 + </table>
167 + <?php endif; ?>
168 + </div>
169 +
170 + <div>
171 + <h4 style="margin: 0 0 8px;"><?php esc_html_e('Bypass', 'king-addons'); ?></h4>
172 + <?php if (empty($top_bypass_paths)) : ?>
173 + <p class="description" style="margin: 0;"><?php esc_html_e('No bypass paths tracked yet.', 'king-addons'); ?></p>
174 + <?php else : ?>
175 + <table class="widefat striped">
176 + <thead>
177 + <tr>
178 + <th><?php esc_html_e('Path', 'king-addons'); ?></th>
179 + <th style="width: 120px;"><?php esc_html_e('Hits', 'king-addons'); ?></th>
180 + </tr>
181 + </thead>
182 + <tbody>
183 + <?php foreach ($top_bypass_paths as $row) :
184 + $mask = isset($row['mask']) ? (string) $row['mask'] : '';
185 + $count = (int) ($row['count'] ?? 0);
186 + if ($mask === '' || $count <= 0) {
187 + continue;
188 + }
189 + ?>
190 + <tr>
191 + <td><code><?php echo esc_html($mask); ?></code></td>
192 + <td><?php echo esc_html(number_format_i18n($count)); ?></td>
193 + </tr>
194 + <?php endforeach; ?>
195 + </tbody>
196 + </table>
197 + <?php endif; ?>
198 + </div>
199 + </div>
200 + </div>
201 +
202 + <p class="kng-maintenance-note" style="margin-top: 12px;">
203 + <?php esc_html_e('Counts are updated when maintenance mode is active and a front-end request is blocked or bypassed.', 'king-addons'); ?>
204 + </p>
205 +
206 + <div class="kng-maintenance-actions" style="margin-top: 12px;">
207 + <a href="<?php echo esc_url($reset_url); ?>" class="ka-btn ka-btn-secondary" onclick="return confirm('<?php echo esc_js(__('Reset analytics? This cannot be undone.', 'king-addons')); ?>');">
208 + <?php esc_html_e('Reset analytics', 'king-addons'); ?>
38 209 </a>
39 - <?php endif; ?>
210 + </div>
40 211 </div>
41 212 </div>