PluginProbe
Custom 404 Pro / trunk
Custom 404 Pro vtrunk
3.15.2 3.15.4 3.15.5 3.15.6 3.16.0 3.15.1 3.15.0 3.14.1 3.14.0 3.13.0 trunk 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.5 1.1.6 1.2.0 1.3.10 1.3.12 1.3.5 All 100 releases
custom-404-pro / admin / views / logs.php

logs.php in Custom 404 Pro trunk, at admin/views/logs.php

80 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Logs page view.
4 *
5 * @package Custom_404_Pro
6 */
7
8 $logs_table = new LogsClass();
9 $logs_table->prepare_items();
10
11 $helpers = Helpers::singleton();
12 $options = $helpers->get_settings();
13 $total_count = $helpers->get_logs_count();
14 $max_count = isset( $options['log_retention_count'] ) ? (int) $options['log_retention_count'] : 0;
15 $max_days = isset( $options['log_retention_days'] ) ? (int) $options['log_retention_days'] : 0;
16
17 ?>
18
19 <div class="wrap">
20 <h2><?php esc_html_e( 'Logs', 'custom-404-pro' ); ?></h2>
21
22 <p>
23 <?php
24 echo esc_html(
25 sprintf(
26 /* translators: %d: number of log rows */
27 __( 'Total log entries: %d', 'custom-404-pro' ),
28 (int) $total_count
29 )
30 );
31 if ( $max_count > 0 ) {
32 echo ' / ' . (int) $max_count;
33 }
34 ?>
35 </p>
36
37 <?php if ( $max_count > 0 && $total_count >= $max_count * 0.9 ) : ?>
38 <div class="notice notice-warning inline">
39 <p>
40 <?php
41 echo esc_html(
42 sprintf(
43 /* translators: 1: current log count, 2: max log count */
44 __( 'Log table is at %1$d of %2$d rows (90%% threshold reached). Consider pruning or raising the Max Log Count setting.', 'custom-404-pro' ),
45 (int) $total_count,
46 (int) $max_count
47 )
48 );
49 ?>
50 </p>
51 </div>
52 <?php endif; ?>
53
54 <?php if ( $max_count > 0 || $max_days > 0 ) : ?>
55 <p>
56 <a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=c4p-main&action=c4p-logs--prune' ), 'c4p-logs--prune' ) ); ?>" class="button">
57 <?php esc_html_e( 'Prune Logs Now', 'custom-404-pro' ); ?>
58 </a>
59 </p>
60 <?php endif; ?>
61
62 <form id="form_logs" method="GET">
63 <!-- For plugins, we also need to ensure that the form posts back to our current page -->
64 <input type="hidden" name="page" value="<?php echo esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['page'] ?? '' ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>" />
65 <!-- Now we can render the completed list table -->
66 <p class="search-box">
67 <label class="screen-reader-text" for="search_id-search-input"><?php esc_html_e( 'Search', 'custom-404-pro' ); ?></label>
68 <input id="search_id-search-input" type="text" name="s" value="
69 <?php
70 if ( array_key_exists( 's', $_GET ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
71 echo esc_attr( sanitize_text_field( wp_unslash( $_GET['s'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
72 }
73 ?>
74 " autocomplete="off" />
75 <input id="search-submit" class="button" type="submit" name="" value="<?php echo esc_attr__( 'Search', 'custom-404-pro' ); ?>" />
76 </p>
77 <?php $logs_table->display(); ?>
78 </form>
79 </div>
80