PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 4.0.0
Admin and Site Enhancements (ASE) v4.0.0
9.1.0 9.0.2 9.0.1 9.0.0 8.9.2 8.9.1 8.9.0 8.8.8 8.8.7 8.8.6 8.8.5 8.8.4 8.8.3 8.8.2 8.8.1 8.8.0 8.7.3 8.7.2 8.7.1 8.2.1 8.2.2 8.2.3 8.3.0 8.3.1 8.3.2 8.4.0 8.4.1 8.4.2 8.5.0 8.5.1 8.5.2 8.6.0 8.6.1 8.6.2 8.7.0 5.0.1 5.0.2 5.0.2.1 5.0.2.2 5.0.2.3 5.0.2.4 5.1.0 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1 5.5.0 5.5.1 5.5.2 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.8.0 5.8.1 6.0.0 6.0.3 6.0.4 6.0.5 6.0.5.1 6.0.6 6.0.7 6.0.8.1 6.1.0 6.1.3 6.2.0 6.2.1 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.3.0 6.3.1 6.3.2 6.4.0 6.5.0 6.5.1 6.6.0 6.7.0 6.8.0 6.8.2 6.8.3 6.9.0 6.9.1 6.9.10 6.9.11 6.9.12 6.9.13.1 6.9.13.2 6.9.2 6.9.3 6.9.4 6.9.5 6.9.6 6.9.7 6.9.8 6.9.9 7.0.0 7.0.2 7.0.2.1 7.0.2.2 7.0.2.3 7.0.3 7.1.0 7.1.1 7.1.2 7.1.3 7.1.4 7.1.5 7.2.0 7.2.1 7.3.0 7.3.1 7.3.2 7.3.3 7.4.0 7.4.2 7.4.4 7.4.5 7.4.6 7.4.7 7.4.8 7.5.0 7.5.1 7.5.2 7.5.3 7.5.4 7.6.0 7.6.1 7.6.1.1 7.6.10 7.6.11 7.6.2 7.6.3 7.6.4 7.6.5 7.6.6 7.6.7 7.6.7.1 7.6.8 7.6.9 7.7.0 7.8.0 7.8.1 7.8.10 7.8.11 7.8.12 7.8.13 7.8.14 7.8.15 7.8.16 7.8.17 7.8.18 7.8.2 7.8.3 7.8.4 7.8.5 7.8.5.1 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1 7.9.10 7.9.11 7.9.2 7.9.3 7.9.4 7.9.5 7.9.6 7.9.7 7.9.8 7.9.9 8.0.0 8.0.1 8.0.2 8.0.3 8.0.4 8.0.5 8.0.6 8.0.7 8.0.8 8.1.0 8.1.1 8.1.2 8.1.3 8.1.4 8.2.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.2.0 3.3.0 3.4.0 3.5.0 3.6.1 3.7.0 3.8.0 3.9.0 3.9.1 3.9.2 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.8.0 4.8.1 4.8.2 4.8.3 4.9.0 4.9.1 4.9.2 4.9.3 5.0.0
admin-site-enhancements / classes / class-settings-sections-fields.php
admin-site-enhancements / classes Last commit date
class-activation.php 3 years ago class-admin-interface.php 3 years ago class-common-methods.php 3 years ago class-content-management.php 3 years ago class-custom-code.php 3 years ago class-deactivation.php 3 years ago class-disable-components.php 3 years ago class-login-logout.php 3 years ago class-optimizations.php 3 years ago class-security.php 3 years ago class-settings-fields-render.php 3 years ago class-settings-sanitization.php 3 years ago class-settings-sections-fields.php 3 years ago class-utilities.php 3 years ago
class-settings-sections-fields.php
1777 lines
1 <?php
2
3 namespace ASENHA\Classes;
4
5 /**
6 * Class related to registration of settings fields
7 *
8 * @since 2.2.0
9 */
10 class Settings_Sections_Fields {
11
12 /**
13 * Register plugin settings and the corresponding fields
14 *
15 * @link https://wpshout.com/making-an-admin-options-page-with-the-wordpress-settings-api/
16 * @link https://rudrastyh.com/wordpress/creating-options-pages.html
17 * @since 1.0.0
18 */
19 function register_sections_fields() {
20
21 add_settings_section(
22 'main-section', // Section ID
23 '', // Section title. Can be blank.
24 '', // Callback function to output section intro. Can be blank.
25 ASENHA_SLUG // Settings page slug
26 );
27
28 // Register main setttings
29
30 // Instantiate object for sanitization of settings fields values
31 $sanitization = new Settings_Sanitization;
32
33 // Instantiate object for rendering of settings fields for the admin page
34 $render_field = new Settings_Fields_Render;
35
36 register_setting(
37 ASENHA_ID, // Option group or option_page
38 ASENHA_SLUG_U, // Option name in wp_options table
39 array(
40 'type' => 'array', // 'string', 'boolean', 'integer', 'number', 'array', or 'object'
41 'description' => '', // A description of the data attached to this setting.
42 'sanitize_callback' => [ $sanitization, 'sanitize_for_options' ],
43 'show_in_rest' => false,
44 'default' => array(), // When calling get_option()
45 )
46 );
47
48 // Call WordPress globals required for the fields
49
50 global $wp_roles, $wpdb, $asenha_public_post_types, $asenha_gutenberg_post_types, $asenha_revisions_post_types;
51
52 $roles = $wp_roles->get_names();
53
54 // Get array of slugs and plural labels for public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
55 $asenha_public_post_types = array();
56 $public_post_type_names = get_post_types( array( 'public' => true ), 'names' );
57 foreach( $public_post_type_names as $post_type_name ) {
58 $post_type_object = get_post_type_object( $post_type_name );
59 $asenha_public_post_types[$post_type_name] = $post_type_object->label;
60 }
61
62 // Get array of slugs and plural labels for post types that can be edited with the Gutenberg block editor, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
63 $asenha_gutenberg_post_types = array();
64 $gutenberg_not_applicable_types = array( 'attachment', 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache', 'user_request', 'wp_block' );
65 $all_post_types = get_post_types( array(), 'objects' );
66 foreach ( $all_post_types as $post_type_slug => $post_type_info ) {
67 $asenha_gutenberg_post_types[$post_type_slug] = $post_type_info->label;
68 if ( in_array( $post_type_slug, $gutenberg_not_applicable_types ) ) {
69 unset( $asenha_gutenberg_post_types[$post_type_slug] );
70 }
71 }
72
73 // Get array of slugs and plural labels for post types supporting revisions, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
74 $asenha_revisions_post_types = array();
75 foreach ( get_post_types( array(), 'names' ) as $post_type_slug ) { // post type slug/name
76 if ( post_type_supports( $post_type_slug, 'revisions' ) ) {
77 $post_type_object = get_post_type_object( $post_type_slug );
78 if ( property_exists( $post_type_object, 'label' ) ) {
79 $asenha_revisions_post_types[$post_type_slug] = $post_type_object->label;
80 }
81 }
82 }
83
84
85 // =================================================================
86 // CONTENT MANAGEMENT
87 // =================================================================
88
89 // Enable Page and Post Duplication
90
91 $field_id = 'enable_duplication';
92 $field_slug = 'enable-duplication';
93
94 add_settings_field(
95 $field_id, // Field ID
96 'Enable Page and Post Duplication', // Field title
97 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
98 ASENHA_SLUG, // Settings page slug
99 'main-section', // Section ID
100 array(
101 'field_id' => $field_id, // Custom argument
102 'field_slug' => $field_slug, // Custom argument
103 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
104 'field_description' => 'Enable one-click duplication of pages, posts and custom posts. The corresponding taxonomy terms and post meta will also be duplicated.', // Custom argument
105 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
106 )
107 );
108
109 // Enable Media Replacement
110
111 $field_id = 'enable_media_replacement';
112 $field_slug = 'enable-media-replacement';
113
114 add_settings_field(
115 $field_id, // Field ID
116 'Enable Media Replacement', // Field title
117 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
118 ASENHA_SLUG, // Settings page slug
119 'main-section', // Section ID
120 array(
121 'field_id' => $field_id, // Custom argument
122 'field_slug' => $field_slug, // Custom argument
123 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
124 'field_description' => 'Easily replace any type of media file with a new one while retaining the existing media ID, publish date and file name. So, no existing links will break.', // Custom argument
125 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
126 )
127 );
128
129 // Enable SVG Upload
130
131 $field_id = 'enable_svg_upload';
132 $field_slug = 'enable-svg-upload';
133
134 add_settings_field(
135 $field_id, // Field ID
136 'Enable SVG Upload', // Field title
137 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
138 ASENHA_SLUG, // Settings page slug
139 'main-section', // Section ID
140 array(
141 'field_id' => $field_id, // Custom argument
142 'field_slug' => $field_slug, // Custom argument
143 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
144 'field_description' => 'Allow some or all user roles to upload SVG files, which will then be sanitized to keep things secure.', // Custom argument
145 'field_options_wrapper' => true, // Custom argument. Add container for additional options
146 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
147 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
148 )
149 );
150
151 $field_id = 'enable_svg_upload_for';
152 $field_slug = 'enable-svg-upload-for';
153
154 if ( is_array( $roles ) ) {
155 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
156
157 add_settings_field(
158 $field_id . '_' . $role_slug, // Field ID
159 '', // Field title
160 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
161 ASENHA_SLUG, // Settings page slug
162 'main-section', // Section ID
163 array(
164 'parent_field_id' => $field_id, // Custom argument
165 'field_id' => $role_slug, // Custom argument
166 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
167 'field_label' => $role_label, // Custom argument
168 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
169 )
170 );
171
172 }
173 }
174
175 // Enable External Permalinks
176
177 $field_id = 'enable_external_permalinks';
178 $field_slug = 'enable-external-permalinks';
179
180 add_settings_field(
181 $field_id, // Field ID
182 'Enable External Permalinks', // Field title
183 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
184 ASENHA_SLUG, // Settings page slug
185 'main-section', // Section ID
186 array(
187 'field_id' => $field_id, // Custom argument
188 'field_slug' => $field_slug, // Custom argument
189 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
190 'field_description' => 'Enable pages, posts and/or custom post types to have permalinks that point to external URLs. Compatible with links added using <a href="https://wordpress.org/plugins/page-links-to/" target="_blank">Page Links To</a>.', // Custom argument
191 'field_options_wrapper' => true, // Custom argument. Add container for additional options
192 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
193 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
194 )
195 );
196
197 $field_id = 'enable_external_permalinks_for';
198 $field_slug = 'enable-external-permalinks-for';
199
200 if ( is_array( $asenha_public_post_types ) ) {
201 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
202 if ( 'attachment' != $post_type_slug ) {
203 add_settings_field(
204 $field_id . '_' . $post_type_slug, // Field ID
205 '', // Field title
206 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
207 ASENHA_SLUG, // Settings page slug
208 'main-section', // Section ID
209 array(
210 'parent_field_id' => $field_id, // Custom argument
211 'field_id' => $post_type_slug, // Custom argument
212 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
213 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
214 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
215 )
216 );
217 }
218 }
219 }
220
221 // Enable Revisions Control
222
223 $field_id = 'enable_revisions_control';
224 $field_slug = 'enable-revisions-control';
225
226 add_settings_field(
227 $field_id, // Field ID
228 'Enable Revisions Control', // Field title
229 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
230 ASENHA_SLUG, // Settings page slug
231 'main-section', // Section ID
232 array(
233 'field_id' => $field_id, // Custom argument
234 'field_slug' => $field_slug, // Custom argument
235 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
236 'field_description' => 'Prevent bloating the database by limiting the number of revisions to keep for some or all post types supporting revisions.', // Custom argument
237 'field_options_wrapper' => true, // Custom argument. Add container for additional options
238 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
239 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
240 )
241 );
242
243 $field_id = 'revisions_max_number';
244 $field_slug = 'revisions-max-number';
245
246 add_settings_field(
247 $field_id, // Field ID
248 '', // Field title
249 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
250 ASENHA_SLUG, // Settings page slug
251 'main-section', // Section ID
252 array(
253 'field_id' => $field_id, // Custom argument
254 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
255 'field_type' => 'with-prefix-suffix', // Custom argument
256 'field_prefix' => 'Limit to', // Custom argument
257 'field_suffix' => 'revisions for:', // Custom argument
258 'field_intro' => '', // Custom argument
259 'field_description' => '', // Custom argument
260 'class' => 'asenha-number asenha-hide-th extra-narrow content-management ' . $field_slug, // Custom class for the <tr> element
261 )
262 );
263
264 $field_id = 'enable_revisions_control_for';
265 $field_slug = 'enable-revisions-control-for';
266
267 if ( is_array( $asenha_revisions_post_types ) ) {
268 foreach ( $asenha_revisions_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
269 add_settings_field(
270 $field_id . '_' . $post_type_slug, // Field ID
271 '', // Field title
272 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
273 ASENHA_SLUG, // Settings page slug
274 'main-section', // Section ID
275 array(
276 'parent_field_id' => $field_id, // Custom argument
277 'field_id' => $post_type_slug, // Custom argument
278 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
279 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
280 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
281 )
282 );
283 }
284 }
285
286 // Enable Auto-Publishing of Posts with Missed Schedules
287
288 $field_id = 'enable_missed_schedule_posts_auto_publish';
289 $field_slug = 'enable-missed-schedule-posts-auto-publish';
290
291 add_settings_field(
292 $field_id, // Field ID
293 'Enable Auto-Publishing of Posts with Missed Schedule', // Field title
294 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
295 ASENHA_SLUG, // Settings page slug
296 'main-section', // Section ID
297 array(
298 'field_id' => $field_id, // Custom argument
299 'field_slug' => $field_slug, // Custom argument
300 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
301 'field_description' => 'Trigger publishing of scheduled posts of all types marked with "missed schedule", anytime the site is visited.', // Custom argument
302 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
303 )
304 );
305
306
307 // Enhance List Tables
308
309 $field_id = 'enhance_list_tables';
310 $field_slug = 'enhance-list-tables';
311
312 add_settings_field(
313 $field_id, // Field ID
314 'Enhance List Tables', // Field title
315 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
316 ASENHA_SLUG, // Settings page slug
317 'main-section', // Section ID
318 array(
319 'field_id' => $field_id, // Custom argument
320 'field_slug' => $field_slug, // Custom argument
321 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
322 'field_description' => 'Improve the usefulness of listing pages of various post types by adding / removing columns and elements.', // Custom argument
323 'field_options_wrapper' => true, // Custom argument. Add container for additional options
324 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
325 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
326 )
327 );
328
329 // Show Featured Image Column
330
331 $field_id = 'show_featured_image_column';
332 $field_slug = 'show-featured-image-column';
333
334 add_settings_field(
335 $field_id, // Field ID
336 '', // Field title
337 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
338 ASENHA_SLUG, // Settings page slug
339 'main-section', // Section ID
340 array(
341 'field_id' => $field_id, // Custom argument
342 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
343 'field_label' => 'Show featured image column.', // Custom argument
344 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
345 )
346 );
347
348 // Show Excerpt Column
349
350 $field_id = 'show_excerpt_column';
351 $field_slug = 'show-excerpt-column';
352
353 add_settings_field(
354 $field_id, // Field ID
355 '', // Field title
356 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
357 ASENHA_SLUG, // Settings page slug
358 'main-section', // Section ID
359 array(
360 'field_id' => $field_id, // Custom argument
361 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
362 'field_label' => 'Show excerpt column.', // Custom argument
363 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
364 )
365 );
366
367 // Show ID Column
368
369 $field_id = 'show_id_column';
370 $field_slug = 'show-id-column';
371
372 add_settings_field(
373 $field_id, // Field ID
374 '', // Field title
375 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
376 ASENHA_SLUG, // Settings page slug
377 'main-section', // Section ID
378 array(
379 'field_id' => $field_id, // Custom argument
380 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
381 'field_label' => 'Show ID column.', // Custom argument
382 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
383 )
384 );
385
386 // Hide Comments Column
387
388 $field_id = 'hide_comments_column';
389 $field_slug = 'hide-comments-column';
390
391 add_settings_field(
392 $field_id, // Field ID
393 '', // Field title
394 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
395 ASENHA_SLUG, // Settings page slug
396 'main-section', // Section ID
397 array(
398 'field_id' => $field_id, // Custom argument
399 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
400 'field_label' => 'Remove comments column.', // Custom argument
401 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
402 )
403 );
404
405 // Hide Post Tags Column
406
407 $field_id = 'hide_post_tags_column';
408 $field_slug = 'hide-post-tags-column';
409
410 add_settings_field(
411 $field_id, // Field ID
412 '', // Field title
413 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
414 ASENHA_SLUG, // Settings page slug
415 'main-section', // Section ID
416 array(
417 'field_id' => $field_id, // Custom argument
418 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
419 'field_label' => 'Remove tags column (for posts).', // Custom argument
420 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
421 )
422 );
423
424 // Show Custom Taxonomy Filters
425
426 $field_id = 'show_custom_taxonomy_filters';
427 $field_slug = 'show-custom-taxonomy-filters';
428
429 add_settings_field(
430 $field_id, // Field ID
431 '', // Field title
432 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
433 ASENHA_SLUG, // Settings page slug
434 'main-section', // Section ID
435 array(
436 'field_id' => $field_id, // Custom argument
437 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
438 'field_label' => 'Show additional filter(s) for hierarchical, custom taxonomies.', // Custom argument
439 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
440 )
441 );
442
443 // =================================================================
444 // ADMIN INTERFACE
445 // =================================================================
446
447 // Hide Admin Notices
448
449 $field_id = 'hide_admin_notices';
450 $field_slug = 'hide-admin-notices';
451
452 add_settings_field(
453 $field_id, // Field ID
454 'Hide Admin Notices', // Field title
455 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
456 ASENHA_SLUG, // Settings page slug
457 'main-section', // Section ID
458 array(
459 'field_id' => $field_id, // Custom argument
460 'field_slug' => $field_slug, // Custom argument
461 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
462 'field_description' => 'Clean up admin pages by moving notices into a separate panel easily accessible via the admin bar.', // Custom argument
463 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
464 )
465 );
466
467 // View Admin as Role
468
469 $field_id = 'view_admin_as_role';
470 $field_slug = 'view-admin-as-role';
471
472 add_settings_field(
473 $field_id, // Field ID
474 'View Admin as Role', // Field title
475 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
476 ASENHA_SLUG, // Settings page slug
477 'main-section', // Section ID
478 array(
479 'field_id' => $field_id, // Custom argument
480 'field_slug' => $field_slug, // Custom argument
481 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
482 'field_description' => 'View admin pages and the site (logged-in) as one of the non-administrator user roles.', // Custom argument
483 'field_options_wrapper' => true, // Custom argument. Add container for additional options
484 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
485 )
486 );
487
488 // Hide or Modify Elements
489
490 $field_id = 'hide_modify_elements';
491 $field_slug = 'hide-modify-elements';
492
493 add_settings_field(
494 $field_id, // Field ID
495 'Clean Up Admin Bar', // Field title
496 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
497 ASENHA_SLUG, // Settings page slug
498 'main-section', // Section ID
499 array(
500 'field_id' => $field_id, // Custom argument
501 'field_slug' => $field_slug, // Custom argument
502 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
503 'field_description' => 'Remove various elements from the admin bar.', // Custom argument
504 'field_options_wrapper' => true, // Custom argument. Add container for additional options
505 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
506 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
507 )
508 );
509
510 $field_id = 'hide_ab_wp_logo_menu';
511 $field_slug = 'hide-ab-wp-logo-menu';
512
513 add_settings_field(
514 $field_id, // Field ID
515 '', // Field title
516 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
517 ASENHA_SLUG, // Settings page slug
518 'main-section', // Section ID
519 array(
520 'field_id' => $field_id, // Custom argument
521 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
522 'field_label' => 'Remove WordPress logo/menu', // Custom argument
523 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
524 )
525 );
526
527 $field_id = 'hide_ab_customize_menu';
528 $field_slug = 'hide-ab-customize-menu';
529
530 add_settings_field(
531 $field_id, // Field ID
532 '', // Field title
533 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
534 ASENHA_SLUG, // Settings page slug
535 'main-section', // Section ID
536 array(
537 'field_id' => $field_id, // Custom argument
538 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
539 'field_label' => 'Remove customize menu', // Custom argument
540 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
541 )
542 );
543
544 $field_id = 'hide_ab_updates_menu';
545 $field_slug = 'hide-ab-updates-menu';
546
547 add_settings_field(
548 $field_id, // Field ID
549 '', // Field title
550 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
551 ASENHA_SLUG, // Settings page slug
552 'main-section', // Section ID
553 array(
554 'field_id' => $field_id, // Custom argument
555 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
556 'field_label' => 'Remove updates counter/link', // Custom argument
557 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
558 )
559 );
560
561 $field_id = 'hide_ab_comments_menu';
562 $field_slug = 'hide-ab-comments-menu';
563
564 add_settings_field(
565 $field_id, // Field ID
566 '', // Field title
567 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
568 ASENHA_SLUG, // Settings page slug
569 'main-section', // Section ID
570 array(
571 'field_id' => $field_id, // Custom argument
572 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
573 'field_label' => 'Remove comments counter/link', // Custom argument
574 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
575 )
576 );
577
578 $field_id = 'hide_ab_new_content_menu';
579 $field_slug = 'hide-ab-new-content-menu';
580
581 add_settings_field(
582 $field_id, // Field ID
583 '', // Field title
584 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
585 ASENHA_SLUG, // Settings page slug
586 'main-section', // Section ID
587 array(
588 'field_id' => $field_id, // Custom argument
589 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
590 'field_label' => 'Remove new content menu', // Custom argument
591 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
592 )
593 );
594
595 $field_id = 'hide_ab_howdy';
596 $field_slug = 'hide-ab-howdy';
597
598 add_settings_field(
599 $field_id, // Field ID
600 '', // Field title
601 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
602 ASENHA_SLUG, // Settings page slug
603 'main-section', // Section ID
604 array(
605 'field_id' => $field_id, // Custom argument
606 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
607 'field_label' => 'Remove \'Howdy\'', // Custom argument
608 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
609 )
610 );
611
612 // Hide Admin Bar
613
614 $field_id = 'hide_admin_bar';
615 $field_slug = 'hide-admin-bar';
616
617 add_settings_field(
618 $field_id, // Field ID
619 'Hide Admin Bar', // Field title
620 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
621 ASENHA_SLUG, // Settings page slug
622 'main-section', // Section ID
623 array(
624 'field_id' => $field_id, // Custom argument
625 'field_slug' => $field_slug, // Custom argument
626 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
627 'field_description' => 'Hide admin bar on the front end for all or some user roles.', // Custom argument
628 'field_options_wrapper' => true, // Custom argument. Add container for additional options
629 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
630 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
631 )
632 );
633
634 $field_id = 'hide_admin_bar_for';
635 $field_slug = 'hide-admin-bar-for';
636
637 if ( is_array( $roles ) ) {
638 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
639
640 add_settings_field(
641 $field_id . '_' . $role_slug, // Field ID
642 '', // Field title
643 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
644 ASENHA_SLUG, // Settings page slug
645 'main-section', // Section ID
646 array(
647 'parent_field_id' => $field_id, // Custom argument
648 'field_id' => $role_slug, // Custom argument
649 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
650 'field_label' => $role_label, // Custom argument
651 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
652 )
653 );
654
655 }
656 }
657
658 // Customize Admin Menu
659
660 $field_id = 'customize_admin_menu';
661 $field_slug = 'customize-admin-menu';
662
663 add_settings_field(
664 $field_id, // Field ID
665 'Admin Menu Organizer', // Field title
666 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
667 ASENHA_SLUG, // Settings page slug
668 'main-section', // Section ID
669 array(
670 'field_id' => $field_id, // Custom argument
671 'field_slug' => $field_slug, // Custom argument
672 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
673 'field_description' => 'Customize the order of the admin menu and optionally change menu item title or hide some items.', // Custom argument
674 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
675 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
676 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
677 )
678 );
679
680 $field_id = 'custom_menu_order';
681 $field_slug = 'custom-menu-order';
682
683 add_settings_field(
684 $field_id, // Field ID
685 '', // Field title
686 [ $render_field, 'render_sortable_menu' ], // Callback to render field with custom arguments in the array below
687 ASENHA_SLUG, // Settings page slug
688 'main-section', // Section ID
689 array(
690 'field_id' => $field_id, // Custom argument
691 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
692 'field_type' => 'sortable-menu', // Custom argument
693 'field_description' => '', // Custom argument
694 'class' => 'asenha-sortable asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
695 )
696 );
697
698 // =================================================================
699 // LOG IN | LOG OUT
700 // =================================================================
701
702 // Change Login URL
703
704 $field_id = 'change_login_url';
705 $field_slug = 'change-login-url';
706
707 add_settings_field(
708 $field_id, // Field ID
709 'Change Login URL', // Field title
710 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
711 ASENHA_SLUG, // Settings page slug
712 'main-section', // Section ID
713 array(
714 'field_id' => $field_id, // Custom argument
715 'field_slug' => $field_slug, // Custom argument
716 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
717 'field_description' => 'Default is ' . get_site_url() . '/wp-admin/', // Custom argument
718 'field_options_wrapper' => true, // Custom argument. Add container for additional options
719 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
720 )
721 );
722
723 $field_id = 'custom_login_slug';
724 $field_slug = 'custom-login-slug';
725
726 add_settings_field(
727 $field_id, // Field ID
728 'New URL:', // Field title
729 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
730 ASENHA_SLUG, // Settings page slug
731 'main-section', // Section ID
732 array(
733 'field_id' => $field_id, // Custom argument
734 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
735 'field_type' => 'with-prefix-suffix', // Custom argument
736 'field_prefix' => get_site_url() . '/', // Custom argument
737 'field_suffix' => '/', // Custom argument
738 'field_description' => '', // Custom argument
739 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, // Custom class for the <tr> element
740 )
741 );
742
743 // Enable Log In/Out Menu
744
745 $field_id = 'enable_login_logout_menu';
746 $field_slug = 'enable-login-logout-menu';
747
748 add_settings_field(
749 $field_id, // Field ID
750 'Enable Log In/Out Menu', // Field title
751 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
752 ASENHA_SLUG, // Settings page slug
753 'main-section', // Section ID
754 array(
755 'field_id' => $field_id, // Custom argument
756 'field_slug' => $field_slug, // Custom argument
757 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
758 'field_description' => 'Enable log in, log out and dynamic log in/out menu item for addition to any menu.', // Custom argument
759 'field_options_wrapper' => true, // Custom argument. Add container for additional options
760 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
761 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
762 )
763 );
764
765 // Enable Last Login Column
766
767 $field_id = 'enable_last_login_column';
768 $field_slug = 'enable-last-login-column';
769
770 add_settings_field(
771 $field_id, // Field ID
772 'Enable Last Login Column', // Field title
773 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
774 ASENHA_SLUG, // Settings page slug
775 'main-section', // Section ID
776 array(
777 'field_id' => $field_id, // Custom argument
778 'field_slug' => $field_slug, // Custom argument
779 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
780 'field_description' => 'Log when users on the site last logged in and display the date and time in the users list table.', // Custom argument
781 'field_options_wrapper' => true, // Custom argument. Add container for additional options
782 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
783 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
784 )
785 );
786
787 // Redirect After Login
788
789 $field_id = 'redirect_after_login';
790 $field_slug = 'redirect-after-login';
791
792 add_settings_field(
793 $field_id, // Field ID
794 'Redirect After Login', // Field title
795 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
796 ASENHA_SLUG, // Settings page slug
797 'main-section', // Section ID
798 array(
799 'field_id' => $field_id, // Custom argument
800 'field_slug' => $field_slug, // Custom argument
801 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
802 'field_description' => 'Set custom redirect URL for all or some user roles after login.', // Custom argument
803 'field_options_wrapper' => true, // Custom argument. Add container for additional options
804 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
805 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
806 )
807 );
808
809 $field_id = 'redirect_after_login_to_slug';
810 $field_slug = 'redirect-after-login-to-slug';
811
812 add_settings_field(
813 $field_id, // Field ID
814 'Redirect to:', // Field title
815 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
816 ASENHA_SLUG, // Settings page slug
817 'main-section', // Section ID
818 array(
819 'field_id' => $field_id, // Custom argument
820 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
821 'field_type' => 'with-prefix-suffix', // Custom argument
822 'field_prefix' => get_site_url() . '/', // Custom argument
823 'field_suffix' => '/ for:', // Custom argument
824 'field_description' => '', // Custom argument
825 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, // Custom class for the <tr> element
826 )
827 );
828
829 $field_id = 'redirect_after_login_for';
830 $field_slug = 'redirect-after-login-for';
831
832 if ( is_array( $roles ) ) {
833 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
834
835 add_settings_field(
836 $field_id . '_' . $role_slug, // Field ID
837 '', // Field title
838 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
839 ASENHA_SLUG, // Settings page slug
840 'main-section', // Section ID
841 array(
842 'parent_field_id' => $field_id, // Custom argument
843 'field_id' => $role_slug, // Custom argument
844 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
845 'field_label' => $role_label, // Custom argument
846 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
847 )
848 );
849
850 }
851 }
852
853 // Redirect After Logout
854
855 $field_id = 'redirect_after_logout';
856 $field_slug = 'redirect-after-logout';
857
858 add_settings_field(
859 $field_id, // Field ID
860 'Redirect After Logout', // Field title
861 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
862 ASENHA_SLUG, // Settings page slug
863 'main-section', // Section ID
864 array(
865 'field_id' => $field_id, // Custom argument
866 'field_slug' => $field_slug, // Custom argument
867 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
868 'field_description' => 'Set custom redirect URL for all or some user roles after logout.', // Custom argument
869 'field_options_wrapper' => true, // Custom argument. Add container for additional options
870 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
871 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
872 )
873 );
874
875 $field_id = 'redirect_after_logout_to_slug';
876 $field_slug = 'redirect-after-logout-to-slug';
877
878 add_settings_field(
879 $field_id, // Field ID
880 'Redirect to:', // Field title
881 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
882 ASENHA_SLUG, // Settings page slug
883 'main-section', // Section ID
884 array(
885 'field_id' => $field_id, // Custom argument
886 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
887 'field_type' => 'with-prefix-suffix', // Custom argument
888 'field_prefix' => get_site_url() . '/', // Custom argument
889 'field_suffix' => '/ for:', // Custom argument
890 'field_description' => '', // Custom argument
891 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, // Custom class for the <tr> element
892 )
893 );
894
895 $field_id = 'redirect_after_logout_for';
896 $field_slug = 'redirect-after-logout-for';
897
898 if ( is_array( $roles ) ) {
899 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
900
901 add_settings_field(
902 $field_id . '_' . $role_slug, // Field ID
903 '', // Field title
904 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
905 ASENHA_SLUG, // Settings page slug
906 'main-section', // Section ID
907 array(
908 'parent_field_id' => $field_id, // Custom argument
909 'field_id' => $role_slug, // Custom argument
910 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
911 'field_label' => $role_label, // Custom argument
912 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
913 )
914 );
915
916 }
917 }
918
919 // =================================================================
920 // CUSTOM CODE
921 // =================================================================
922
923 // Enable Custom Admin CSS
924
925 $field_id = 'enable_custom_admin_css';
926 $field_slug = 'enable-custom-admin-css';
927
928 add_settings_field(
929 $field_id, // Field ID
930 'Enable Custom Admin CSS', // Field title
931 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
932 ASENHA_SLUG, // Settings page slug
933 'main-section', // Section ID
934 array(
935 'field_id' => $field_id, // Custom argument
936 'field_slug' => $field_slug, // Custom argument
937 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
938 'field_description' => 'Add custom CSS on all admin pages for all user roles.', // Custom argument
939 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
940 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
941 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
942 )
943 );
944
945 $field_id = 'custom_admin_css';
946 $field_slug = 'custom-admin-css';
947
948 add_settings_field(
949 $field_id, // Field ID
950 '', // Field title
951 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
952 ASENHA_SLUG, // Settings page slug
953 'main-section', // Section ID
954 array(
955 'field_id' => $field_id, // Custom argument
956 'field_slug' => $field_slug, // Custom argument
957 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
958 'field_type' => 'textarea', // Custom argument
959 'field_intro' => '', // Custom argument
960 'field_description' => '', // Custom argument
961 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
962 )
963 );
964
965 // Enable Custom Frontend CSS
966
967 $field_id = 'enable_custom_frontend_css';
968 $field_slug = 'enable-custom-frontend-css';
969
970 add_settings_field(
971 $field_id, // Field ID
972 'Enable Custom Frontend CSS', // Field title
973 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
974 ASENHA_SLUG, // Settings page slug
975 'main-section', // Section ID
976 array(
977 'field_id' => $field_id, // Custom argument
978 'field_slug' => $field_slug, // Custom argument
979 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
980 'field_description' => 'Add custom CSS on all frontend pages for all user roles.', // Custom argument
981 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
982 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
983 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
984 )
985 );
986
987 $field_id = 'custom_frontend_css';
988 $field_slug = 'custom-frontend-css';
989
990 add_settings_field(
991 $field_id, // Field ID
992 '', // Field title
993 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
994 ASENHA_SLUG, // Settings page slug
995 'main-section', // Section ID
996 array(
997 'field_id' => $field_id, // Custom argument
998 'field_slug' => $field_slug, // Custom argument
999 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1000 'field_type' => 'textarea', // Custom argument
1001 'field_intro' => '', // Custom argument
1002 'field_description' => '', // Custom argument
1003 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1004 )
1005 );
1006
1007 // Manage ads.txt and app-ads.txt
1008
1009 $field_id = 'manage_ads_appads_txt';
1010 $field_slug = 'manage-ads-appads-txt';
1011
1012 add_settings_field(
1013 $field_id, // Field ID
1014 'Manage ads.txt and app-ads.txt', // Field title
1015 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1016 ASENHA_SLUG, // Settings page slug
1017 'main-section', // Section ID
1018 array(
1019 'field_id' => $field_id, // Custom argument
1020 'field_slug' => $field_slug, // Custom argument
1021 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1022 'field_description' => 'Easily edit and validate your <a href="/ads.txt" target="_blank">ads.txt</a> and <a href="/app-ads.txt" target="_blank">app-ads.txt</a> content.', // Custom argument
1023 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1024 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1025 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
1026 )
1027 );
1028
1029 $field_id = 'ads_txt_content';
1030 $field_slug = 'ads-txt-content';
1031
1032 add_settings_field(
1033 $field_id, // Field ID
1034 '', // Field title
1035 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1036 ASENHA_SLUG, // Settings page slug
1037 'main-section', // Section ID
1038 array(
1039 'field_id' => $field_id, // Custom argument
1040 'field_slug' => $field_slug, // Custom argument
1041 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1042 'field_type' => 'textarea', // Custom argument
1043 'field_intro' => '<strong>Your ads.txt content:</strong>', // Custom argument
1044 'field_description' => 'Validate with: <a href="https://adstxt.guru/validator/url/?url=' . urlencode( get_site_url( null, 'ads.txt' ) ) . '" target="_blank">adstxt.guru</a> | <a href="https://www.adstxtvalidator.com/ads_txt/' . esc_attr( str_replace( '.', '-', $_SERVER['SERVER_NAME'] ) ) . '" target="_blank">adstxtvalidator.com</a><div class="vspacer"></div>', // Custom argument
1045 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1046 )
1047 );
1048
1049 $field_id = 'app_ads_txt_content';
1050 $field_slug = 'app-ads-txt-content';
1051
1052 add_settings_field(
1053 $field_id, // Field ID
1054 '', // Field title
1055 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1056 ASENHA_SLUG, // Settings page slug
1057 'main-section', // Section ID
1058 array(
1059 'field_id' => $field_id, // Custom argument
1060 'field_slug' => $field_slug, // Custom argument
1061 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1062 'field_type' => 'textarea', // Custom argument
1063 'field_intro' => '<strong>Your app-ads.txt content:</strong>', // Custom argument
1064 'field_description' => 'Validate with: <a href="https://adstxt.guru/validator/url/?url=' . urlencode( get_site_url( null, 'app-ads.txt' ) ) . '" target="_blank">adstxt.guru</a>', // Custom argument
1065 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1066 )
1067 );
1068
1069 // Manage robots.txt
1070
1071 $field_id = 'manage_robots_txt';
1072 $field_slug = 'manage-robots-txt';
1073
1074 add_settings_field(
1075 $field_id, // Field ID
1076 'Manage robots.txt', // Field title
1077 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1078 ASENHA_SLUG, // Settings page slug
1079 'main-section', // Section ID
1080 array(
1081 'field_id' => $field_id, // Custom argument
1082 'field_slug' => $field_slug, // Custom argument
1083 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1084 'field_description' => 'Easily edit and validate your <a href="/robots.txt" target="_blank">robots.txt</a> content.', // Custom argument
1085 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1086 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1087 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
1088 )
1089 );
1090
1091 $field_id = 'robots_txt_content';
1092 $field_slug = 'robots-txt-content';
1093
1094 add_settings_field(
1095 $field_id, // Field ID
1096 '', // Field title
1097 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1098 ASENHA_SLUG, // Settings page slug
1099 'main-section', // Section ID
1100 array(
1101 'field_id' => $field_id, // Custom argument
1102 'field_slug' => $field_slug, // Custom argument
1103 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1104 'field_type' => 'textarea', // Custom argument
1105 'field_intro' => '', // Custom argument
1106 'field_description' => 'Validate with: <a href="https://en.ryte.com/free-tools/robots-txt/?refresh=1&url=' . urlencode( get_site_url( null, 'robots.txt' ) ) . '&useragent=Googlebot&submit=Evaluate" target="_blank">ryte.com</a> | <a href="https://serp.tools/tools/robots-txt" target="_blank">serp.tools</a><div class="vspacer"></div>', // Custom argument
1107 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1108 )
1109 );
1110
1111 // Insert <head>, <body> and <footer> code
1112
1113 $field_id = 'insert_head_body_footer_code';
1114 $field_slug = 'insert-head-body-footer-code';
1115
1116 add_settings_field(
1117 $field_id, // Field ID
1118 'Insert &lt;head&gt;, &lt;body&gt; and &lt;footer&gt; Code', // Field title
1119 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1120 ASENHA_SLUG, // Settings page slug
1121 'main-section', // Section ID
1122 array(
1123 'field_id' => $field_id, // Custom argument
1124 'field_slug' => $field_slug, // Custom argument
1125 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1126 'field_description' => 'Easily insert &lt;meta&gt;, &lt;link&gt;, &lt;script&gt; and &lt;style&gt; tags, Google Analytics, Tag Manager, AdSense, Ads Conversion and Optimize code, Facebook, TikTok and Twitter pixels, etc.', // Custom argument
1127 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1128 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1129 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
1130 )
1131 );
1132
1133 $field_id = 'head_code_priority';
1134 $field_slug = 'head-code-priority';
1135
1136 add_settings_field(
1137 $field_id, // Field ID
1138 '', // Field title
1139 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1140 ASENHA_SLUG, // Settings page slug
1141 'main-section', // Section ID
1142 array(
1143 'field_id' => $field_id, // Custom argument
1144 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1145 'field_type' => 'with-prefix-suffix', // Custom argument
1146 'field_prefix' => '<strong>Code to insert before &lt;/head&gt; with the priority of</strong>', // Custom argument
1147 'field_suffix' => '', // Custom argument
1148 'field_intro' => '', // Custom argument
1149 'field_description' => 'Default is 10. Larger number insert code closer to &lt;/head&gt;', // Custom argument
1150 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug, // Custom class for the <tr> element
1151 )
1152 );
1153
1154 $field_id = 'head_code';
1155 $field_slug = 'head-code';
1156
1157 add_settings_field(
1158 $field_id, // Field ID
1159 '', // Field title
1160 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1161 ASENHA_SLUG, // Settings page slug
1162 'main-section', // Section ID
1163 array(
1164 'field_id' => $field_id, // Custom argument
1165 'field_slug' => $field_slug, // Custom argument
1166 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1167 'field_type' => 'textarea', // Custom argument
1168 'field_intro' => '', // Custom argument
1169 'field_description' => '', // Custom argument
1170 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1171 )
1172 );
1173
1174 $field_id = 'body_code_priority';
1175 $field_slug = 'body-code-priority';
1176
1177 add_settings_field(
1178 $field_id, // Field ID
1179 '', // Field title
1180 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1181 ASENHA_SLUG, // Settings page slug
1182 'main-section', // Section ID
1183 array(
1184 'field_id' => $field_id, // Custom argument
1185 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1186 'field_type' => 'with-prefix-suffix', // Custom argument
1187 'field_prefix' => '<strong>Code to insert after &lt;body&gt; with the priority of</strong>', // Custom argument
1188 'field_suffix' => '', // Custom argument
1189 'field_intro' => '', // Custom argument
1190 'field_description' => 'Default is 10. Smaller number insert code closer to &lt;body&gt;', // Custom argument
1191 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug, // Custom class for the <tr> element
1192 )
1193 );
1194
1195 $field_id = 'body_code';
1196 $field_slug = 'body-code';
1197
1198 add_settings_field(
1199 $field_id, // Field ID
1200 '', // Field title
1201 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1202 ASENHA_SLUG, // Settings page slug
1203 'main-section', // Section ID
1204 array(
1205 'field_id' => $field_id, // Custom argument
1206 'field_slug' => $field_slug, // Custom argument
1207 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1208 'field_type' => 'textarea', // Custom argument
1209 'field_intro' => '', // Custom argument
1210 'field_description' => '', // Custom argument
1211 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1212 )
1213 );
1214
1215 $field_id = 'footer_code_priority';
1216 $field_slug = 'footer-code-priority';
1217
1218 add_settings_field(
1219 $field_id, // Field ID
1220 '', // Field title
1221 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1222 ASENHA_SLUG, // Settings page slug
1223 'main-section', // Section ID
1224 array(
1225 'field_id' => $field_id, // Custom argument
1226 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1227 'field_type' => 'with-prefix-suffix', // Custom argument
1228 'field_prefix' => '<strong>Code to insert in footer section before &lt;/body&gt;: with the priority of</strong>', // Custom argument
1229 'field_suffix' => '', // Custom argument
1230 'field_intro' => '', // Custom argument
1231 'field_description' => 'Default is 10. Larger number insert code closer to &lt;/body&gt;', // Custom argument
1232 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug, // Custom class for the <tr> element
1233 )
1234 );
1235
1236 $field_id = 'footer_code';
1237 $field_slug = 'footer-code';
1238
1239 add_settings_field(
1240 $field_id, // Field ID
1241 '', // Field title
1242 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1243 ASENHA_SLUG, // Settings page slug
1244 'main-section', // Section ID
1245 array(
1246 'field_id' => $field_id, // Custom argument
1247 'field_slug' => $field_slug, // Custom argument
1248 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1249 'field_type' => 'textarea', // Custom argument
1250 'field_intro' => '', // Custom argument
1251 'field_description' => '', // Custom argument
1252 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1253 )
1254 );
1255
1256 // =================================================================
1257 // DISABLE COMPONENTS
1258 // =================================================================
1259
1260 // Disable Gutenberg
1261
1262 $field_id = 'disable_gutenberg';
1263 $field_slug = 'disable-gutenberg';
1264
1265 add_settings_field(
1266 $field_id, // Field ID
1267 'Disable Gutenberg', // Field title
1268 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1269 ASENHA_SLUG, // Settings page slug
1270 'main-section', // Section ID
1271 array(
1272 'field_id' => $field_id, // Custom argument
1273 'field_slug' => $field_slug, // Custom argument
1274 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1275 'field_description' => 'Disable the Gutenberg block editor for some or all applicable post types.', // Custom argument
1276 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1277 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1278 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1279 )
1280 );
1281
1282 $field_id = 'disable_gutenberg_for';
1283 $field_slug = 'disable-gutenberg-for';
1284
1285 if ( is_array( $asenha_gutenberg_post_types ) ) {
1286 foreach ( $asenha_gutenberg_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
1287 add_settings_field(
1288 $field_id . '_' . $post_type_slug, // Field ID
1289 '', // Field title
1290 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
1291 ASENHA_SLUG, // Settings page slug
1292 'main-section', // Section ID
1293 array(
1294 'parent_field_id' => $field_id, // Custom argument
1295 'field_id' => $post_type_slug, // Custom argument
1296 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
1297 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
1298 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
1299 )
1300 );
1301 }
1302 }
1303
1304 $field_id = 'disable_gutenberg_frontend_styles';
1305 $field_slug = 'disable-gutenberg-frontend-styles';
1306
1307 add_settings_field(
1308 $field_id, // Field ID
1309 '', // Field title
1310 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
1311 ASENHA_SLUG, // Settings page slug
1312 'main-section', // Section ID
1313 array(
1314 'field_id' => $field_id, // Custom argument
1315 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1316 'field_label' => 'Also disable frontend block styles / CSS files for the selected post types.', // Custom argument
1317 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-top disable-components ' . $field_slug, // Custom class for the <tr> element
1318 )
1319 );
1320
1321 // Disable Comments
1322
1323 $field_id = 'disable_comments';
1324 $field_slug = 'disable-comments';
1325
1326 add_settings_field(
1327 $field_id, // Field ID
1328 'Disable Comments', // Field title
1329 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1330 ASENHA_SLUG, // Settings page slug
1331 'main-section', // Section ID
1332 array(
1333 'field_id' => $field_id, // Custom argument
1334 'field_slug' => $field_slug, // Custom argument
1335 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1336 'field_description' => 'Disable comments for some or all public post types. When disabled, existing comments will also be hidden on the frontend.', // Custom argument
1337 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1338 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1339 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1340 )
1341 );
1342
1343 $field_id = 'disable_comments_for';
1344 $field_slug = 'disable-comments-for';
1345
1346 if ( is_array( $asenha_public_post_types ) ) {
1347 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
1348 add_settings_field(
1349 $field_id . '_' . $post_type_slug, // Field ID
1350 '', // Field title
1351 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
1352 ASENHA_SLUG, // Settings page slug
1353 'main-section', // Section ID
1354 array(
1355 'parent_field_id' => $field_id, // Custom argument
1356 'field_id' => $post_type_slug, // Custom argument
1357 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
1358 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
1359 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
1360 )
1361 );
1362 }
1363 }
1364
1365 // Disable REST API
1366
1367 $field_id = 'disable_rest_api';
1368 $field_slug = 'disable-rest-api';
1369
1370 add_settings_field(
1371 $field_id, // Field ID
1372 'Disable REST API', // Field title
1373 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1374 ASENHA_SLUG, // Settings page slug
1375 'main-section', // Section ID
1376 array(
1377 'field_id' => $field_id, // Custom argument
1378 'field_slug' => $field_slug, // Custom argument
1379 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1380 'field_description' => 'Disable REST API access for non-authenticated users and remove URL traces from &lt;head&gt;, HTTP headers and WP RSD endpoint.', // Custom argument
1381 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1382 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1383 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1384 )
1385 );
1386
1387 // Disable Feeds
1388
1389 $field_id = 'disable_feeds';
1390 $field_slug = 'disable-feeds';
1391
1392 add_settings_field(
1393 $field_id, // Field ID
1394 'Disable Feeds', // Field title
1395 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1396 ASENHA_SLUG, // Settings page slug
1397 'main-section', // Section ID
1398 array(
1399 'field_id' => $field_id, // Custom argument
1400 'field_slug' => $field_slug, // Custom argument
1401 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1402 'field_description' => 'Disable all RSS, Atom and RDF feeds. This includes feeds for posts, categories, tags, comments, authors and search. Also removes traces of feed URLs from &lt;head&gt;.', // Custom argument
1403 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1404 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1405 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1406 )
1407 );
1408
1409 // Disable Auto Updates
1410
1411 $field_id = 'disable_all_updates';
1412 $field_slug = 'disable-all-updates';
1413
1414 add_settings_field(
1415 $field_id, // Field ID
1416 'Disable All Updates', // Field title
1417 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1418 ASENHA_SLUG, // Settings page slug
1419 'main-section', // Section ID
1420 array(
1421 'field_id' => $field_id, // Custom argument
1422 'field_slug' => $field_slug, // Custom argument
1423 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1424 'field_description' => 'Completely disable core, theme and plugin updates and auto-updates. Will also prevent update checks, notices and emails.', // Custom argument
1425 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1426 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1427 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1428 )
1429 );
1430
1431 // =================================================================
1432 // SECURITY
1433 // =================================================================
1434
1435 // Limit Login Attempts
1436
1437 $field_id = 'limit_login_attempts';
1438 $field_slug = 'limit-login-attempts';
1439
1440 add_settings_field(
1441 $field_id, // Field ID
1442 'Limit Login Attempts', // Field title
1443 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1444 ASENHA_SLUG, // Settings page slug
1445 'main-section', // Section ID
1446 array(
1447 'field_id' => $field_id, // Custom argument
1448 'field_slug' => $field_slug, // Custom argument
1449 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1450 'field_description' => 'Prevent brute force attacks by limiting the number of failed login attempts allowed per IP address.', // Custom argument
1451 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1452 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1453 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
1454 )
1455 );
1456
1457 $field_id = 'login_fails_allowed';
1458 $field_slug = 'login-fails-allowed';
1459
1460 add_settings_field(
1461 $field_id, // Field ID
1462 '', // Field title
1463 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
1464 ASENHA_SLUG, // Settings page slug
1465 'main-section', // Section ID
1466 array(
1467 'field_id' => $field_id, // Custom argument
1468 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1469 'field_type' => 'with-prefix-suffix', // Custom argument
1470 'field_prefix' => '', // Custom argument
1471 'field_suffix' => 'failed login attempts allowed before 15 minutes lockout', // Custom argument
1472 'field_description' => '', // Custom argument
1473 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug, // Custom class for the <tr> element
1474 )
1475 );
1476
1477 $field_id = 'login_lockout_maxcount';
1478 $field_slug = 'login-lockout-maxcount';
1479
1480 add_settings_field(
1481 $field_id, // Field ID
1482 '', // Field title
1483 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
1484 ASENHA_SLUG, // Settings page slug
1485 'main-section', // Section ID
1486 array(
1487 'field_id' => $field_id, // Custom argument
1488 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1489 'field_type' => 'with-prefix-suffix', // Custom argument
1490 'field_prefix' => '', // Custom argument
1491 'field_suffix' => 'lockout(s) will block further login attempts for 24 hours', // Custom argument
1492 'field_description' => '', // Custom argument
1493 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug, // Custom class for the <tr> element
1494 )
1495 );
1496
1497 $field_id = 'login_attempts_log_table';
1498 $field_slug = 'login-attempts-log-table';
1499
1500 add_settings_field(
1501 $field_id, // Field ID
1502 '', // Field title
1503 [ $render_field, 'render_datatable' ], // Callback to render field with custom arguments in the array below
1504 ASENHA_SLUG, // Settings page slug
1505 'main-section', // Section ID
1506 array(
1507 'field_id' => $field_id, // Custom argument
1508 'field_slug' => $field_slug, // Custom argument
1509 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1510 'field_type' => 'datatable', // Custom argument
1511 'field_description' => '', // Custom argument
1512 'class' => 'asenha-text datatable asenha-hide-th security ' . $field_slug, // Custom class for the <tr> element
1513 'table_title' => 'Failed Login Attempts Log',
1514 'table_name' => $wpdb->prefix . 'asenha_failed_logins',
1515 )
1516 );
1517
1518 // Obfuscate Author Slugs
1519
1520 $field_id = 'obfuscate_author_slugs';
1521 $field_slug = 'obfuscate-author-slugs';
1522
1523 add_settings_field(
1524 $field_id, // Field ID
1525 'Obfuscate Author Slugs', // Field title
1526 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1527 ASENHA_SLUG, // Settings page slug
1528 'main-section', // Section ID
1529 array(
1530 'field_id' => $field_id, // Custom argument
1531 'field_slug' => $field_slug, // Custom argument
1532 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1533 'field_description' => 'Obfuscate publicly exposed author page URLs that shows the user slugs / usernames, e.g. <em>sitename.com/author/username1/</em> into <em>sitename.com/author/a6r5b8ytu9gp34bv/</em>, and output 404 errors for the original URLs. Also obfuscates in /wp-json/wp/v2/users/ REST API endpoint.', // Custom argument
1534 'field_options_wrapper' => false, // Custom argument. Add container for additional options
1535 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
1536 )
1537 );
1538
1539 // Disable XML-RPC
1540
1541 $field_id = 'disable_xmlrpc';
1542 $field_slug = 'disable-xmlrpc';
1543
1544 add_settings_field(
1545 $field_id, // Field ID
1546 'Disable XML-RPC', // Field title
1547 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1548 ASENHA_SLUG, // Settings page slug
1549 'main-section', // Section ID
1550 array(
1551 'field_id' => $field_id, // Custom argument
1552 'field_slug' => $field_slug, // Custom argument
1553 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1554 'field_description' => 'Protect your site from brute force, DOS and DDOS attacks via <a href="https://kinsta.com/blog/xmlrpc-php/#what-is-xmlrpcphp" target="_blank">XML-RPC</a>. Also disables trackbacks and pingbacks. ', // Custom argument
1555 'field_options_wrapper' => false, // Custom argument. Add container for additional options
1556 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
1557 )
1558 );
1559
1560 // =================================================================
1561 // OPTIMIZATIONS
1562 // =================================================================
1563
1564 // Enable Heartbeat Control
1565
1566 $field_id = 'enable_heartbeat_control';
1567 $field_slug = 'enable-heartbeat-control';
1568
1569 add_settings_field(
1570 $field_id, // Field ID
1571 'Enable Heartbeat Control', // Field title
1572 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1573 ASENHA_SLUG, // Settings page slug
1574 'main-section', // Section ID
1575 array(
1576 'field_id' => $field_id, // Custom argument
1577 'field_slug' => $field_slug, // Custom argument
1578 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1579 'field_description' => 'Modify the interval of the WordPress heartbeat API or disable it on admin pages, post creation/edit screens and/or the frontend. This will help reduce CPU load on the server.', // Custom argument
1580 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1581 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1582 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
1583 )
1584 );
1585
1586 $field_id = 'heartbeat_control_for_admin_pages';
1587 $field_slug = 'heartbeat-control-for-admin-pages';
1588
1589 add_settings_field(
1590 $field_id, // Field ID
1591 'On admin pages', // Field title
1592 [ $render_field, 'render_radio_buttons_subfield' ], // Callback to render field with custom arguments in the array below
1593 ASENHA_SLUG, // Settings page slug
1594 'main-section', // Section ID
1595 array(
1596 'field_id' => $field_id, // Custom argument
1597 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1598 // 'field_label' => 'Temporary label', // Custom argument
1599 'field_radios' => array(
1600 'Keep as is' => 'default',
1601 'Modify' => 'modify',
1602 'Disable' => 'disable',
1603 ),
1604 'field_default' => 'default',
1605 'class' => 'asenha-radio-buttons optimizations ' . $field_slug, // Custom class for the <tr> element
1606 ),
1607 );
1608
1609 $field_id = 'heartbeat_interval_for_admin_pages';
1610 $field_slug = 'heartbeat-interval-for-admin-pages';
1611
1612 add_settings_field(
1613 $field_id, // Field ID
1614 '', // Field title
1615 [ $render_field, 'render_select_subfield' ], // Callback to render field with custom arguments in the array below
1616 ASENHA_SLUG, // Settings page slug
1617 'main-section', // Section ID
1618 array(
1619 'field_id' => $field_id, // Custom argument
1620 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1621 'field_type' => 'with-prefix-suffix', // Custom argument
1622 'field_prefix' => 'Set interval to once every', // Custom argument
1623 'field_suffix' => '<span class="faded">(Default is 1 minute)</span>', // Custom argument
1624 'field_select_options' => array(
1625 '15 seconds' => 15,
1626 '30 seconds' => 30,
1627 '1 minute' => 60,
1628 '2 minutes' => 120,
1629 '3 minutes' => 180,
1630 '5 minutes' => 300,
1631 '10 minutes' => 600,
1632 ),
1633 'field_select_default' => 60,
1634 'field_intro' => '', // Custom argument
1635 'field_description' => '', // Custom argument
1636 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug, // Custom class for the <tr> element
1637 'display_none_on_load' => true,
1638 )
1639 );
1640
1641 $field_id = 'heartbeat_control_for_post_edit';
1642 $field_slug = 'heartbeat-control-for-post-edit';
1643
1644 add_settings_field(
1645 $field_id, // Field ID
1646 'On post creation and edit screens', // Field title
1647 [ $render_field, 'render_radio_buttons_subfield' ], // Callback to render field with custom arguments in the array below
1648 ASENHA_SLUG, // Settings page slug
1649 'main-section', // Section ID
1650 array(
1651 'field_id' => $field_id, // Custom argument
1652 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1653 // 'field_label' => 'Temporary label', // Custom argument
1654 'field_radios' => array(
1655 'Keep as is' => 'default',
1656 'Modify' => 'modify',
1657 'Disable' => 'disable',
1658 ),
1659 'field_default' => 'default',
1660 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug, // Custom class for the <tr> element
1661 ),
1662 );
1663
1664 $field_id = 'heartbeat_interval_for_post_edit';
1665 $field_slug = 'heartbeat-interval-for-post-edit';
1666
1667 add_settings_field(
1668 $field_id, // Field ID
1669 '', // Field title
1670 [ $render_field, 'render_select_subfield' ], // Callback to render field with custom arguments in the array below
1671 ASENHA_SLUG, // Settings page slug
1672 'main-section', // Section ID
1673 array(
1674 'field_id' => $field_id, // Custom argument
1675 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1676 'field_type' => 'with-prefix-suffix', // Custom argument
1677 'field_prefix' => 'Set interval to once every', // Custom argument
1678 'field_suffix' => '<span class="faded">(Default is 15 seconds)</span>', // Custom argument
1679 'field_select_options' => array(
1680 '15 seconds' => 15,
1681 '30 seconds' => 30,
1682 '45 seconds' => 45,
1683 '60 seconds' => 60,
1684 '90 seconds' => 90,
1685 '120 seconds' => 120
1686 ),
1687 'field_select_default' => 15,
1688 'field_intro' => '', // Custom argument
1689 'field_description' => '', // Custom argument
1690 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug, // Custom class for the <tr> element
1691 'display_none_on_load' => true,
1692 )
1693 );
1694
1695 $field_id = 'heartbeat_control_for_frontend';
1696 $field_slug = 'heartbeat-control-for-frontend';
1697
1698 add_settings_field(
1699 $field_id, // Field ID
1700 'On the frontend', // Field title
1701 [ $render_field, 'render_radio_buttons_subfield' ], // Callback to render field with custom arguments in the array below
1702 ASENHA_SLUG, // Settings page slug
1703 'main-section', // Section ID
1704 array(
1705 'field_id' => $field_id, // Custom argument
1706 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1707 // 'field_label' => 'Temporary label', // Custom argument
1708 'field_radios' => array(
1709 'Keep as is' => 'default',
1710 'Modify' => 'modify',
1711 'Disable' => 'disable',
1712 ),
1713 'field_default' => 'default',
1714 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug, // Custom class for the <tr> element
1715 ),
1716 );
1717
1718 $field_id = 'heartbeat_interval_for_frontend';
1719 $field_slug = 'heartbeat-interval-for-frontend';
1720
1721 add_settings_field(
1722 $field_id, // Field ID
1723 '', // Field title
1724 [ $render_field, 'render_select_subfield' ], // Callback to render field with custom arguments in the array below
1725 ASENHA_SLUG, // Settings page slug
1726 'main-section', // Section ID
1727 array(
1728 'field_id' => $field_id, // Custom argument
1729 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1730 'field_type' => 'with-prefix-suffix', // Custom argument
1731 'field_prefix' => 'Set interval to once every', // Custom argument
1732 'field_suffix' => '', // Custom argument
1733 'field_select_options' => array(
1734 '15 seconds' => 15,
1735 '30 seconds' => 30,
1736 '1 minute' => 60,
1737 '2 minutes' => 120,
1738 '3 minutes' => 180,
1739 '5 minutes' => 300,
1740 '10 minutes' => 600,
1741 ),
1742 'field_select_default' => 60,
1743 'field_intro' => '', // Custom argument
1744 'field_description' => '', // Custom argument
1745 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug, // Custom class for the <tr> element
1746 'display_none_on_load' => true,
1747 )
1748 );
1749
1750 // =================================================================
1751 // UTILITIES
1752 // =================================================================
1753
1754 // Redirect 404 to Homepage
1755
1756 $field_id = 'redirect_404_to_homepage';
1757 $field_slug = 'redirect-404-to-homepage';
1758
1759 add_settings_field(
1760 $field_id, // Field ID
1761 'Redirect 404 to Homepage', // Field title
1762 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1763 ASENHA_SLUG, // Settings page slug
1764 'main-section', // Section ID
1765 array(
1766 'field_id' => $field_id, // Custom argument
1767 'field_slug' => $field_slug, // Custom argument
1768 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1769 'field_description' => 'Perform 301 (permanent) redirect to the homepage for all 404 (not found) pages.', // Custom argument
1770 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1771 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
1772 )
1773 );
1774
1775 }
1776
1777 }