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 / settings-general.php

settings-general.php in Custom 404 Pro trunk, at admin/views/settings-general.php

158 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * General settings view.
4 *
5 * @package Custom_404_Pro
6 */
7
8 $helpers = Helpers::singleton();
9 $options = $helpers->get_settings();
10 $send_email = $options['send_email'] ?? false;
11 $logging_enabled = $options['logging_enabled'] ?? false;
12 $redirect_error_code = isset( $options['redirect_error_code'] ) ? (int) $options['redirect_error_code'] : 302;
13 $log_ip = $options['log_ip'] ?? true;
14 $email_cooldown = isset( $options['email_cooldown'] ) ? (int) $options['email_cooldown'] : 3600;
15 $log_retention_count = isset( $options['log_retention_count'] ) ? (int) $options['log_retention_count'] : 0;
16 $log_retention_days = isset( $options['log_retention_days'] ) ? (int) $options['log_retention_days'] : 0;
17 ?>
18 <div class="wrap">
19 <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
20 <table class="form-table">
21 <tbody>
22 <tr>
23 <th><label for="c4p_log_email"><?php esc_html_e( 'Email', 'custom-404-pro' ); ?></label></th>
24 <td>
25 <input type="checkbox" id="c4p_log_email" name="send_email" <?php echo (bool) $send_email ? 'checked' : ''; ?> />
26 <p class="description">
27 <?php
28 echo wp_kses_post(
29 __(
30 'If you check this, <b>and logging is enabled</b>, an email will be sent on every error log on the admin\'s email account. If you\'re just starting out, it is recommended you uncheck this. Enable it based on your error volume to avoid flooding of your email inbox.',
31 'custom-404-pro'
32 )
33 );
34 ?>
35 </p>
36 </td>
37 </tr>
38 <tr>
39 <th><label for="c4p_email_cooldown"><?php esc_html_e( 'Email Notification Cooldown', 'custom-404-pro' ); ?></label></th>
40 <td>
41 <select id="c4p_email_cooldown" name="email_cooldown">
42 <option value="900" <?php echo 900 === $email_cooldown ? 'selected' : ''; ?>><?php esc_html_e( '15 minutes', 'custom-404-pro' ); ?></option>
43 <option value="1800" <?php echo 1800 === $email_cooldown ? 'selected' : ''; ?>><?php esc_html_e( '30 minutes', 'custom-404-pro' ); ?></option>
44 <option value="3600" <?php echo 3600 === $email_cooldown ? 'selected' : ''; ?>><?php esc_html_e( '1 hour', 'custom-404-pro' ); ?></option>
45 <option value="21600" <?php echo 21600 === $email_cooldown ? 'selected' : ''; ?>><?php esc_html_e( '6 hours', 'custom-404-pro' ); ?></option>
46 <option value="86400" <?php echo 86400 === $email_cooldown ? 'selected' : ''; ?>><?php esc_html_e( '24 hours', 'custom-404-pro' ); ?></option>
47 </select>
48 <p class="description">
49 <?php
50 echo wp_kses_post(
51 __(
52 'Only applies when <b>Email</b> is enabled. After a notification email is sent, no further emails will be sent for the selected duration. This prevents inbox flooding during bot crawls or traffic spikes.',
53 'custom-404-pro'
54 )
55 );
56 ?>
57 </p>
58 </td>
59 </tr>
60 <tr>
61 <th><label for="c4p_logging_enabled"><?php esc_html_e( 'Logging Status', 'custom-404-pro' ); ?></label></th>
62 <td>
63 <select id="c4p_logging_enabled" name="logging_enabled">
64 <option value="enabled" <?php echo (bool) $logging_enabled ? 'selected' : ''; ?>>
65 <?php esc_html_e( 'Enabled', 'custom-404-pro' ); ?>
66 </option>
67 <option value="disabled" <?php echo ! (bool) $logging_enabled ? 'selected' : ''; ?>>
68 <?php esc_html_e( 'Disabled', 'custom-404-pro' ); ?>
69 </option>
70 </select>
71 <p class="description">
72 <?php
73 echo wp_kses_post(
74 __(
75 'If logging status is <b>Enabled</b>, the plugin will capture logs. If the logging status is <b>Disabled</b>, the plugin will stop capturing logs. Please note that your previous logs will <b>NOT</b> be deleted. You may do so from the <b>Logs</b> page.',
76 'custom-404-pro'
77 )
78 );
79 ?>
80 </p>
81 </td>
82 </tr>
83 <tr>
84 <th><label for="c4p_log_ip"><?php esc_html_e( 'Log IP', 'custom-404-pro' ); ?></label></th>
85 <td>
86 <input type="checkbox" id="c4p_log_ip" name="log_ip" <?php echo (bool) $log_ip ? 'checked' : ''; ?> />
87 <p class="description">
88 <?php
89 echo wp_kses_post(
90 __(
91 'By default, the IP address of the 404 user agent is captured. If you would like to disable this for privacy reasons, please uncheck this box. When no IP is recorded, it will appear as <b>N/A</b> in the Logs Table as well as the email.',
92 'custom-404-pro'
93 )
94 );
95 ?>
96 </p>
97 </td>
98 </tr>
99 <tr>
100 <th><label for="c4p_redirect_error_code"><?php esc_html_e( 'Redirect Code', 'custom-404-pro' ); ?></label></th>
101 <td>
102 <select id="c4p_redirect_error_code" name="redirect_error_code">
103 <option value="301" <?php echo 301 === $redirect_error_code ? 'selected' : ''; ?>>301
104 </option>
105 <option value="302" <?php echo 302 === $redirect_error_code ? 'selected' : ''; ?>>302
106 </option>
107 <option value="307" <?php echo 307 === $redirect_error_code ? 'selected' : ''; ?>>307
108 </option>
109 <option value="308" <?php echo 308 === $redirect_error_code ? 'selected' : ''; ?>>308
110 </option>
111 </select>
112 <p class="description">
113 <?php esc_html_e( 'When a 404 occurs and a redirect mode has been set, it will be performed using this status code.', 'custom-404-pro' ); ?>
114 </p>
115 </td>
116 </tr>
117 <tr>
118 <th><label for="c4p_log_retention_count"><?php esc_html_e( 'Max Log Count', 'custom-404-pro' ); ?></label></th>
119 <td>
120 <input type="number" id="c4p_log_retention_count" name="log_retention_count" value="<?php echo esc_attr( $log_retention_count ); ?>" min="0" step="1" />
121 <p class="description">
122 <?php
123 echo wp_kses_post(
124 __(
125 'Maximum number of log rows to keep. When the table exceeds this limit, the oldest rows are deleted automatically during the daily cleanup. Set to <b>0</b> to disable (no limit).',
126 'custom-404-pro'
127 )
128 );
129 ?>
130 </p>
131 </td>
132 </tr>
133 <tr>
134 <th><label for="c4p_log_retention_days"><?php esc_html_e( 'Max Log Age (days)', 'custom-404-pro' ); ?></label></th>
135 <td>
136 <input type="number" id="c4p_log_retention_days" name="log_retention_days" value="<?php echo esc_attr( $log_retention_days ); ?>" min="0" step="1" />
137 <p class="description">
138 <?php
139 echo wp_kses_post(
140 __(
141 'Delete log entries older than this many days during the daily cleanup. Set to <b>0</b> to disable (keep forever).',
142 'custom-404-pro'
143 )
144 );
145 ?>
146 </p>
147 </td>
148 </tr>
149 </tbody>
150 </table>
151 <p class="submit">
152 <input type="hidden" name="action" value="form-settings-general"/>
153 <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo esc_attr__( 'Save Changes', 'custom-404-pro' ); ?>">
154 <?php wp_nonce_field( 'form-settings-general', 'form-settings-general' ); ?>
155 </p>
156 </form>
157 </div>
158