PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 6.9.2
Admin and Site Enhancements (ASE) v6.9.2
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 2 years ago class-admin-interface.php 2 years ago class-common-methods.php 2 years ago class-content-management.php 2 years ago class-custom-code.php 2 years ago class-deactivation.php 2 years ago class-disable-components.php 2 years ago class-login-logout.php 2 years ago class-optimizations.php 2 years ago class-security.php 2 years ago class-settings-fields-render.php 2 years ago class-settings-sanitization.php 2 years ago class-settings-sections-fields.php 2 years ago class-utilities.php 2 years ago
class-settings-sections-fields.php
3667 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',
23 // Section ID
24 '',
25 // Section title. Can be blank.
26 '',
27 // Callback function to output section intro. Can be blank.
28 ASENHA_SLUG
29 );
30 $common_methods = new Common_Methods();
31 // Register main setttings
32 // Instantiate object for sanitization of settings fields values
33 $sanitization = new Settings_Sanitization();
34 // Instantiate object for rendering of settings fields for the admin page
35 $render_field = new Settings_Fields_Render();
36 register_setting(
37 ASENHA_ID,
38 // Option group or option_page
39 ASENHA_SLUG_U,
40 // Option name in wp_options table
41 array(
42 'type' => 'array',
43 'description' => '',
44 'sanitize_callback' => [ $sanitization, 'sanitize_for_options' ],
45 'show_in_rest' => false,
46 'default' => array(),
47 )
48 );
49 // =================================================================
50 // Call WordPress globals and set new globals required for the fields
51 // =================================================================
52 global
53 $wp_version,
54 $wp_roles,
55 $wpdb,
56 $asenha_public_post_types,
57 $asenha_gutenberg_post_types,
58 $asenha_revisions_post_types,
59 $active_plugin_slugs,
60 $workable_nodes
61 ;
62 $options = get_option( ASENHA_SLUG_U, array() );
63 $options_extra = get_option( ASENHA_SLUG_U . '_extra', array() );
64 $roles = $wp_roles->get_names();
65 // Get array of slugs and plural labels for public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
66 $asenha_public_post_types = array();
67 $public_post_type_names = get_post_types( array(
68 'public' => true,
69 ), 'names' );
70 foreach ( $public_post_type_names as $post_type_name ) {
71 $post_type_object = get_post_type_object( $post_type_name );
72 $asenha_public_post_types[$post_type_name] = $post_type_object->label;
73 }
74 // 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' )
75 $asenha_gutenberg_post_types = array();
76 $gutenberg_not_applicable_types = array(
77 'attachment',
78 'revision',
79 'nav_menu_item',
80 'custom_css',
81 'customize_changeset',
82 'oembed_cache',
83 'user_request',
84 'wp_block',
85 'wp_template',
86 'wp_template_part',
87 'wp_global_styles',
88 'wp_navigation'
89 );
90 $all_post_types = get_post_types( array(), 'objects' );
91 foreach ( $all_post_types as $post_type_slug => $post_type_info ) {
92 $asenha_gutenberg_post_types[$post_type_slug] = $post_type_info->label;
93 if ( in_array( $post_type_slug, $gutenberg_not_applicable_types ) ) {
94 unset( $asenha_gutenberg_post_types[$post_type_slug] );
95 }
96 }
97 // Get array of slugs and plural labels for post types supporting revisions, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
98 $asenha_revisions_post_types = array();
99 foreach ( get_post_types( array(), 'names' ) as $post_type_slug ) {
100 // post type slug/name
101
102 if ( post_type_supports( $post_type_slug, 'revisions' ) ) {
103 $post_type_object = get_post_type_object( $post_type_slug );
104 if ( property_exists( $post_type_object, 'label' ) ) {
105 $asenha_revisions_post_types[$post_type_slug] = $post_type_object->label;
106 }
107 }
108
109 }
110 // Get array of active plugins slugs
111 $active_plugins = get_option( 'active_plugins', array() );
112 $active_plugin_slugs = array();
113 foreach ( $active_plugins as $active_plugin ) {
114 // e.g. debug-log-manager/debug-log-manager.php
115 $active_plugin = explode( "/", $active_plugin );
116 $active_plugin_slugs[] = $active_plugin[0];
117 }
118 // Enable Content Duplication
119 $field_id = 'enable_duplication';
120 $field_slug = 'enable-duplication';
121 add_settings_field(
122 $field_id,
123 // Field ID
124 'Content Duplication',
125 // Field title
126 [ $render_field, 'render_checkbox_toggle' ],
127 // Callback to render field with custom arguments in the array below
128 ASENHA_SLUG,
129 // Settings page slug
130 'main-section',
131 // Section ID
132 array(
133 'option_name' => ASENHA_SLUG_U,
134 'field_id' => $field_id,
135 'field_slug' => $field_slug,
136 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
137 'field_description' => 'Enable one-click duplication of pages, posts and custom posts. The corresponding taxonomy terms and post meta will also be duplicated.',
138 'field_options_wrapper' => true,
139 'field_options_moreless' => true,
140 'class' => 'asenha-toggle content-management ' . $field_slug,
141 )
142 );
143 $field_id = 'duplication_redirect_destination';
144 $field_slug = 'duplication-redirect-destination';
145 add_settings_field(
146 $field_id,
147 // Field ID
148 'After duplication, redirect to:',
149 // Field title
150 [ $render_field, 'render_radio_buttons_subfield' ],
151 // Callback to render field with custom arguments in the array below
152 ASENHA_SLUG,
153 // Settings page slug
154 'main-section',
155 // Section ID
156 array(
157 'option_name' => ASENHA_SLUG_U,
158 'field_id' => $field_id,
159 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
160 'field_radios' => array(
161 'Edit screen' => 'edit',
162 'List view' => 'list',
163 ),
164 'field_default' => 'edit',
165 'class' => 'asenha-radio-buttons shift-up content-management ' . $field_slug,
166 )
167 );
168 // Content Order
169 $field_id = 'content_order';
170 $field_slug = 'content-order';
171 add_settings_field(
172 $field_id,
173 // Field ID
174 'Content Order',
175 // Field title
176 [ $render_field, 'render_checkbox_toggle' ],
177 // Callback to render field with custom arguments in the array below
178 ASENHA_SLUG,
179 // Settings page slug
180 'main-section',
181 // Section ID
182 array(
183 'option_name' => ASENHA_SLUG_U,
184 'field_id' => $field_id,
185 'field_slug' => $field_slug,
186 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
187 'field_description' => 'Enable custom ordering of various "hierarchical" content types or those supporting "page attributes". A new \'Order\' sub-menu will appear for enabled content type(s). The "All {Posts}" list page for enabled post types in wp-admin will automatically use the custom order. ',
188 'field_options_wrapper' => true,
189 'field_options_moreless' => true,
190 'class' => 'asenha-toggle content-management ' . $field_slug,
191 )
192 );
193 // $field_id = 'content_order_subfields_heading';
194 // $field_slug = 'content-order-subfields-heading';
195 // add_settings_field(
196 // $field_id, // Field ID
197 // '', // Field title
198 // [ $render_field, 'render_subfields_heading' ], // Callback to render field with custom arguments in the array below
199 // ASENHA_SLUG, // Settings page slug
200 // 'main-section', // Section ID
201 // array(
202 // 'subfields_heading' => 'Custom Post Types (Non-Hierarchical)', // Custom argument
203 // 'class' => 'asenha-heading shift-more-up content-management ' . $field_slug, // Custom class for the <tr> element
204 // )
205 // );
206 $field_id = 'content_order_for';
207 $field_slug = 'content-order-for';
208 if ( is_array( $asenha_public_post_types ) ) {
209 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
210 // e.g. $post_type_slug is post, $post_type_label is Posts
211 $is_hierarchical_label = ( is_post_type_hierarchical( $post_type_slug ) ? ' <span class="faded">- Hierarchical</span>' : '' );
212 if ( post_type_supports( $post_type_slug, 'page-attributes' ) || is_post_type_hierarchical( $post_type_slug ) ) {
213 add_settings_field(
214 $field_id . '_' . $post_type_slug,
215 // Field ID
216 '',
217 // Field title
218 [ $render_field, 'render_checkbox_subfield' ],
219 // Callback to render field with custom arguments in the array below
220 ASENHA_SLUG,
221 // Settings page slug
222 'main-section',
223 // Section ID
224 array(
225 'option_name' => ASENHA_SLUG_U,
226 'parent_field_id' => $field_id,
227 'field_id' => $post_type_slug,
228 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
229 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>' . $is_hierarchical_label,
230 'class' => 'asenha-checkbox asenha-hide-th asenha-half content-management ' . $field_slug . ' ' . $post_type_slug,
231 )
232 );
233 }
234 }
235 }
236 // Media Replacement
237 $field_id = 'enable_media_replacement';
238 $field_slug = 'enable-media-replacement';
239 add_settings_field(
240 $field_id,
241 // Field ID
242 'Media Replacement',
243 // Field title
244 [ $render_field, 'render_checkbox_toggle' ],
245 // Callback to render field with custom arguments in the array below
246 ASENHA_SLUG,
247 // Settings page slug
248 'main-section',
249 // Section ID
250 array(
251 'option_name' => ASENHA_SLUG_U,
252 'field_id' => $field_id,
253 'field_slug' => $field_slug,
254 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
255 '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.',
256 'class' => 'asenha-toggle content-management ' . $field_slug,
257 )
258 );
259 // Media Library Infinite Scrolling
260 $field_id = 'media_library_infinite_scrolling';
261 $field_slug = 'media-library-infinite-scrolling';
262 add_settings_field(
263 $field_id,
264 // Field ID
265 'Media Library Infinite Scrolling',
266 // Field title
267 [ $render_field, 'render_checkbox_toggle' ],
268 // Callback to render field with custom arguments in the array below
269 ASENHA_SLUG,
270 // Settings page slug
271 'main-section',
272 // Section ID
273 array(
274 'option_name' => ASENHA_SLUG_U,
275 'field_id' => $field_id,
276 'field_slug' => $field_slug,
277 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
278 'field_description' => 'Re-enable infinite scrolling in the grid view of the media library. Useful for scrolling through a large library.',
279 'class' => 'asenha-toggle content-management ' . $field_slug,
280 )
281 );
282 // Enable SVG Upload
283 $field_id = 'enable_svg_upload';
284 $field_slug = 'enable-svg-upload';
285 add_settings_field(
286 $field_id,
287 // Field ID
288 'SVG Upload',
289 // Field title
290 [ $render_field, 'render_checkbox_toggle' ],
291 // Callback to render field with custom arguments in the array below
292 ASENHA_SLUG,
293 // Settings page slug
294 'main-section',
295 // Section ID
296 array(
297 'option_name' => ASENHA_SLUG_U,
298 'field_id' => $field_id,
299 'field_slug' => $field_slug,
300 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
301 'field_description' => 'Allow some or all user roles to upload SVG files, which will then be sanitized to keep things secure.',
302 'field_options_wrapper' => true,
303 'field_options_moreless' => true,
304 'class' => 'asenha-toggle content-management ' . $field_slug,
305 )
306 );
307 $field_id = 'enable_svg_upload_for';
308 $field_slug = 'enable-svg-upload-for';
309 if ( is_array( $roles ) ) {
310 foreach ( $roles as $role_slug => $role_label ) {
311 // e.g. $role_slug is administrator, $role_label is Administrator
312 add_settings_field(
313 $field_id . '_' . $role_slug,
314 // Field ID
315 '',
316 // Field title
317 [ $render_field, 'render_checkbox_subfield' ],
318 // Callback to render field with custom arguments in the array below
319 ASENHA_SLUG,
320 // Settings page slug
321 'main-section',
322 // Section ID
323 array(
324 'option_name' => ASENHA_SLUG_U,
325 'parent_field_id' => $field_id,
326 'field_id' => $role_slug,
327 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
328 'field_label' => $role_label,
329 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug,
330 )
331 );
332 }
333 }
334 // Enable External Permalinks
335 $field_id = 'enable_external_permalinks';
336 $field_slug = 'enable-external-permalinks';
337 add_settings_field(
338 $field_id,
339 // Field ID
340 'External Permalinks',
341 // Field title
342 [ $render_field, 'render_checkbox_toggle' ],
343 // Callback to render field with custom arguments in the array below
344 ASENHA_SLUG,
345 // Settings page slug
346 'main-section',
347 // Section ID
348 array(
349 'option_name' => ASENHA_SLUG_U,
350 'field_id' => $field_id,
351 'field_slug' => $field_slug,
352 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
353 'field_description' => 'Enable pages, posts and/or custom post types to have permalinks that point to external URLs. The rel="noopener noreferrer nofollow" attribute will also be added for enhanced security and SEO benefits. Compatible with links added using <a href="https://wordpress.org/plugins/page-links-to/" target="_blank">Page Links To</a>.',
354 'field_options_wrapper' => true,
355 'field_options_moreless' => true,
356 'class' => 'asenha-toggle content-management ' . $field_slug,
357 )
358 );
359 $field_id = 'enable_external_permalinks_for';
360 $field_slug = 'enable-external-permalinks-for';
361 if ( is_array( $asenha_public_post_types ) ) {
362 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
363 // e.g. $post_type_slug is post, $post_type_label is Posts
364 if ( 'attachment' != $post_type_slug ) {
365 add_settings_field(
366 $field_id . '_' . $post_type_slug,
367 // Field ID
368 '',
369 // Field title
370 [ $render_field, 'render_checkbox_subfield' ],
371 // Callback to render field with custom arguments in the array below
372 ASENHA_SLUG,
373 // Settings page slug
374 'main-section',
375 // Section ID
376 array(
377 'option_name' => ASENHA_SLUG_U,
378 'parent_field_id' => $field_id,
379 'field_id' => $post_type_slug,
380 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
381 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
382 'class' => 'asenha-checkbox asenha-hide-th asenha-half content-management ' . $field_slug . ' ' . $post_type_slug,
383 )
384 );
385 }
386 }
387 }
388 // Open All External Links in New Tab
389 $field_id = 'external_links_new_tab';
390 $field_slug = 'external-links-new-tab';
391 add_settings_field(
392 $field_id,
393 // Field ID
394 'Open All External Links in New Tab',
395 // Field title
396 [ $render_field, 'render_checkbox_toggle' ],
397 // Callback to render field with custom arguments in the array below
398 ASENHA_SLUG,
399 // Settings page slug
400 'main-section',
401 // Section ID
402 array(
403 'option_name' => ASENHA_SLUG_U,
404 'field_id' => $field_id,
405 'field_slug' => $field_slug,
406 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
407 'field_description' => 'Force all links to external sites in post content, where <a href="https://developer.wordpress.org/reference/hooks/the_content/" target="_blank">the_content</a> hook is used, to open in new browser tab via target="_blank" attribute. The rel="noopener noreferrer nofollow" attribute will also be added for enhanced security and SEO benefits.',
408 'field_options_wrapper' => false,
409 'field_options_moreless' => false,
410 'class' => 'asenha-toggle content-management ' . $field_slug,
411 )
412 );
413 // Allow Custom Nav Menu Items to Open in New Tab
414 $field_id = 'custom_nav_menu_items_new_tab';
415 $field_slug = 'custom-nav-menu-items-new-tab';
416 add_settings_field(
417 $field_id,
418 // Field ID
419 'Allow Custom Navigation Menu Items to Open in New Tab',
420 // Field title
421 [ $render_field, 'render_checkbox_toggle' ],
422 // Callback to render field with custom arguments in the array below
423 ASENHA_SLUG,
424 // Settings page slug
425 'main-section',
426 // Section ID
427 array(
428 'option_name' => ASENHA_SLUG_U,
429 'field_id' => $field_id,
430 'field_slug' => $field_slug,
431 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
432 'field_description' => 'Allow custom navigation menu items to have links that open in new browser tab via target="_blank" attribute. The rel="noopener noreferrer nofollow" attribute will also be added for enhanced security and SEO benefits. ',
433 'field_options_wrapper' => false,
434 'field_options_moreless' => false,
435 'class' => 'asenha-toggle content-management ' . $field_slug,
436 )
437 );
438 // Enable Auto-Publishing of Posts with Missed Schedules
439 $field_id = 'enable_missed_schedule_posts_auto_publish';
440 $field_slug = 'enable-missed-schedule-posts-auto-publish';
441 add_settings_field(
442 $field_id,
443 // Field ID
444 'Auto-Publish Posts with Missed Schedule',
445 // Field title
446 [ $render_field, 'render_checkbox_toggle' ],
447 // Callback to render field with custom arguments in the array below
448 ASENHA_SLUG,
449 // Settings page slug
450 'main-section',
451 // Section ID
452 array(
453 'option_name' => ASENHA_SLUG_U,
454 'field_id' => $field_id,
455 'field_slug' => $field_slug,
456 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
457 'field_description' => 'Trigger publishing of scheduled posts of all types marked with "missed schedule", anytime the site is visited.',
458 'class' => 'asenha-toggle content-management ' . $field_slug,
459 )
460 );
461 // =================================================================
462 // ADMIN INTERFACE
463 // =================================================================
464 // Hide or Modify Elements / Clean Up Admin Bar
465 $field_id = 'hide_modify_elements';
466 $field_slug = 'hide-modify-elements';
467 add_settings_field(
468 $field_id,
469 // Field ID
470 'Clean Up Admin Bar',
471 // Field title
472 [ $render_field, 'render_checkbox_toggle' ],
473 // Callback to render field with custom arguments in the array below
474 ASENHA_SLUG,
475 // Settings page slug
476 'main-section',
477 // Section ID
478 array(
479 'option_name' => ASENHA_SLUG_U,
480 'field_id' => $field_id,
481 'field_slug' => $field_slug,
482 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
483 'field_description' => 'Remove various elements from the admin bar.',
484 'field_options_wrapper' => true,
485 'field_options_moreless' => true,
486 'class' => 'asenha-toggle admin-interface ' . $field_slug,
487 )
488 );
489 $field_id = 'hide_ab_wp_logo_menu';
490 $field_slug = 'hide-ab-wp-logo-menu';
491 add_settings_field(
492 $field_id,
493 // Field ID
494 '',
495 // Field title
496 [ $render_field, 'render_checkbox_plain' ],
497 // Callback to render field with custom arguments in the array below
498 ASENHA_SLUG,
499 // Settings page slug
500 'main-section',
501 // Section ID
502 array(
503 'option_name' => ASENHA_SLUG_U,
504 'field_id' => $field_id,
505 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
506 'field_label' => 'Remove WordPress logo/menu',
507 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
508 )
509 );
510 $field_id = 'hide_ab_customize_menu';
511 $field_slug = 'hide-ab-customize-menu';
512 add_settings_field(
513 $field_id,
514 // Field ID
515 '',
516 // Field title
517 [ $render_field, 'render_checkbox_plain' ],
518 // Callback to render field with custom arguments in the array below
519 ASENHA_SLUG,
520 // Settings page slug
521 'main-section',
522 // Section ID
523 array(
524 'option_name' => ASENHA_SLUG_U,
525 'field_id' => $field_id,
526 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
527 'field_label' => 'Remove customize menu',
528 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
529 )
530 );
531 $field_id = 'hide_ab_updates_menu';
532 $field_slug = 'hide-ab-updates-menu';
533 add_settings_field(
534 $field_id,
535 // Field ID
536 '',
537 // Field title
538 [ $render_field, 'render_checkbox_plain' ],
539 // Callback to render field with custom arguments in the array below
540 ASENHA_SLUG,
541 // Settings page slug
542 'main-section',
543 // Section ID
544 array(
545 'option_name' => ASENHA_SLUG_U,
546 'field_id' => $field_id,
547 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
548 'field_label' => 'Remove updates counter/link',
549 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
550 )
551 );
552 $field_id = 'hide_ab_comments_menu';
553 $field_slug = 'hide-ab-comments-menu';
554 add_settings_field(
555 $field_id,
556 // Field ID
557 '',
558 // Field title
559 [ $render_field, 'render_checkbox_plain' ],
560 // Callback to render field with custom arguments in the array below
561 ASENHA_SLUG,
562 // Settings page slug
563 'main-section',
564 // Section ID
565 array(
566 'option_name' => ASENHA_SLUG_U,
567 'field_id' => $field_id,
568 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
569 'field_label' => 'Remove comments counter/link',
570 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
571 )
572 );
573 $field_id = 'hide_ab_new_content_menu';
574 $field_slug = 'hide-ab-new-content-menu';
575 add_settings_field(
576 $field_id,
577 // Field ID
578 '',
579 // Field title
580 [ $render_field, 'render_checkbox_plain' ],
581 // Callback to render field with custom arguments in the array below
582 ASENHA_SLUG,
583 // Settings page slug
584 'main-section',
585 // Section ID
586 array(
587 'option_name' => ASENHA_SLUG_U,
588 'field_id' => $field_id,
589 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
590 'field_label' => 'Remove new content menu',
591 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
592 )
593 );
594 $field_id = 'hide_ab_howdy';
595 $field_slug = 'hide-ab-howdy';
596 add_settings_field(
597 $field_id,
598 // Field ID
599 '',
600 // Field title
601 [ $render_field, 'render_checkbox_plain' ],
602 // Callback to render field with custom arguments in the array below
603 ASENHA_SLUG,
604 // Settings page slug
605 'main-section',
606 // Section ID
607 array(
608 'option_name' => ASENHA_SLUG_U,
609 'field_id' => $field_id,
610 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
611 'field_label' => 'Remove \'Howdy\'',
612 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
613 )
614 );
615 $field_id = 'hide_help_drawer';
616 $field_slug = 'hide-help-drawer';
617 add_settings_field(
618 $field_id,
619 // Field ID
620 '',
621 // Field title
622 [ $render_field, 'render_checkbox_plain' ],
623 // Callback to render field with custom arguments in the array below
624 ASENHA_SLUG,
625 // Settings page slug
626 'main-section',
627 // Section ID
628 array(
629 'option_name' => ASENHA_SLUG_U,
630 'field_id' => $field_id,
631 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
632 'field_label' => 'Remove the Help tab and drawer',
633 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
634 )
635 );
636 // Hide Admin Notices
637 $field_id = 'hide_admin_notices';
638 $field_slug = 'hide-admin-notices';
639 $field_options_wrapper = false;
640 $field_options_moreless = false;
641 add_settings_field(
642 $field_id,
643 // Field ID
644 'Hide Admin Notices',
645 // Field title
646 [ $render_field, 'render_checkbox_toggle' ],
647 // Callback to render field with custom arguments in the array below
648 ASENHA_SLUG,
649 // Settings page slug
650 'main-section',
651 // Section ID
652 array(
653 'option_name' => ASENHA_SLUG_U,
654 'field_id' => $field_id,
655 'field_slug' => $field_slug,
656 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
657 'field_description' => 'Clean up admin pages by moving notices into a separate panel easily accessible via the admin bar.',
658 'field_options_wrapper' => $field_options_wrapper,
659 'field_options_moreless' => $field_options_moreless,
660 'class' => 'asenha-toggle admin-interface ' . $field_slug,
661 )
662 );
663 // Disable Dashboard Widgets
664 $field_id = 'disable_dashboard_widgets';
665 $field_slug = 'disable-dashboard-widgets';
666 add_settings_field(
667 $field_id,
668 // Field ID
669 'Disable Dashboard Widgets',
670 // Field title
671 [ $render_field, 'render_checkbox_toggle' ],
672 // Callback to render field with custom arguments in the array below
673 ASENHA_SLUG,
674 // Settings page slug
675 'main-section',
676 // Section ID
677 array(
678 'option_name' => ASENHA_SLUG_U,
679 'field_id' => $field_id,
680 'field_slug' => $field_slug,
681 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
682 'field_description' => 'Clean up and speed up the dashboard by completely disabling some or all widgets. Disabled widgets won\'t load any assets nor show up under Screen Options. ',
683 'field_options_wrapper' => true,
684 'field_options_moreless' => true,
685 'class' => 'asenha-toggle admin-interface ' . $field_slug,
686 )
687 );
688 $field_id = 'disabled_dashboard_widgets';
689 $field_slug = 'disabled-dashboard-widgets';
690
691 if ( array_key_exists( 'dashboard_widgets', $options_extra ) ) {
692 $dashboard_widgets = $options_extra['dashboard_widgets'];
693 } else {
694 $admin_interface = new Admin_Interface();
695 $dashboard_widgets = $admin_interface->get_dashboard_widgets();
696 $options_extra['dashboard_widgets'] = $dashboard_widgets;
697 update_option( 'admin_site_enhancements_extra', $options_extra );
698 }
699
700 foreach ( $dashboard_widgets as $widget ) {
701 add_settings_field(
702 $field_id . '_' . $widget['id'],
703 // Field ID
704 '',
705 // Field title
706 [ $render_field, 'render_checkbox_subfield' ],
707 // Callback to render field with custom arguments in the array below
708 ASENHA_SLUG,
709 // Settings page slug
710 'main-section',
711 // Section ID
712 array(
713 'option_name' => ASENHA_SLUG_U,
714 'parent_field_id' => $field_id,
715 'field_id' => $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'],
716 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'] . ']',
717 'field_label' => $widget['title'] . ' <span class="faded">(' . $widget['id'] . ')</span>',
718 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug . ' ' . $widget['id'],
719 )
720 );
721 }
722 // Hide Admin Bar
723 $field_id = 'hide_admin_bar';
724 $field_slug = 'hide-admin-bar';
725 $field_description = 'Hide admin bar on the frontend for all or some user roles.';
726 add_settings_field(
727 $field_id,
728 // Field ID
729 'Hide Admin Bar',
730 // Field title
731 [ $render_field, 'render_checkbox_toggle' ],
732 // Callback to render field with custom arguments in the array below
733 ASENHA_SLUG,
734 // Settings page slug
735 'main-section',
736 // Section ID
737 array(
738 'option_name' => ASENHA_SLUG_U,
739 'field_id' => $field_id,
740 'field_slug' => $field_slug,
741 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
742 'field_description' => $field_description,
743 'field_options_wrapper' => true,
744 'field_options_moreless' => true,
745 'class' => 'asenha-toggle admin-interface ' . $field_slug,
746 )
747 );
748 $field_id = 'hide_admin_bar_for';
749 $field_slug = 'hide-admin-bar-for';
750 if ( is_array( $roles ) ) {
751 foreach ( $roles as $role_slug => $role_label ) {
752 // e.g. $role_slug is administrator, $role_label is Administrator
753 add_settings_field(
754 $field_id . '_' . $role_slug,
755 // Field ID
756 '',
757 // Field title
758 [ $render_field, 'render_checkbox_subfield' ],
759 // Callback to render field with custom arguments in the array below
760 ASENHA_SLUG,
761 // Settings page slug
762 'main-section',
763 // Section ID
764 array(
765 'option_name' => ASENHA_SLUG_U,
766 'parent_field_id' => $field_id,
767 'field_id' => $role_slug,
768 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
769 'field_label' => $role_label,
770 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug,
771 )
772 );
773 }
774 }
775 // Wider Admin Menu
776 $field_id = 'wider_admin_menu';
777 $field_slug = 'wider-admin-menu';
778 add_settings_field(
779 $field_id,
780 // Field ID
781 'Wider Admin Menu',
782 // Field title
783 [ $render_field, 'render_checkbox_toggle' ],
784 // Callback to render field with custom arguments in the array below
785 ASENHA_SLUG,
786 // Settings page slug
787 'main-section',
788 // Section ID
789 array(
790 'option_name' => ASENHA_SLUG_U,
791 'field_id' => $field_id,
792 'field_slug' => $field_slug,
793 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
794 'field_description' => 'Give the admin menu more room to better accommodate wider items.',
795 'field_options_wrapper' => true,
796 'class' => 'asenha-toggle admin-interface ' . $field_slug,
797 )
798 );
799 $field_id = 'admin_menu_width';
800 $field_slug = 'admin-menu-width';
801 add_settings_field(
802 $field_id,
803 // Field ID
804 '',
805 // Field title
806 [ $render_field, 'render_select_subfield' ],
807 // Callback to render field with custom arguments in the array below
808 ASENHA_SLUG,
809 // Settings page slug
810 'main-section',
811 // Section ID
812 array(
813 'option_name' => ASENHA_SLUG_U,
814 'field_id' => $field_id,
815 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
816 'field_type' => 'with-prefix-suffix',
817 'field_prefix' => 'Set width to',
818 'field_suffix' => '<span class="faded">(Default is 160px)</span>',
819 'field_select_options' => array(
820 '180px' => '180px',
821 '200px' => '200px',
822 '220px' => '220px',
823 '240px' => '240px',
824 '260px' => '260px',
825 '280px' => '280px',
826 '300px' => '300px',
827 ),
828 'field_select_default' => 200,
829 'field_intro' => '',
830 'field_description' => '',
831 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up admin-interface ' . $field_slug,
832 'display_none_on_load' => true,
833 )
834 );
835 // Admin Menu Organizer
836 $field_id = 'customize_admin_menu';
837 $field_slug = 'customize-admin-menu';
838 add_settings_field(
839 $field_id,
840 // Field ID
841 'Admin Menu Organizer',
842 // Field title
843 [ $render_field, 'render_checkbox_toggle' ],
844 // Callback to render field with custom arguments in the array below
845 ASENHA_SLUG,
846 // Settings page slug
847 'main-section',
848 // Section ID
849 array(
850 'option_name' => ASENHA_SLUG_U,
851 'field_id' => $field_id,
852 'field_slug' => $field_slug,
853 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
854 'field_description' => 'Customize the order of the admin menu and optionally change menu item title or hide some items.',
855 'field_options_wrapper' => true,
856 'field_options_moreless' => true,
857 'class' => 'asenha-toggle admin-interface ' . $field_slug,
858 )
859 );
860 $field_id = 'custom_menu_order';
861 $field_slug = 'custom-menu-order';
862 add_settings_field(
863 $field_id,
864 // Field ID
865 '',
866 // Field title
867 [ $render_field, 'render_sortable_menu' ],
868 // Callback to render field with custom arguments in the array below
869 ASENHA_SLUG,
870 // Settings page slug
871 'main-section',
872 // Section ID
873 array(
874 'option_name' => ASENHA_SLUG_U,
875 'field_id' => $field_id,
876 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
877 'field_type' => 'sortable-menu',
878 'field_description' => '',
879 'class' => 'asenha-sortable asenha-hide-th admin-interface ' . $field_slug,
880 )
881 );
882 // Enhance List Tables
883 $field_id = 'enhance_list_tables';
884 $field_slug = 'enhance-list-tables';
885 add_settings_field(
886 $field_id,
887 // Field ID
888 'Enhance List Tables',
889 // Field title
890 [ $render_field, 'render_checkbox_toggle' ],
891 // Callback to render field with custom arguments in the array below
892 ASENHA_SLUG,
893 // Settings page slug
894 'main-section',
895 // Section ID
896 array(
897 'option_name' => ASENHA_SLUG_U,
898 'field_id' => $field_id,
899 'field_slug' => $field_slug,
900 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
901 'field_description' => 'Improve the usefulness of listing pages for various post types and taxonomies, media, comments and users by adding / removing columns and elements.',
902 'field_options_wrapper' => true,
903 'field_options_moreless' => true,
904 'class' => 'asenha-toggle content-management ' . $field_slug,
905 )
906 );
907 // Show Featured Image Column
908 $field_id = 'show_featured_image_column';
909 $field_slug = 'show-featured-image-column';
910 add_settings_field(
911 $field_id,
912 // Field ID
913 '',
914 // Field title
915 [ $render_field, 'render_checkbox_plain' ],
916 // Callback to render field with custom arguments in the array below
917 ASENHA_SLUG,
918 // Settings page slug
919 'main-section',
920 // Section ID
921 array(
922 'option_name' => ASENHA_SLUG_U,
923 'field_id' => $field_id,
924 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
925 'field_label' => 'Show featured image column',
926 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
927 )
928 );
929 // Show Excerpt Column
930 $field_id = 'show_excerpt_column';
931 $field_slug = 'show-excerpt-column';
932 add_settings_field(
933 $field_id,
934 // Field ID
935 '',
936 // Field title
937 [ $render_field, 'render_checkbox_plain' ],
938 // Callback to render field with custom arguments in the array below
939 ASENHA_SLUG,
940 // Settings page slug
941 'main-section',
942 // Section ID
943 array(
944 'option_name' => ASENHA_SLUG_U,
945 'field_id' => $field_id,
946 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
947 'field_label' => 'Show excerpt column',
948 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
949 )
950 );
951 // Show ID Column
952 $field_id = 'show_id_column';
953 $field_slug = 'show-id-column';
954 add_settings_field(
955 $field_id,
956 // Field ID
957 '',
958 // Field title
959 [ $render_field, 'render_checkbox_plain' ],
960 // Callback to render field with custom arguments in the array below
961 ASENHA_SLUG,
962 // Settings page slug
963 'main-section',
964 // Section ID
965 array(
966 'option_name' => ASENHA_SLUG_U,
967 'field_id' => $field_id,
968 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
969 'field_label' => 'Show ID column',
970 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
971 )
972 );
973 // Show ID in Action Row
974 $field_id = 'show_id_in_action_row';
975 $field_slug = 'show-id-in-action_row';
976 add_settings_field(
977 $field_id,
978 // Field ID
979 '',
980 // Field title
981 [ $render_field, 'render_checkbox_plain' ],
982 // Callback to render field with custom arguments in the array below
983 ASENHA_SLUG,
984 // Settings page slug
985 'main-section',
986 // Section ID
987 array(
988 'option_name' => ASENHA_SLUG_U,
989 'field_id' => $field_id,
990 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
991 'field_label' => 'Show ID in action rows along with links for Edit, View, etc.',
992 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
993 )
994 );
995 // Show Custom Taxonomy Filters
996 $field_id = 'show_custom_taxonomy_filters';
997 $field_slug = 'show-custom-taxonomy-filters';
998 add_settings_field(
999 $field_id,
1000 // Field ID
1001 '',
1002 // Field title
1003 [ $render_field, 'render_checkbox_plain' ],
1004 // Callback to render field with custom arguments in the array below
1005 ASENHA_SLUG,
1006 // Settings page slug
1007 'main-section',
1008 // Section ID
1009 array(
1010 'option_name' => ASENHA_SLUG_U,
1011 'field_id' => $field_id,
1012 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1013 'field_label' => 'Show additional filter(s) for hierarchical, custom taxonomies',
1014 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1015 )
1016 );
1017 // Hide Comments Column
1018 $field_id = 'hide_comments_column';
1019 $field_slug = 'hide-comments-column';
1020 add_settings_field(
1021 $field_id,
1022 // Field ID
1023 '',
1024 // Field title
1025 [ $render_field, 'render_checkbox_plain' ],
1026 // Callback to render field with custom arguments in the array below
1027 ASENHA_SLUG,
1028 // Settings page slug
1029 'main-section',
1030 // Section ID
1031 array(
1032 'option_name' => ASENHA_SLUG_U,
1033 'field_id' => $field_id,
1034 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1035 'field_label' => 'Remove comments column',
1036 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1037 )
1038 );
1039 // Hide Post Tags Column
1040 $field_id = 'hide_post_tags_column';
1041 $field_slug = 'hide-post-tags-column';
1042 add_settings_field(
1043 $field_id,
1044 // Field ID
1045 '',
1046 // Field title
1047 [ $render_field, 'render_checkbox_plain' ],
1048 // Callback to render field with custom arguments in the array below
1049 ASENHA_SLUG,
1050 // Settings page slug
1051 'main-section',
1052 // Section ID
1053 array(
1054 'option_name' => ASENHA_SLUG_U,
1055 'field_id' => $field_id,
1056 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1057 'field_label' => 'Remove tags column (for posts)',
1058 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1059 )
1060 );
1061 // Display Active Plugins First
1062 $field_id = 'display_active_plugins_first';
1063 $field_slug = 'display-active-plugins-first';
1064 add_settings_field(
1065 $field_id,
1066 // Field ID
1067 'Display Active Plugins First',
1068 // Field title
1069 [ $render_field, 'render_checkbox_toggle' ],
1070 // Callback to render field with custom arguments in the array below
1071 ASENHA_SLUG,
1072 // Settings page slug
1073 'main-section',
1074 // Section ID
1075 array(
1076 'option_name' => ASENHA_SLUG_U,
1077 'field_id' => $field_id,
1078 'field_slug' => $field_slug,
1079 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1080 'field_description' => 'Display active / activated plugins at the top of the Installed Plugins list. Useful when your site has many deactivated plugins for testing or development purposes.',
1081 'class' => 'asenha-toggle content-management ' . $field_slug,
1082 )
1083 );
1084 // Custom Admin Footer Text
1085 $field_id = 'custom_admin_footer_text';
1086 $field_slug = 'custom-admin-footer-text';
1087 add_settings_field(
1088 $field_id,
1089 // Field ID
1090 'Custom Admin Footer Text',
1091 // Field title
1092 [ $render_field, 'render_checkbox_toggle' ],
1093 // Callback to render field with custom arguments in the array below
1094 ASENHA_SLUG,
1095 // Settings page slug
1096 'main-section',
1097 // Section ID
1098 array(
1099 'option_name' => ASENHA_SLUG_U,
1100 'field_id' => $field_id,
1101 'field_slug' => $field_slug,
1102 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1103 'field_description' => 'Customize the text you see on the footer of wp-admin pages other than this ASE settings page.',
1104 'field_options_wrapper' => true,
1105 'field_options_moreless' => true,
1106 'class' => 'asenha-toggle utilities ' . $field_slug,
1107 )
1108 );
1109 $field_id = 'custom_admin_footer_left';
1110 $field_slug = 'custom-admin-footer-left';
1111 add_settings_field(
1112 $field_id,
1113 // Field ID
1114 'Left Side',
1115 // Field title
1116 [ $render_field, 'render_wpeditor_subfield' ],
1117 // Callback to render field with custom arguments in the array below
1118 ASENHA_SLUG,
1119 // Settings page slug
1120 'main-section',
1121 // Section ID
1122 array(
1123 'option_name' => ASENHA_SLUG_U,
1124 'field_id' => $field_id,
1125 'field_slug' => $field_slug,
1126 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1127 'field_type' => 'textarea',
1128 'field_rows' => 3,
1129 'field_intro' => '',
1130 'field_description' => 'Default text is: <em>Thank you for creating with <a href="https://wordpress.org/">WordPress</a></em>.',
1131 'field_placeholder' => '',
1132 'class' => 'asenha-textarea utilities ' . $field_slug,
1133 )
1134 );
1135 $field_id = 'custom_admin_footer_right';
1136 $field_slug = 'custom-admin-footer-right';
1137 add_settings_field(
1138 $field_id,
1139 // Field ID
1140 'Right Side',
1141 // Field title
1142 [ $render_field, 'render_wpeditor_subfield' ],
1143 // Callback to render field with custom arguments in the array below
1144 ASENHA_SLUG,
1145 // Settings page slug
1146 'main-section',
1147 // Section ID
1148 array(
1149 'option_name' => ASENHA_SLUG_U,
1150 'field_id' => $field_id,
1151 'field_slug' => $field_slug,
1152 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1153 'field_type' => 'textarea',
1154 'field_rows' => 1,
1155 'field_intro' => '',
1156 'field_description' => 'Default text is: <em>Version ' . $wp_version . '</em>',
1157 'field_placeholder' => '',
1158 'class' => 'asenha-textarea utilities ' . $field_slug,
1159 )
1160 );
1161 // =================================================================
1162 // LOG IN | LOG OUT
1163 // =================================================================
1164 // Change Login URL
1165 $field_id = 'change_login_url';
1166 $field_slug = 'change-login-url';
1167 add_settings_field(
1168 $field_id,
1169 // Field ID
1170 'Change Login URL',
1171 // Field title
1172 [ $render_field, 'render_checkbox_toggle' ],
1173 // Callback to render field with custom arguments in the array below
1174 ASENHA_SLUG,
1175 // Settings page slug
1176 'main-section',
1177 // Section ID
1178 array(
1179 'option_name' => ASENHA_SLUG_U,
1180 'field_id' => $field_id,
1181 'field_slug' => $field_slug,
1182 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1183 'field_description' => 'Default is ' . get_site_url() . '/wp-login.php',
1184 'field_options_moreless' => true,
1185 'field_options_wrapper' => true,
1186 'class' => 'asenha-toggle login-logout ' . $field_slug,
1187 )
1188 );
1189 $field_id = 'custom_login_slug';
1190 $field_slug = 'custom-login-slug';
1191 add_settings_field(
1192 $field_id,
1193 // Field ID
1194 'New login URL:',
1195 // Field title
1196 [ $render_field, 'render_text_subfield' ],
1197 // Callback to render field with custom arguments in the array below
1198 ASENHA_SLUG,
1199 // Settings page slug
1200 'main-section',
1201 // Section ID
1202 array(
1203 'option_name' => ASENHA_SLUG_U,
1204 'field_id' => $field_id,
1205 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1206 'field_type' => 'with-prefix-suffix',
1207 'field_prefix' => get_site_url() . '/',
1208 'field_suffix' => '',
1209 'field_description' => '',
1210 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug,
1211 )
1212 );
1213 $field_id = 'change_login_url_description';
1214 $field_slug = 'change-login-url-description';
1215 add_settings_field(
1216 $field_id,
1217 // Field ID
1218 '',
1219 // Field title
1220 [ $render_field, 'render_description_subfield' ],
1221 // Callback to render field with custom arguments in the array below
1222 ASENHA_SLUG,
1223 // Settings page slug
1224 'main-section',
1225 // Section ID
1226 array(
1227 'option_name' => ASENHA_SLUG_U,
1228 'field_description' => '<div class="asenha-warning">This feature <strong>only works for/with the default WordPress login page</strong>. It does not support using custom login page you manually created with a page builder or with another plugin.<br /><br />It\'s also <strong>not yet compatible with two-factor authentication (2FA) methods</strong>. If you use a 2FA plugin, please use the change login URL feature bundled in that plugin, or use another plugin that is compatible with it.<br /><br />And obviously, to improve security, please <strong>use something other than \'login\'</strong> for the custom login slug.</div>',
1229 'class' => 'asenha-description login-logout ' . $field_slug,
1230 )
1231 );
1232 // Login ID Type
1233 $field_id = 'login_id_type_restriction';
1234 $field_slug = 'login-id-type-restriction';
1235 add_settings_field(
1236 $field_id,
1237 // Field ID
1238 'Login ID Type',
1239 // Field title
1240 [ $render_field, 'render_checkbox_toggle' ],
1241 // Callback to render field with custom arguments in the array below
1242 ASENHA_SLUG,
1243 // Settings page slug
1244 'main-section',
1245 // Section ID
1246 array(
1247 'option_name' => ASENHA_SLUG_U,
1248 'field_id' => $field_id,
1249 'field_slug' => $field_slug,
1250 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1251 'field_description' => 'Restrict login ID to username or email address only.',
1252 'field_options_wrapper' => true,
1253 'class' => 'asenha-toggle login-logout ' . $field_slug,
1254 )
1255 );
1256 $field_id = 'login_id_type';
1257 $field_slug = 'login-id-type';
1258 add_settings_field(
1259 $field_id,
1260 // Field ID
1261 '',
1262 // Field title
1263 [ $render_field, 'render_radio_buttons_subfield' ],
1264 // Callback to render field with custom arguments in the array below
1265 ASENHA_SLUG,
1266 // Settings page slug
1267 'main-section',
1268 // Section ID
1269 array(
1270 'option_name' => ASENHA_SLUG_U,
1271 'field_id' => $field_id,
1272 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1273 'field_radios' => array(
1274 'Username only' => 'username',
1275 'Email address only' => 'email',
1276 ),
1277 'field_default' => 'username',
1278 'class' => 'asenha-radio-buttons shift-up login-logout ' . $field_slug,
1279 )
1280 );
1281 // Use Site Identity on the Login Page
1282 $field_id = 'site_identity_on_login';
1283 $field_slug = 'site-identity-on-login';
1284 add_settings_field(
1285 $field_id,
1286 // Field ID
1287 'Site Identity on Login Page',
1288 // Field title
1289 [ $render_field, 'render_checkbox_toggle' ],
1290 // Callback to render field with custom arguments in the array below
1291 ASENHA_SLUG,
1292 // Settings page slug
1293 'main-section',
1294 // Section ID
1295 array(
1296 'option_name' => ASENHA_SLUG_U,
1297 'field_id' => $field_id,
1298 'field_slug' => $field_slug,
1299 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1300 'field_description' => 'Use the site icon and URL to replace the default WordPress logo with link to wordpress.org on the login page. Go to the <a href="' . get_admin_url() . 'customize.php">customizer</a> to set or change your site icon.',
1301 'field_options_wrapper' => true,
1302 'class' => 'asenha-toggle login-logout ' . $field_slug,
1303 )
1304 );
1305 // Enable Log In/Out Menu
1306 $field_id = 'enable_login_logout_menu';
1307 $field_slug = 'enable-login-logout-menu';
1308 add_settings_field(
1309 $field_id,
1310 // Field ID
1311 'Log In/Out Menu',
1312 // Field title
1313 [ $render_field, 'render_checkbox_toggle' ],
1314 // Callback to render field with custom arguments in the array below
1315 ASENHA_SLUG,
1316 // Settings page slug
1317 'main-section',
1318 // Section ID
1319 array(
1320 'option_name' => ASENHA_SLUG_U,
1321 'field_id' => $field_id,
1322 'field_slug' => $field_slug,
1323 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1324 'field_description' => 'Enable log in, log out and dynamic log in/out menu item for addition to any menu.',
1325 'field_options_wrapper' => true,
1326 'field_options_moreless' => true,
1327 'class' => 'asenha-toggle login-logout ' . $field_slug,
1328 )
1329 );
1330 // Enable Last Login Column
1331 $field_id = 'enable_last_login_column';
1332 $field_slug = 'enable-last-login-column';
1333 add_settings_field(
1334 $field_id,
1335 // Field ID
1336 'Last Login Column',
1337 // Field title
1338 [ $render_field, 'render_checkbox_toggle' ],
1339 // Callback to render field with custom arguments in the array below
1340 ASENHA_SLUG,
1341 // Settings page slug
1342 'main-section',
1343 // Section ID
1344 array(
1345 'option_name' => ASENHA_SLUG_U,
1346 'field_id' => $field_id,
1347 'field_slug' => $field_slug,
1348 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1349 'field_description' => 'Log when users on the site last logged in and display the date and time in the users list table.',
1350 'field_options_wrapper' => true,
1351 'field_options_moreless' => true,
1352 'class' => 'asenha-toggle login-logout ' . $field_slug,
1353 )
1354 );
1355 // Redirect After Login
1356 $field_id = 'redirect_after_login';
1357 $field_slug = 'redirect-after-login';
1358 add_settings_field(
1359 $field_id,
1360 // Field ID
1361 'Redirect After Login',
1362 // Field title
1363 [ $render_field, 'render_checkbox_toggle' ],
1364 // Callback to render field with custom arguments in the array below
1365 ASENHA_SLUG,
1366 // Settings page slug
1367 'main-section',
1368 // Section ID
1369 array(
1370 'option_name' => ASENHA_SLUG_U,
1371 'field_id' => $field_id,
1372 'field_slug' => $field_slug,
1373 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1374 'field_description' => 'Set custom redirect URL for all or some user roles after login.',
1375 'field_options_wrapper' => true,
1376 'field_options_moreless' => true,
1377 'class' => 'asenha-toggle login-logout ' . $field_slug,
1378 )
1379 );
1380 $field_id = 'redirect_after_login_to_slug';
1381 $field_slug = 'redirect-after-login-to-slug';
1382 add_settings_field(
1383 $field_id,
1384 // Field ID
1385 'Redirect to:',
1386 // Field title
1387 [ $render_field, 'render_text_subfield' ],
1388 // Callback to render field with custom arguments in the array below
1389 ASENHA_SLUG,
1390 // Settings page slug
1391 'main-section',
1392 // Section ID
1393 array(
1394 'option_name' => ASENHA_SLUG_U,
1395 'field_id' => $field_id,
1396 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1397 'field_type' => 'with-prefix-suffix',
1398 'field_prefix' => get_site_url() . '/',
1399 'field_suffix' => ' for:',
1400 'field_description' => '',
1401 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug,
1402 )
1403 );
1404 $field_id = 'redirect_after_login_for';
1405 $field_slug = 'redirect-after-login-for';
1406 if ( is_array( $roles ) ) {
1407 foreach ( $roles as $role_slug => $role_label ) {
1408 // e.g. $role_slug is administrator, $role_label is Administrator
1409 add_settings_field(
1410 $field_id . '_' . $role_slug,
1411 // Field ID
1412 '',
1413 // Field title
1414 [ $render_field, 'render_checkbox_subfield' ],
1415 // Callback to render field with custom arguments in the array below
1416 ASENHA_SLUG,
1417 // Settings page slug
1418 'main-section',
1419 // Section ID
1420 array(
1421 'option_name' => ASENHA_SLUG_U,
1422 'parent_field_id' => $field_id,
1423 'field_id' => $role_slug,
1424 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
1425 'field_label' => $role_label,
1426 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug,
1427 )
1428 );
1429 }
1430 }
1431 // Redirect After Logout
1432 $field_id = 'redirect_after_logout';
1433 $field_slug = 'redirect-after-logout';
1434 add_settings_field(
1435 $field_id,
1436 // Field ID
1437 'Redirect After Logout',
1438 // Field title
1439 [ $render_field, 'render_checkbox_toggle' ],
1440 // Callback to render field with custom arguments in the array below
1441 ASENHA_SLUG,
1442 // Settings page slug
1443 'main-section',
1444 // Section ID
1445 array(
1446 'option_name' => ASENHA_SLUG_U,
1447 'field_id' => $field_id,
1448 'field_slug' => $field_slug,
1449 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1450 'field_description' => 'Set custom redirect URL for all or some user roles after logout.',
1451 'field_options_wrapper' => true,
1452 'field_options_moreless' => true,
1453 'class' => 'asenha-toggle login-logout ' . $field_slug,
1454 )
1455 );
1456 $field_id = 'redirect_after_logout_to_slug';
1457 $field_slug = 'redirect-after-logout-to-slug';
1458 add_settings_field(
1459 $field_id,
1460 // Field ID
1461 'Redirect to:',
1462 // Field title
1463 [ $render_field, 'render_text_subfield' ],
1464 // Callback to render field with custom arguments in the array below
1465 ASENHA_SLUG,
1466 // Settings page slug
1467 'main-section',
1468 // Section ID
1469 array(
1470 'option_name' => ASENHA_SLUG_U,
1471 'field_id' => $field_id,
1472 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1473 'field_type' => 'with-prefix-suffix',
1474 'field_prefix' => get_site_url() . '/',
1475 'field_suffix' => ' for:',
1476 'field_description' => '',
1477 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug,
1478 )
1479 );
1480 $field_id = 'redirect_after_logout_for';
1481 $field_slug = 'redirect-after-logout-for';
1482 if ( is_array( $roles ) ) {
1483 foreach ( $roles as $role_slug => $role_label ) {
1484 // e.g. $role_slug is administrator, $role_label is Administrator
1485 add_settings_field(
1486 $field_id . '_' . $role_slug,
1487 // Field ID
1488 '',
1489 // Field title
1490 [ $render_field, 'render_checkbox_subfield' ],
1491 // Callback to render field with custom arguments in the array below
1492 ASENHA_SLUG,
1493 // Settings page slug
1494 'main-section',
1495 // Section ID
1496 array(
1497 'option_name' => ASENHA_SLUG_U,
1498 'parent_field_id' => $field_id,
1499 'field_id' => $role_slug,
1500 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
1501 'field_label' => $role_label,
1502 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug,
1503 )
1504 );
1505 }
1506 }
1507 // Enable Custom Admin CSS
1508 $field_id = 'enable_custom_admin_css';
1509 $field_slug = 'enable-custom-admin-css';
1510 add_settings_field(
1511 $field_id,
1512 // Field ID
1513 'Custom Admin CSS',
1514 // Field title
1515 [ $render_field, 'render_checkbox_toggle' ],
1516 // Callback to render field with custom arguments in the array below
1517 ASENHA_SLUG,
1518 // Settings page slug
1519 'main-section',
1520 // Section ID
1521 array(
1522 'option_name' => ASENHA_SLUG_U,
1523 'field_id' => $field_id,
1524 'field_slug' => $field_slug,
1525 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1526 'field_description' => 'Add custom CSS on all admin pages for all user roles.',
1527 'field_options_wrapper' => true,
1528 'field_options_moreless' => true,
1529 'class' => 'asenha-toggle custom-code ' . $field_slug,
1530 )
1531 );
1532 $field_id = 'custom_admin_css';
1533 $field_slug = 'custom-admin-css';
1534 add_settings_field(
1535 $field_id,
1536 // Field ID
1537 '',
1538 // Field title
1539 [ $render_field, 'render_textarea_subfield' ],
1540 // Callback to render field with custom arguments in the array below
1541 ASENHA_SLUG,
1542 // Settings page slug
1543 'main-section',
1544 // Section ID
1545 array(
1546 'option_name' => ASENHA_SLUG_U,
1547 'field_id' => $field_id,
1548 'field_slug' => $field_slug,
1549 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1550 'field_type' => 'textarea',
1551 'field_rows' => 30,
1552 'field_intro' => '',
1553 'field_description' => '',
1554 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1555 )
1556 );
1557 // Enable Custom Frontend CSS
1558 $field_id = 'enable_custom_frontend_css';
1559 $field_slug = 'enable-custom-frontend-css';
1560 add_settings_field(
1561 $field_id,
1562 // Field ID
1563 'Custom Frontend CSS',
1564 // Field title
1565 [ $render_field, 'render_checkbox_toggle' ],
1566 // Callback to render field with custom arguments in the array below
1567 ASENHA_SLUG,
1568 // Settings page slug
1569 'main-section',
1570 // Section ID
1571 array(
1572 'option_name' => ASENHA_SLUG_U,
1573 'field_id' => $field_id,
1574 'field_slug' => $field_slug,
1575 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1576 'field_description' => 'Add custom CSS on all frontend pages for all user roles.',
1577 'field_options_wrapper' => true,
1578 'field_options_moreless' => true,
1579 'class' => 'asenha-toggle custom-code ' . $field_slug,
1580 )
1581 );
1582 $field_id = 'custom_frontend_css';
1583 $field_slug = 'custom-frontend-css';
1584 add_settings_field(
1585 $field_id,
1586 // Field ID
1587 '',
1588 // Field title
1589 [ $render_field, 'render_textarea_subfield' ],
1590 // Callback to render field with custom arguments in the array below
1591 ASENHA_SLUG,
1592 // Settings page slug
1593 'main-section',
1594 // Section ID
1595 array(
1596 'option_name' => ASENHA_SLUG_U,
1597 'field_id' => $field_id,
1598 'field_slug' => $field_slug,
1599 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1600 'field_type' => 'textarea',
1601 'field_rows' => 30,
1602 'field_intro' => '',
1603 'field_description' => '',
1604 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1605 )
1606 );
1607 // Custom Body Class
1608 $field_id = 'enable_custom_body_class';
1609 $field_slug = 'enable-custom-body-class';
1610 add_settings_field(
1611 $field_id,
1612 // Field ID
1613 'Custom Body Class',
1614 // Field title
1615 [ $render_field, 'render_checkbox_toggle' ],
1616 // Callback to render field with custom arguments in the array below
1617 ASENHA_SLUG,
1618 // Settings page slug
1619 'main-section',
1620 // Section ID
1621 array(
1622 'option_name' => ASENHA_SLUG_U,
1623 'field_id' => $field_id,
1624 'field_slug' => $field_slug,
1625 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1626 'field_description' => 'Add custom &lt;body&gt; class(es) on the singular view of some or all public post types. Compatible with classes already added using <a href="https://wordpress.org/plugins/wp-custom-body-class" target="_blank">Custom Body Class plugin</a>.',
1627 'field_options_wrapper' => true,
1628 'field_options_moreless' => true,
1629 'class' => 'asenha-toggle custom-code ' . $field_slug,
1630 )
1631 );
1632 $field_id = 'enable_custom_body_class_for';
1633 $field_slug = 'enable-custom-body-class-for';
1634 if ( is_array( $asenha_public_post_types ) ) {
1635 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
1636 // e.g. $post_type_slug is post, $post_type_label is Posts
1637 if ( 'attachment' != $post_type_slug ) {
1638 add_settings_field(
1639 $field_id . '_' . $post_type_slug,
1640 // Field ID
1641 '',
1642 // Field title
1643 [ $render_field, 'render_checkbox_subfield' ],
1644 // Callback to render field with custom arguments in the array below
1645 ASENHA_SLUG,
1646 // Settings page slug
1647 'main-section',
1648 // Section ID
1649 array(
1650 'option_name' => ASENHA_SLUG_U,
1651 'parent_field_id' => $field_id,
1652 'field_id' => $post_type_slug,
1653 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
1654 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
1655 'class' => 'asenha-checkbox asenha-hide-th asenha-half custom-code ' . $field_slug . ' ' . $post_type_slug,
1656 )
1657 );
1658 }
1659 }
1660 }
1661 // Manage ads.txt and app-ads.txt
1662 $field_id = 'manage_ads_appads_txt';
1663 $field_slug = 'manage-ads-appads-txt';
1664 add_settings_field(
1665 $field_id,
1666 // Field ID
1667 'Manage ads.txt and app-ads.txt',
1668 // Field title
1669 [ $render_field, 'render_checkbox_toggle' ],
1670 // Callback to render field with custom arguments in the array below
1671 ASENHA_SLUG,
1672 // Settings page slug
1673 'main-section',
1674 // Section ID
1675 array(
1676 'option_name' => ASENHA_SLUG_U,
1677 'field_id' => $field_id,
1678 'field_slug' => $field_slug,
1679 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1680 '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.',
1681 'field_options_wrapper' => true,
1682 'field_options_moreless' => true,
1683 'class' => 'asenha-toggle custom-code ' . $field_slug,
1684 )
1685 );
1686 $field_id = 'ads_txt_content';
1687 $field_slug = 'ads-txt-content';
1688 add_settings_field(
1689 $field_id,
1690 // Field ID
1691 '',
1692 // Field title
1693 [ $render_field, 'render_textarea_subfield' ],
1694 // Callback to render field with custom arguments in the array below
1695 ASENHA_SLUG,
1696 // Settings page slug
1697 'main-section',
1698 // Section ID
1699 array(
1700 'option_name' => ASENHA_SLUG_U,
1701 'field_id' => $field_id,
1702 'field_slug' => $field_slug,
1703 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1704 'field_type' => 'textarea',
1705 'field_rows' => 15,
1706 'field_intro' => '<strong>Your ads.txt content:</strong>',
1707 '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>',
1708 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1709 )
1710 );
1711 $field_id = 'app_ads_txt_content';
1712 $field_slug = 'app-ads-txt-content';
1713 add_settings_field(
1714 $field_id,
1715 // Field ID
1716 '',
1717 // Field title
1718 [ $render_field, 'render_textarea_subfield' ],
1719 // Callback to render field with custom arguments in the array below
1720 ASENHA_SLUG,
1721 // Settings page slug
1722 'main-section',
1723 // Section ID
1724 array(
1725 'option_name' => ASENHA_SLUG_U,
1726 'field_id' => $field_id,
1727 'field_slug' => $field_slug,
1728 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1729 'field_type' => 'textarea',
1730 'field_rows' => 15,
1731 'field_intro' => '<strong>Your app-ads.txt content:</strong>',
1732 '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>',
1733 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1734 )
1735 );
1736 // Manage robots.txt
1737 $field_id = 'manage_robots_txt';
1738 $field_slug = 'manage-robots-txt';
1739 add_settings_field(
1740 $field_id,
1741 // Field ID
1742 'Manage robots.txt',
1743 // Field title
1744 [ $render_field, 'render_checkbox_toggle' ],
1745 // Callback to render field with custom arguments in the array below
1746 ASENHA_SLUG,
1747 // Settings page slug
1748 'main-section',
1749 // Section ID
1750 array(
1751 'option_name' => ASENHA_SLUG_U,
1752 'field_id' => $field_id,
1753 'field_slug' => $field_slug,
1754 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1755 'field_description' => 'Easily edit and validate your <a href="/robots.txt" target="_blank">robots.txt</a> content.',
1756 'field_options_wrapper' => true,
1757 'field_options_moreless' => true,
1758 'class' => 'asenha-toggle custom-code ' . $field_slug,
1759 )
1760 );
1761 $field_id = 'robots_txt_content';
1762 $field_slug = 'robots-txt-content';
1763 add_settings_field(
1764 $field_id,
1765 // Field ID
1766 '',
1767 // Field title
1768 [ $render_field, 'render_textarea_subfield' ],
1769 // Callback to render field with custom arguments in the array below
1770 ASENHA_SLUG,
1771 // Settings page slug
1772 'main-section',
1773 // Section ID
1774 array(
1775 'option_name' => ASENHA_SLUG_U,
1776 'field_id' => $field_id,
1777 'field_slug' => $field_slug,
1778 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1779 'field_type' => 'textarea',
1780 'field_rows' => 20,
1781 'field_intro' => '',
1782 '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>',
1783 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1784 )
1785 );
1786 // Insert <head>, <body> and <footer> code
1787 $field_id = 'insert_head_body_footer_code';
1788 $field_slug = 'insert-head-body-footer-code';
1789 add_settings_field(
1790 $field_id,
1791 // Field ID
1792 'Insert &lt;head&gt;, &lt;body&gt; and &lt;footer&gt; Code',
1793 // Field title
1794 [ $render_field, 'render_checkbox_toggle' ],
1795 // Callback to render field with custom arguments in the array below
1796 ASENHA_SLUG,
1797 // Settings page slug
1798 'main-section',
1799 // Section ID
1800 array(
1801 'option_name' => ASENHA_SLUG_U,
1802 'field_id' => $field_id,
1803 'field_slug' => $field_slug,
1804 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1805 '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.',
1806 'field_options_wrapper' => true,
1807 'field_options_moreless' => true,
1808 'class' => 'asenha-toggle custom-code ' . $field_slug,
1809 )
1810 );
1811 $field_id = 'head_code_priority';
1812 $field_slug = 'head-code-priority';
1813 add_settings_field(
1814 $field_id,
1815 // Field ID
1816 '',
1817 // Field title
1818 [ $render_field, 'render_number_subfield' ],
1819 // Callback to render field with custom arguments in the array below
1820 ASENHA_SLUG,
1821 // Settings page slug
1822 'main-section',
1823 // Section ID
1824 array(
1825 'option_name' => ASENHA_SLUG_U,
1826 'field_id' => $field_id,
1827 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1828 'field_type' => 'with-prefix-suffix',
1829 'field_prefix' => '<strong>Code to insert before &lt;/head&gt; with the priority of</strong>',
1830 'field_suffix' => '',
1831 'field_intro' => '',
1832 'field_description' => 'Default is 10. Larger number insert code closer to &lt;/head&gt;',
1833 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug,
1834 )
1835 );
1836 $field_id = 'head_code';
1837 $field_slug = 'head-code';
1838 add_settings_field(
1839 $field_id,
1840 // Field ID
1841 '',
1842 // Field title
1843 [ $render_field, 'render_textarea_subfield' ],
1844 // Callback to render field with custom arguments in the array below
1845 ASENHA_SLUG,
1846 // Settings page slug
1847 'main-section',
1848 // Section ID
1849 array(
1850 'option_name' => ASENHA_SLUG_U,
1851 'field_id' => $field_id,
1852 'field_slug' => $field_slug,
1853 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1854 'field_type' => 'textarea',
1855 'field_rows' => 15,
1856 'field_intro' => '',
1857 'field_description' => '',
1858 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1859 )
1860 );
1861 $field_id = 'body_code_priority';
1862 $field_slug = 'body-code-priority';
1863 add_settings_field(
1864 $field_id,
1865 // Field ID
1866 '',
1867 // Field title
1868 [ $render_field, 'render_number_subfield' ],
1869 // Callback to render field with custom arguments in the array below
1870 ASENHA_SLUG,
1871 // Settings page slug
1872 'main-section',
1873 // Section ID
1874 array(
1875 'option_name' => ASENHA_SLUG_U,
1876 'field_id' => $field_id,
1877 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1878 'field_type' => 'with-prefix-suffix',
1879 'field_prefix' => '<strong>Code to insert after &lt;body&gt; with the priority of</strong>',
1880 'field_suffix' => '',
1881 'field_intro' => '',
1882 'field_description' => 'Default is 10. Smaller number insert code closer to &lt;body&gt;',
1883 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug,
1884 )
1885 );
1886 $field_id = 'body_code';
1887 $field_slug = 'body-code';
1888 add_settings_field(
1889 $field_id,
1890 // Field ID
1891 '',
1892 // Field title
1893 [ $render_field, 'render_textarea_subfield' ],
1894 // Callback to render field with custom arguments in the array below
1895 ASENHA_SLUG,
1896 // Settings page slug
1897 'main-section',
1898 // Section ID
1899 array(
1900 'option_name' => ASENHA_SLUG_U,
1901 'field_id' => $field_id,
1902 'field_slug' => $field_slug,
1903 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1904 'field_type' => 'textarea',
1905 'field_rows' => 15,
1906 'field_intro' => '',
1907 'field_description' => '',
1908 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1909 )
1910 );
1911 $field_id = 'footer_code_priority';
1912 $field_slug = 'footer-code-priority';
1913 add_settings_field(
1914 $field_id,
1915 // Field ID
1916 '',
1917 // Field title
1918 [ $render_field, 'render_number_subfield' ],
1919 // Callback to render field with custom arguments in the array below
1920 ASENHA_SLUG,
1921 // Settings page slug
1922 'main-section',
1923 // Section ID
1924 array(
1925 'option_name' => ASENHA_SLUG_U,
1926 'field_id' => $field_id,
1927 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1928 'field_type' => 'with-prefix-suffix',
1929 'field_prefix' => '<strong>Code to insert in footer section before &lt;/body&gt;: with the priority of</strong>',
1930 'field_suffix' => '',
1931 'field_intro' => '',
1932 'field_description' => 'Default is 10. Larger number insert code closer to &lt;/body&gt;',
1933 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug,
1934 )
1935 );
1936 $field_id = 'footer_code';
1937 $field_slug = 'footer-code';
1938 add_settings_field(
1939 $field_id,
1940 // Field ID
1941 '',
1942 // Field title
1943 [ $render_field, 'render_textarea_subfield' ],
1944 // Callback to render field with custom arguments in the array below
1945 ASENHA_SLUG,
1946 // Settings page slug
1947 'main-section',
1948 // Section ID
1949 array(
1950 'option_name' => ASENHA_SLUG_U,
1951 'field_id' => $field_id,
1952 'field_slug' => $field_slug,
1953 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1954 'field_type' => 'textarea',
1955 'field_rows' => 15,
1956 'field_intro' => '',
1957 'field_description' => '',
1958 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1959 )
1960 );
1961 // =================================================================
1962 // DISABLE COMPONENTS
1963 // =================================================================
1964 // Disable Gutenberg
1965 $field_id = 'disable_gutenberg';
1966 $field_slug = 'disable-gutenberg';
1967 add_settings_field(
1968 $field_id,
1969 // Field ID
1970 'Disable Gutenberg',
1971 // Field title
1972 [ $render_field, 'render_checkbox_toggle' ],
1973 // Callback to render field with custom arguments in the array below
1974 ASENHA_SLUG,
1975 // Settings page slug
1976 'main-section',
1977 // Section ID
1978 array(
1979 'option_name' => ASENHA_SLUG_U,
1980 'field_id' => $field_id,
1981 'field_slug' => $field_slug,
1982 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1983 'field_description' => 'Disable the Gutenberg block editor for some or all applicable post types.',
1984 'field_options_wrapper' => true,
1985 'field_options_moreless' => true,
1986 'class' => 'asenha-toggle disable-components ' . $field_slug,
1987 )
1988 );
1989 $field_id = 'disable_gutenberg_for';
1990 $field_slug = 'disable-gutenberg-for';
1991 if ( is_array( $asenha_gutenberg_post_types ) ) {
1992 foreach ( $asenha_gutenberg_post_types as $post_type_slug => $post_type_label ) {
1993 // e.g. $post_type_slug is post, $post_type_label is Posts
1994 add_settings_field(
1995 $field_id . '_' . $post_type_slug,
1996 // Field ID
1997 '',
1998 // Field title
1999 [ $render_field, 'render_checkbox_subfield' ],
2000 // Callback to render field with custom arguments in the array below
2001 ASENHA_SLUG,
2002 // Settings page slug
2003 'main-section',
2004 // Section ID
2005 array(
2006 'option_name' => ASENHA_SLUG_U,
2007 'parent_field_id' => $field_id,
2008 'field_id' => $post_type_slug,
2009 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
2010 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
2011 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug,
2012 )
2013 );
2014 }
2015 }
2016 $field_id = 'disable_gutenberg_frontend_styles';
2017 $field_slug = 'disable-gutenberg-frontend-styles';
2018 add_settings_field(
2019 $field_id,
2020 // Field ID
2021 '',
2022 // Field title
2023 [ $render_field, 'render_checkbox_plain' ],
2024 // Callback to render field with custom arguments in the array below
2025 ASENHA_SLUG,
2026 // Settings page slug
2027 'main-section',
2028 // Section ID
2029 array(
2030 'option_name' => ASENHA_SLUG_U,
2031 'field_id' => $field_id,
2032 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2033 'field_label' => 'Also disable frontend block styles / CSS files for the selected post types.',
2034 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-top disable-components ' . $field_slug,
2035 )
2036 );
2037 // Disable Block-Based Widgets Screen
2038 $field_id = 'disable_block_widgets';
2039 $field_slug = 'disable-block-widgets';
2040 add_settings_field(
2041 $field_id,
2042 // Field ID
2043 'Disable Block-Based Widgets Settings Screen',
2044 // Field title
2045 [ $render_field, 'render_checkbox_toggle' ],
2046 // Callback to render field with custom arguments in the array below
2047 ASENHA_SLUG,
2048 // Settings page slug
2049 'main-section',
2050 // Section ID
2051 array(
2052 'option_name' => ASENHA_SLUG_U,
2053 'field_id' => $field_id,
2054 'field_slug' => $field_slug,
2055 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2056 'field_description' => 'Restores the classic widgets settings screen when using a classic (non-block) theme. This has no effect on block themes.',
2057 'field_options_wrapper' => true,
2058 'field_options_moreless' => true,
2059 'class' => 'asenha-toggle disable-components ' . $field_slug,
2060 )
2061 );
2062 // Disable Comments
2063 $field_id = 'disable_comments';
2064 $field_slug = 'disable-comments';
2065 add_settings_field(
2066 $field_id,
2067 // Field ID
2068 'Disable Comments',
2069 // Field title
2070 [ $render_field, 'render_checkbox_toggle' ],
2071 // Callback to render field with custom arguments in the array below
2072 ASENHA_SLUG,
2073 // Settings page slug
2074 'main-section',
2075 // Section ID
2076 array(
2077 'option_name' => ASENHA_SLUG_U,
2078 'field_id' => $field_id,
2079 'field_slug' => $field_slug,
2080 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2081 'field_description' => 'Disable comments for some or all public post types. When disabled, existing comments will also be hidden on the frontend.',
2082 'field_options_wrapper' => true,
2083 'field_options_moreless' => true,
2084 'class' => 'asenha-toggle disable-components ' . $field_slug,
2085 )
2086 );
2087 $field_id = 'disable_comments_for';
2088 $field_slug = 'disable-comments-for';
2089 if ( is_array( $asenha_public_post_types ) ) {
2090 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
2091 // e.g. $post_type_slug is post, $post_type_label is Posts
2092 add_settings_field(
2093 $field_id . '_' . $post_type_slug,
2094 // Field ID
2095 '',
2096 // Field title
2097 [ $render_field, 'render_checkbox_subfield' ],
2098 // Callback to render field with custom arguments in the array below
2099 ASENHA_SLUG,
2100 // Settings page slug
2101 'main-section',
2102 // Section ID
2103 array(
2104 'option_name' => ASENHA_SLUG_U,
2105 'parent_field_id' => $field_id,
2106 'field_id' => $post_type_slug,
2107 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
2108 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
2109 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug,
2110 )
2111 );
2112 }
2113 }
2114 // Disable REST API
2115 $field_id = 'disable_rest_api';
2116 $field_slug = 'disable-rest-api';
2117 add_settings_field(
2118 $field_id,
2119 // Field ID
2120 'Disable REST API',
2121 // Field title
2122 [ $render_field, 'render_checkbox_toggle' ],
2123 // Callback to render field with custom arguments in the array below
2124 ASENHA_SLUG,
2125 // Settings page slug
2126 'main-section',
2127 // Section ID
2128 array(
2129 'option_name' => ASENHA_SLUG_U,
2130 'field_id' => $field_id,
2131 'field_slug' => $field_slug,
2132 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2133 'field_description' => 'Disable REST API access for non-authenticated users and remove URL traces from &lt;head&gt;, HTTP headers and WP RSD endpoint.',
2134 'field_options_wrapper' => true,
2135 'field_options_moreless' => true,
2136 'class' => 'asenha-toggle disable-components ' . $field_slug,
2137 )
2138 );
2139 // Disable Feeds
2140 $field_id = 'disable_feeds';
2141 $field_slug = 'disable-feeds';
2142 add_settings_field(
2143 $field_id,
2144 // Field ID
2145 'Disable Feeds',
2146 // Field title
2147 [ $render_field, 'render_checkbox_toggle' ],
2148 // Callback to render field with custom arguments in the array below
2149 ASENHA_SLUG,
2150 // Settings page slug
2151 'main-section',
2152 // Section ID
2153 array(
2154 'option_name' => ASENHA_SLUG_U,
2155 'field_id' => $field_id,
2156 'field_slug' => $field_slug,
2157 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2158 '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;.',
2159 'field_options_wrapper' => true,
2160 'field_options_moreless' => true,
2161 'class' => 'asenha-toggle disable-components ' . $field_slug,
2162 )
2163 );
2164 // Disable Auto Updates
2165 $field_id = 'disable_all_updates';
2166 $field_slug = 'disable-all-updates';
2167 add_settings_field(
2168 $field_id,
2169 // Field ID
2170 'Disable All Updates',
2171 // Field title
2172 [ $render_field, 'render_checkbox_toggle' ],
2173 // Callback to render field with custom arguments in the array below
2174 ASENHA_SLUG,
2175 // Settings page slug
2176 'main-section',
2177 // Section ID
2178 array(
2179 'option_name' => ASENHA_SLUG_U,
2180 'field_id' => $field_id,
2181 'field_slug' => $field_slug,
2182 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2183 'field_description' => 'Completely disable core, theme and plugin updates and auto-updates. Will also disable update checks, notices and emails.',
2184 'field_options_wrapper' => true,
2185 'field_options_moreless' => true,
2186 'class' => 'asenha-toggle disable-components ' . $field_slug,
2187 )
2188 );
2189 // Disable Smaller Components
2190 $field_id = 'disable_smaller_components';
2191 $field_slug = 'disable-smaller-components';
2192 add_settings_field(
2193 $field_id,
2194 // Field ID
2195 'Disable Smaller Components',
2196 // Field title
2197 [ $render_field, 'render_checkbox_toggle' ],
2198 // Callback to render field with custom arguments in the array below
2199 ASENHA_SLUG,
2200 // Settings page slug
2201 'main-section',
2202 // Section ID
2203 array(
2204 'option_name' => ASENHA_SLUG_U,
2205 'field_id' => $field_id,
2206 'field_slug' => $field_slug,
2207 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2208 'field_description' => 'Prevent smaller components from running or loading. Make the site more secure, load slightly faster and be more optimized for crawling by search engines.',
2209 'field_options_wrapper' => true,
2210 'field_options_moreless' => true,
2211 'class' => 'asenha-toggle admin-interface ' . $field_slug,
2212 )
2213 );
2214 $field_id = 'disable_head_generator_tag';
2215 $field_slug = 'disable-head-generator-tag';
2216 add_settings_field(
2217 $field_id,
2218 // Field ID
2219 '',
2220 // Field title
2221 [ $render_field, 'render_checkbox_plain' ],
2222 // Callback to render field with custom arguments in the array below
2223 ASENHA_SLUG,
2224 // Settings page slug
2225 'main-section',
2226 // Section ID
2227 array(
2228 'option_name' => ASENHA_SLUG_U,
2229 'field_id' => $field_id,
2230 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2231 'field_label' => 'Disable the <strong>generator &lt;meta&gt; tag</strong> in &lt;head&gt;, which discloses the WordPress version number. Older versions(s) might contain unpatched security loophole(s).',
2232 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
2233 )
2234 );
2235 $field_id = 'disable_resource_version_number';
2236 $field_slug = 'disable-resource-version-number';
2237 add_settings_field(
2238 $field_id,
2239 // Field ID
2240 '',
2241 // Field title
2242 [ $render_field, 'render_checkbox_plain' ],
2243 // Callback to render field with custom arguments in the array below
2244 ASENHA_SLUG,
2245 // Settings page slug
2246 'main-section',
2247 // Section ID
2248 array(
2249 'option_name' => ASENHA_SLUG_U,
2250 'field_id' => $field_id,
2251 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2252 'field_label' => 'Disable <strong>version number</strong> on static resource URLs referenced in &lt;head&gt;, which can disclose WordPress version number. Older versions(s) might contain unpatched security loophole(s). Applies to non-logged-in view of pages. This will also increase cacheability of static assets, but may have unintended consequences. Make sure you know what you are doing.',
2253 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
2254 )
2255 );
2256 $field_id = 'disable_head_wlwmanifest_tag';
2257 $field_slug = 'disable-head-wlwmanifest-tag';
2258 add_settings_field(
2259 $field_id,
2260 // Field ID
2261 '',
2262 // Field title
2263 [ $render_field, 'render_checkbox_plain' ],
2264 // Callback to render field with custom arguments in the array below
2265 ASENHA_SLUG,
2266 // Settings page slug
2267 'main-section',
2268 // Section ID
2269 array(
2270 'option_name' => ASENHA_SLUG_U,
2271 'field_id' => $field_id,
2272 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2273 'field_label' => 'Disable the <strong>Windows Live Writer (WLW) manifest &lt;link&gt; tag</strong> in &lt;head&gt;. The WLW app was discontinued in 2017.',
2274 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
2275 )
2276 );
2277 $field_id = 'disable_head_rsd_tag';
2278 $field_slug = 'disable-head-rsd-tag';
2279 add_settings_field(
2280 $field_id,
2281 // Field ID
2282 '',
2283 // Field title
2284 [ $render_field, 'render_checkbox_plain' ],
2285 // Callback to render field with custom arguments in the array below
2286 ASENHA_SLUG,
2287 // Settings page slug
2288 'main-section',
2289 // Section ID
2290 array(
2291 'option_name' => ASENHA_SLUG_U,
2292 'field_id' => $field_id,
2293 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2294 'field_label' => 'Disable the <strong>Really Simple Discovery (RSD) &lt;link&gt; tag</strong> in &lt;head&gt;. It\'s not needed if your site is not using pingback or remote (XML-RPC) client to manage posts.',
2295 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
2296 )
2297 );
2298 $field_id = 'disable_head_shortlink_tag';
2299 $field_slug = 'disable-head-shortlink-tag';
2300 add_settings_field(
2301 $field_id,
2302 // Field ID
2303 '',
2304 // Field title
2305 [ $render_field, 'render_checkbox_plain' ],
2306 // Callback to render field with custom arguments in the array below
2307 ASENHA_SLUG,
2308 // Settings page slug
2309 'main-section',
2310 // Section ID
2311 array(
2312 'option_name' => ASENHA_SLUG_U,
2313 'field_id' => $field_id,
2314 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2315 'field_label' => 'Disable the default <strong>WordPress shortlink &lt;link&gt; tag</strong> in &lt;head&gt;. Ignored by search engines and has minimal practical use case. Usually, a dedicated shortlink plugin or service is preferred that allows for nice names in the short links and tracking of clicks when sharing the link on social media.',
2316 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
2317 )
2318 );
2319 $field_id = 'disable_frontend_dashicons';
2320 $field_slug = 'disable-frontend-dashicons';
2321 add_settings_field(
2322 $field_id,
2323 // Field ID
2324 '',
2325 // Field title
2326 [ $render_field, 'render_checkbox_plain' ],
2327 // Callback to render field with custom arguments in the array below
2328 ASENHA_SLUG,
2329 // Settings page slug
2330 'main-section',
2331 // Section ID
2332 array(
2333 'option_name' => ASENHA_SLUG_U,
2334 'field_id' => $field_id,
2335 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2336 'field_label' => 'Disable loading of <strong>Dashicons CSS and JS files</strong> on the front-end for public site visitors. This might break the layout or design of custom forms, including custom login forms, if they depend on Dashicons. Make sure to check those forms after disabling.',
2337 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
2338 )
2339 );
2340 $field_id = 'disable_emoji_support';
2341 $field_slug = 'disable-emoji-support';
2342 add_settings_field(
2343 $field_id,
2344 // Field ID
2345 '',
2346 // Field title
2347 [ $render_field, 'render_checkbox_plain' ],
2348 // Callback to render field with custom arguments in the array below
2349 ASENHA_SLUG,
2350 // Settings page slug
2351 'main-section',
2352 // Section ID
2353 array(
2354 'option_name' => ASENHA_SLUG_U,
2355 'field_id' => $field_id,
2356 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2357 'field_label' => 'Disable <strong>emoji support for pages, posts and custom post types</strong> on the admin and frontend. The support is primarily useful for older browsers that do not have native support for it. Most modern browsers across different OSes and devices now have native support for it.',
2358 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
2359 )
2360 );
2361 $field_id = 'disable_jquery_migrate';
2362 $field_slug = 'disable-jquery-migrate';
2363 add_settings_field(
2364 $field_id,
2365 // Field ID
2366 '',
2367 // Field title
2368 [ $render_field, 'render_checkbox_plain' ],
2369 // Callback to render field with custom arguments in the array below
2370 ASENHA_SLUG,
2371 // Settings page slug
2372 'main-section',
2373 // Section ID
2374 array(
2375 'option_name' => ASENHA_SLUG_U,
2376 'field_id' => $field_id,
2377 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2378 'field_label' => 'Disable <strong>jQuery Migrate</strong> script on the frontend, which should no longer be needed if your site uses modern theme and plugins.',
2379 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
2380 )
2381 );
2382 // =================================================================
2383 // SECURITY
2384 // =================================================================
2385 // Limit Login Attempts
2386 $field_id = 'limit_login_attempts';
2387 $field_slug = 'limit-login-attempts';
2388 add_settings_field(
2389 $field_id,
2390 // Field ID
2391 'Limit Login Attempts',
2392 // Field title
2393 [ $render_field, 'render_checkbox_toggle' ],
2394 // Callback to render field with custom arguments in the array below
2395 ASENHA_SLUG,
2396 // Settings page slug
2397 'main-section',
2398 // Section ID
2399 array(
2400 'option_name' => ASENHA_SLUG_U,
2401 'field_id' => $field_id,
2402 'field_slug' => $field_slug,
2403 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2404 'field_description' => 'Prevent brute force attacks by limiting the number of failed login attempts allowed per IP address.',
2405 'field_options_wrapper' => true,
2406 'field_options_moreless' => true,
2407 'class' => 'asenha-toggle security ' . $field_slug,
2408 )
2409 );
2410 $field_id = 'login_fails_allowed';
2411 $field_slug = 'login-fails-allowed';
2412 add_settings_field(
2413 $field_id,
2414 // Field ID
2415 '',
2416 // Field title
2417 [ $render_field, 'render_text_subfield' ],
2418 // Callback to render field with custom arguments in the array below
2419 ASENHA_SLUG,
2420 // Settings page slug
2421 'main-section',
2422 // Section ID
2423 array(
2424 'option_name' => ASENHA_SLUG_U,
2425 'field_id' => $field_id,
2426 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2427 'field_type' => 'with-prefix-suffix',
2428 'field_prefix' => '',
2429 'field_suffix' => 'failed login attempts allowed before 15 minutes lockout',
2430 'field_description' => '',
2431 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug,
2432 )
2433 );
2434 $field_id = 'login_lockout_maxcount';
2435 $field_slug = 'login-lockout-maxcount';
2436 add_settings_field(
2437 $field_id,
2438 // Field ID
2439 '',
2440 // Field title
2441 [ $render_field, 'render_text_subfield' ],
2442 // Callback to render field with custom arguments in the array below
2443 ASENHA_SLUG,
2444 // Settings page slug
2445 'main-section',
2446 // Section ID
2447 array(
2448 'option_name' => ASENHA_SLUG_U,
2449 'field_id' => $field_id,
2450 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2451 'field_type' => 'with-prefix-suffix',
2452 'field_prefix' => '',
2453 'field_suffix' => 'lockout(s) will block further login attempts for 24 hours',
2454 'field_description' => '',
2455 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug,
2456 )
2457 );
2458 $field_id = 'login_attempts_log_table';
2459 $field_slug = 'login-attempts-log-table';
2460 add_settings_field(
2461 $field_id,
2462 // Field ID
2463 'Failed login attempts:',
2464 // Field title
2465 [ $render_field, 'render_datatable' ],
2466 // Callback to render field with custom arguments in the array below
2467 ASENHA_SLUG,
2468 // Settings page slug
2469 'main-section',
2470 // Section ID
2471 array(
2472 'option_name' => ASENHA_SLUG_U,
2473 'field_id' => $field_id,
2474 'field_slug' => $field_slug,
2475 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2476 'field_type' => 'datatable',
2477 'field_description' => '',
2478 'class' => 'asenha-text datatable margin-top-16 security ' . $field_slug,
2479 'table_title' => 'Failed Login Attempts Log',
2480 'table_name' => $wpdb->prefix . 'asenha_failed_logins',
2481 )
2482 );
2483 // Obfuscate Author Slugs
2484 $field_id = 'obfuscate_author_slugs';
2485 $field_slug = 'obfuscate-author-slugs';
2486 add_settings_field(
2487 $field_id,
2488 // Field ID
2489 'Obfuscate Author Slugs',
2490 // Field title
2491 [ $render_field, 'render_checkbox_toggle' ],
2492 // Callback to render field with custom arguments in the array below
2493 ASENHA_SLUG,
2494 // Settings page slug
2495 'main-section',
2496 // Section ID
2497 array(
2498 'option_name' => ASENHA_SLUG_U,
2499 'field_id' => $field_id,
2500 'field_slug' => $field_slug,
2501 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2502 '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.',
2503 'field_options_wrapper' => false,
2504 'class' => 'asenha-toggle security ' . $field_slug,
2505 )
2506 );
2507 // Obfuscate Email Address
2508 $field_id = 'obfuscate_email_address';
2509 $field_slug = 'obfuscate-email-address';
2510 add_settings_field(
2511 $field_id,
2512 // Field ID
2513 'Email Address Obfuscator',
2514 // Field title
2515 [ $render_field, 'render_checkbox_toggle' ],
2516 // Callback to render field with custom arguments in the array below
2517 ASENHA_SLUG,
2518 // Settings page slug
2519 'main-section',
2520 // Section ID
2521 array(
2522 'option_name' => ASENHA_SLUG_U,
2523 'field_id' => $field_id,
2524 'field_slug' => $field_slug,
2525 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2526 'field_description' => 'Obfuscate email address to prevent spam bots from harvesting them, but make it readable like a regular email address for human visitors.',
2527 'field_options_wrapper' => true,
2528 'field_options_moreless' => true,
2529 'class' => 'asenha-toggle security ' . $field_slug,
2530 )
2531 );
2532 $field_id = 'obfuscate_email_address_description';
2533 $field_slug = 'obfuscate-email-address-description';
2534 $field_description = 'Use a shortcode like the following examples to display an email address on the frontend of your site:
2535 <ul>
2536 <li><strong>[obfuscate email="john@example.com"]</strong> to display the email on it\'s own line</li>
2537 <li><strong>[obfuscate email="john@example.com" display="inline"]</strong> to show the email inline</li>
2538 </ul>';
2539 add_settings_field(
2540 $field_id,
2541 // Field ID
2542 '',
2543 // Field title
2544 [ $render_field, 'render_description_subfield' ],
2545 // Callback to render field with custom arguments in the array below
2546 ASENHA_SLUG,
2547 // Settings page slug
2548 'main-section',
2549 // Section ID
2550 array(
2551 'option_name' => ASENHA_SLUG_U,
2552 'field_description' => $field_description,
2553 'class' => 'asenha-description security ' . $field_slug,
2554 )
2555 );
2556 // Disable XML-RPC
2557 $field_id = 'disable_xmlrpc';
2558 $field_slug = 'disable-xmlrpc';
2559 add_settings_field(
2560 $field_id,
2561 // Field ID
2562 'Disable XML-RPC',
2563 // Field title
2564 [ $render_field, 'render_checkbox_toggle' ],
2565 // Callback to render field with custom arguments in the array below
2566 ASENHA_SLUG,
2567 // Settings page slug
2568 'main-section',
2569 // Section ID
2570 array(
2571 'option_name' => ASENHA_SLUG_U,
2572 'field_id' => $field_id,
2573 'field_slug' => $field_slug,
2574 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2575 '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. ',
2576 'field_options_wrapper' => false,
2577 'class' => 'asenha-toggle security ' . $field_slug,
2578 )
2579 );
2580 // =================================================================
2581 // OPTIMIZATIONS
2582 // =================================================================
2583 // Image Upload Control
2584 $field_id = 'image_upload_control';
2585 $field_slug = 'image-upload-control';
2586 add_settings_field(
2587 $field_id,
2588 // Field ID
2589 'Image Upload Control',
2590 // Field title
2591 [ $render_field, 'render_checkbox_toggle' ],
2592 // Callback to render field with custom arguments in the array below
2593 ASENHA_SLUG,
2594 // Settings page slug
2595 'main-section',
2596 // Section ID
2597 array(
2598 'option_name' => ASENHA_SLUG_U,
2599 'field_id' => $field_id,
2600 'field_slug' => $field_slug,
2601 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2602 'field_description' => 'Resize newly uploaded, large images to a smaller dimension and delete originally uploaded files. BMPs and non-transparent PNGs will be converted to JPGs and resized.',
2603 'field_options_wrapper' => true,
2604 'field_options_moreless' => true,
2605 'class' => 'asenha-toggle optimizations ' . $field_slug,
2606 )
2607 );
2608 $field_id = 'image_max_width';
2609 $field_slug = 'image-max-width';
2610 add_settings_field(
2611 $field_id,
2612 // Field ID
2613 '',
2614 // Field title
2615 [ $render_field, 'render_number_subfield' ],
2616 // Callback to render field with custom arguments in the array below
2617 ASENHA_SLUG,
2618 // Settings page slug
2619 'main-section',
2620 // Section ID
2621 array(
2622 'option_name' => ASENHA_SLUG_U,
2623 'field_id' => $field_id,
2624 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2625 'field_type' => 'with-prefix-suffix',
2626 'field_prefix' => 'Max width:',
2627 'field_suffix' => 'pixels. <span class="faded">(Default is 1920 pixels)</span>',
2628 'field_intro' => '',
2629 'field_description' => '',
2630 'class' => 'asenha-number asenha-hide-th narrow optimizations ' . $field_slug,
2631 )
2632 );
2633 $field_id = 'image_max_height';
2634 $field_slug = 'image-max-height';
2635 add_settings_field(
2636 $field_id,
2637 // Field ID
2638 '',
2639 // Field title
2640 [ $render_field, 'render_number_subfield' ],
2641 // Callback to render field with custom arguments in the array below
2642 ASENHA_SLUG,
2643 // Settings page slug
2644 'main-section',
2645 // Section ID
2646 array(
2647 'option_name' => ASENHA_SLUG_U,
2648 'field_id' => $field_id,
2649 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2650 'field_type' => 'with-prefix-suffix',
2651 'field_prefix' => 'Max height:',
2652 'field_suffix' => 'pixels <span class="faded">(Default is 1920 pixels)</span>',
2653 'field_intro' => '',
2654 'class' => 'asenha-number asenha-hide-th narrow margin-bottom-4 optimizations ' . $field_slug,
2655 )
2656 );
2657 $field_id = 'image_upload_control_description';
2658 $field_slug = 'image-upload-control-description';
2659 $field_description = 'To exclude an image from conversion and resizing, append \'-nr\' suffix to the file name, e.g. bird-photo-4k-nr.jpg';
2660 add_settings_field(
2661 $field_id,
2662 // Field ID
2663 '',
2664 // Field title
2665 [ $render_field, 'render_description_subfield' ],
2666 // Callback to render field with custom arguments in the array below
2667 ASENHA_SLUG,
2668 // Settings page slug
2669 'main-section',
2670 // Section ID
2671 array(
2672 'option_name' => ASENHA_SLUG_U,
2673 'field_description' => $field_description,
2674 'class' => 'asenha-description top-border optimizations ' . $field_slug,
2675 )
2676 );
2677 // Enable Revisions Control
2678 $field_id = 'enable_revisions_control';
2679 $field_slug = 'enable-revisions-control';
2680 add_settings_field(
2681 $field_id,
2682 // Field ID
2683 'Revisions Control',
2684 // Field title
2685 [ $render_field, 'render_checkbox_toggle' ],
2686 // Callback to render field with custom arguments in the array below
2687 ASENHA_SLUG,
2688 // Settings page slug
2689 'main-section',
2690 // Section ID
2691 array(
2692 'option_name' => ASENHA_SLUG_U,
2693 'field_id' => $field_id,
2694 'field_slug' => $field_slug,
2695 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2696 'field_description' => 'Prevent bloating the database by limiting the number of revisions to keep for some or all post types supporting revisions.',
2697 'field_options_wrapper' => true,
2698 'field_options_moreless' => true,
2699 'class' => 'asenha-toggle optimizations ' . $field_slug,
2700 )
2701 );
2702 $field_id = 'revisions_max_number';
2703 $field_slug = 'revisions-max-number';
2704 add_settings_field(
2705 $field_id,
2706 // Field ID
2707 '',
2708 // Field title
2709 [ $render_field, 'render_number_subfield' ],
2710 // Callback to render field with custom arguments in the array below
2711 ASENHA_SLUG,
2712 // Settings page slug
2713 'main-section',
2714 // Section ID
2715 array(
2716 'option_name' => ASENHA_SLUG_U,
2717 'field_id' => $field_id,
2718 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2719 'field_type' => 'with-prefix-suffix',
2720 'field_prefix' => 'Limit to',
2721 'field_suffix' => 'revisions for:',
2722 'field_intro' => '',
2723 'field_description' => '',
2724 'class' => 'asenha-number asenha-hide-th extra-narrow optimizations ' . $field_slug,
2725 )
2726 );
2727 $field_id = 'enable_revisions_control_for';
2728 $field_slug = 'enable-revisions-control-for';
2729
2730 if ( is_array( $asenha_revisions_post_types ) ) {
2731 // Exclude Bricks builder template CPT as revisions are handled via a constant
2732 // Ref: https://academy.bricksbuilder.io/article/revisions/
2733 unset( $asenha_revisions_post_types['bricks_template'] );
2734 foreach ( $asenha_revisions_post_types as $post_type_slug => $post_type_label ) {
2735 // e.g. $post_type_slug is post, $post_type_label is Posts
2736 add_settings_field(
2737 $field_id . '_' . $post_type_slug,
2738 // Field ID
2739 '',
2740 // Field title
2741 [ $render_field, 'render_checkbox_subfield' ],
2742 // Callback to render field with custom arguments in the array below
2743 ASENHA_SLUG,
2744 // Settings page slug
2745 'main-section',
2746 // Section ID
2747 array(
2748 'option_name' => ASENHA_SLUG_U,
2749 'parent_field_id' => $field_id,
2750 'field_id' => $post_type_slug,
2751 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
2752 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
2753 'class' => 'asenha-checkbox asenha-hide-th asenha-half optimizations ' . $field_slug . ' ' . $post_type_slug,
2754 )
2755 );
2756 }
2757 }
2758
2759 // Enable Heartbeat Control
2760 $field_id = 'enable_heartbeat_control';
2761 $field_slug = 'enable-heartbeat-control';
2762 add_settings_field(
2763 $field_id,
2764 // Field ID
2765 'Heartbeat Control',
2766 // Field title
2767 [ $render_field, 'render_checkbox_toggle' ],
2768 // Callback to render field with custom arguments in the array below
2769 ASENHA_SLUG,
2770 // Settings page slug
2771 'main-section',
2772 // Section ID
2773 array(
2774 'option_name' => ASENHA_SLUG_U,
2775 'field_id' => $field_id,
2776 'field_slug' => $field_slug,
2777 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2778 '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.',
2779 'field_options_wrapper' => true,
2780 'field_options_moreless' => true,
2781 'class' => 'asenha-toggle optimizations ' . $field_slug,
2782 )
2783 );
2784 $field_id = 'heartbeat_control_for_admin_pages';
2785 $field_slug = 'heartbeat-control-for-admin-pages';
2786 add_settings_field(
2787 $field_id,
2788 // Field ID
2789 'On admin pages',
2790 // Field title
2791 [ $render_field, 'render_radio_buttons_subfield' ],
2792 // Callback to render field with custom arguments in the array below
2793 ASENHA_SLUG,
2794 // Settings page slug
2795 'main-section',
2796 // Section ID
2797 array(
2798 'option_name' => ASENHA_SLUG_U,
2799 'field_id' => $field_id,
2800 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2801 'field_radios' => array(
2802 'Keep as is' => 'default',
2803 'Modify' => 'modify',
2804 'Disable' => 'disable',
2805 ),
2806 'field_default' => 'default',
2807 'class' => 'asenha-radio-buttons optimizations ' . $field_slug,
2808 )
2809 );
2810 $field_id = 'heartbeat_interval_for_admin_pages';
2811 $field_slug = 'heartbeat-interval-for-admin-pages';
2812 add_settings_field(
2813 $field_id,
2814 // Field ID
2815 '',
2816 // Field title
2817 [ $render_field, 'render_select_subfield' ],
2818 // Callback to render field with custom arguments in the array below
2819 ASENHA_SLUG,
2820 // Settings page slug
2821 'main-section',
2822 // Section ID
2823 array(
2824 'option_name' => ASENHA_SLUG_U,
2825 'field_id' => $field_id,
2826 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2827 'field_type' => 'with-prefix-suffix',
2828 'field_prefix' => 'Set interval to once every',
2829 'field_suffix' => '<span class="faded">(Default is 1 minute)</span>',
2830 'field_select_options' => array(
2831 '15 seconds' => 15,
2832 '30 seconds' => 30,
2833 '1 minute' => 60,
2834 '2 minutes' => 120,
2835 '3 minutes' => 180,
2836 '5 minutes' => 300,
2837 '10 minutes' => 600,
2838 ),
2839 'field_select_default' => 60,
2840 'field_intro' => '',
2841 'field_description' => '',
2842 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug,
2843 'display_none_on_load' => true,
2844 )
2845 );
2846 $field_id = 'heartbeat_control_for_post_edit';
2847 $field_slug = 'heartbeat-control-for-post-edit';
2848 add_settings_field(
2849 $field_id,
2850 // Field ID
2851 'On post creation and edit screens',
2852 // Field title
2853 [ $render_field, 'render_radio_buttons_subfield' ],
2854 // Callback to render field with custom arguments in the array below
2855 ASENHA_SLUG,
2856 // Settings page slug
2857 'main-section',
2858 // Section ID
2859 array(
2860 'option_name' => ASENHA_SLUG_U,
2861 'field_id' => $field_id,
2862 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2863 'field_radios' => array(
2864 'Keep as is' => 'default',
2865 'Modify' => 'modify',
2866 'Disable' => 'disable',
2867 ),
2868 'field_default' => 'default',
2869 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug,
2870 )
2871 );
2872 $field_id = 'heartbeat_interval_for_post_edit';
2873 $field_slug = 'heartbeat-interval-for-post-edit';
2874 add_settings_field(
2875 $field_id,
2876 // Field ID
2877 '',
2878 // Field title
2879 [ $render_field, 'render_select_subfield' ],
2880 // Callback to render field with custom arguments in the array below
2881 ASENHA_SLUG,
2882 // Settings page slug
2883 'main-section',
2884 // Section ID
2885 array(
2886 'option_name' => ASENHA_SLUG_U,
2887 'field_id' => $field_id,
2888 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2889 'field_type' => 'with-prefix-suffix',
2890 'field_prefix' => 'Set interval to once every',
2891 'field_suffix' => '<span class="faded">(Default is 15 seconds)</span>',
2892 'field_select_options' => array(
2893 '15 seconds' => 15,
2894 '30 seconds' => 30,
2895 '45 seconds' => 45,
2896 '60 seconds' => 60,
2897 '90 seconds' => 90,
2898 '120 seconds' => 120,
2899 ),
2900 'field_select_default' => 15,
2901 'field_intro' => '',
2902 'field_description' => '',
2903 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug,
2904 'display_none_on_load' => true,
2905 )
2906 );
2907 $field_id = 'heartbeat_control_for_frontend';
2908 $field_slug = 'heartbeat-control-for-frontend';
2909 add_settings_field(
2910 $field_id,
2911 // Field ID
2912 'On the frontend',
2913 // Field title
2914 [ $render_field, 'render_radio_buttons_subfield' ],
2915 // Callback to render field with custom arguments in the array below
2916 ASENHA_SLUG,
2917 // Settings page slug
2918 'main-section',
2919 // Section ID
2920 array(
2921 'option_name' => ASENHA_SLUG_U,
2922 'field_id' => $field_id,
2923 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2924 'field_radios' => array(
2925 'Keep as is' => 'default',
2926 'Modify' => 'modify',
2927 'Disable' => 'disable',
2928 ),
2929 'field_default' => 'default',
2930 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug,
2931 )
2932 );
2933 $field_id = 'heartbeat_interval_for_frontend';
2934 $field_slug = 'heartbeat-interval-for-frontend';
2935 add_settings_field(
2936 $field_id,
2937 // Field ID
2938 '',
2939 // Field title
2940 [ $render_field, 'render_select_subfield' ],
2941 // Callback to render field with custom arguments in the array below
2942 ASENHA_SLUG,
2943 // Settings page slug
2944 'main-section',
2945 // Section ID
2946 array(
2947 'option_name' => ASENHA_SLUG_U,
2948 'field_id' => $field_id,
2949 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2950 'field_type' => 'with-prefix-suffix',
2951 'field_prefix' => 'Set interval to once every',
2952 'field_suffix' => '',
2953 'field_select_options' => array(
2954 '15 seconds' => 15,
2955 '30 seconds' => 30,
2956 '1 minute' => 60,
2957 '2 minutes' => 120,
2958 '3 minutes' => 180,
2959 '5 minutes' => 300,
2960 '10 minutes' => 600,
2961 ),
2962 'field_select_default' => 60,
2963 'field_intro' => '',
2964 'field_description' => '',
2965 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug,
2966 'display_none_on_load' => true,
2967 )
2968 );
2969 // =================================================================
2970 // UTILITIES
2971 // =================================================================
2972 // SMTP Email Delivery
2973 $field_id = 'smtp_email_delivery';
2974 $field_slug = 'smtp-email-delivery';
2975 add_settings_field(
2976 $field_id,
2977 // Field ID
2978 'Email Delivery',
2979 // Field title
2980 [ $render_field, 'render_checkbox_toggle' ],
2981 // Callback to render field with custom arguments in the array below
2982 ASENHA_SLUG,
2983 // Settings page slug
2984 'main-section',
2985 // Section ID
2986 array(
2987 'option_name' => ASENHA_SLUG_U,
2988 'field_id' => $field_id,
2989 'field_slug' => $field_slug,
2990 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2991 'field_description' => 'Set custom sender name and email. Optionally use external SMTP service to ensure notification and transactional emails from your site are being delivered to inboxes.',
2992 'field_options_wrapper' => true,
2993 'field_options_moreless' => true,
2994 'class' => 'asenha-toggle utilities ' . $field_slug,
2995 )
2996 );
2997 $field_id = 'smtp_default_from_description';
2998 $field_slug = 'smtp-default-from-description';
2999 add_settings_field(
3000 $field_id,
3001 // Field ID
3002 '',
3003 // Field title
3004 [ $render_field, 'render_description_subfield' ],
3005 // Callback to render field with custom arguments in the array below
3006 ASENHA_SLUG,
3007 // Settings page slug
3008 'main-section',
3009 // Section ID
3010 array(
3011 'option_name' => ASENHA_SLUG_U,
3012 'field_description' => 'If set, the following sender name/email overrides WordPress core defaults but can still be overridden by other plugins that enables custom sender name/email, e.g. form plugins.',
3013 'class' => 'asenha-description utilities ' . $field_slug,
3014 )
3015 );
3016 $field_id = 'smtp_default_from_name';
3017 $field_slug = 'smtp-default-from-name';
3018 add_settings_field(
3019 $field_id,
3020 // Field ID
3021 '<span class="field-sublabel sublabel-wide">Sender name</span>',
3022 // Field title
3023 [ $render_field, 'render_text_subfield' ],
3024 // Callback to render field with custom arguments in the array below
3025 ASENHA_SLUG,
3026 // Settings page slug
3027 'main-section',
3028 // Section ID
3029 array(
3030 'option_name' => ASENHA_SLUG_U,
3031 'field_id' => $field_id,
3032 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3033 'field_type' => '',
3034 'field_prefix' => '',
3035 'field_suffix' => '',
3036 'field_description' => '',
3037 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3038 )
3039 );
3040 $field_id = 'smtp_default_from_email';
3041 $field_slug = 'smtp-default-from-email';
3042 add_settings_field(
3043 $field_id,
3044 // Field ID
3045 '<span class="field-sublabel sublabel-wide">Sender email</span>',
3046 // Field title
3047 [ $render_field, 'render_text_subfield' ],
3048 // Callback to render field with custom arguments in the array below
3049 ASENHA_SLUG,
3050 // Settings page slug
3051 'main-section',
3052 // Section ID
3053 array(
3054 'option_name' => ASENHA_SLUG_U,
3055 'field_id' => $field_id,
3056 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3057 'field_type' => '',
3058 'field_prefix' => '',
3059 'field_suffix' => '',
3060 'field_description' => '',
3061 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3062 )
3063 );
3064 $field_id = 'smtp_force_from';
3065 $field_slug = 'smtp-force-from';
3066 add_settings_field(
3067 $field_id,
3068 // Field ID
3069 '',
3070 // Field title
3071 [ $render_field, 'render_checkbox_plain' ],
3072 // Callback to render field with custom arguments in the array below
3073 ASENHA_SLUG,
3074 // Settings page slug
3075 'main-section',
3076 // Section ID
3077 array(
3078 'option_name' => ASENHA_SLUG_U,
3079 'field_id' => $field_id,
3080 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3081 'field_label' => 'Force the usage of the sender name/email defined above. It will override those set by other plugins.',
3082 'class' => 'asenha-checkbox asenha-hide-th bottom-border utilities ' . $field_slug,
3083 )
3084 );
3085 $field_id = 'smtp_description';
3086 $field_slug = 'smtp--description';
3087 add_settings_field(
3088 $field_id,
3089 // Field ID
3090 '',
3091 // Field title
3092 [ $render_field, 'render_description_subfield' ],
3093 // Callback to render field with custom arguments in the array below
3094 ASENHA_SLUG,
3095 // Settings page slug
3096 'main-section',
3097 // Section ID
3098 array(
3099 'option_name' => ASENHA_SLUG_U,
3100 'field_description' => 'If set, the following SMTP service/account wil be used to deliver your emails.',
3101 'class' => 'asenha-description utilities ' . $field_slug,
3102 )
3103 );
3104 $field_id = 'smtp_host';
3105 $field_slug = 'smtp-host';
3106 add_settings_field(
3107 $field_id,
3108 // Field ID
3109 '<span class="field-sublabel sublabel-wide">Host</span>',
3110 // Field title
3111 [ $render_field, 'render_text_subfield' ],
3112 // Callback to render field with custom arguments in the array below
3113 ASENHA_SLUG,
3114 // Settings page slug
3115 'main-section',
3116 // Section ID
3117 array(
3118 'option_name' => ASENHA_SLUG_U,
3119 'field_id' => $field_id,
3120 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3121 'field_type' => '',
3122 'field_prefix' => '',
3123 'field_suffix' => '',
3124 'field_description' => '',
3125 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3126 )
3127 );
3128 $field_id = 'smtp_port';
3129 $field_slug = 'smtp-port';
3130 add_settings_field(
3131 $field_id,
3132 // Field ID
3133 '<span class="field-sublabel sublabel-wide">Port</span>',
3134 // Field title
3135 [ $render_field, 'render_number_subfield' ],
3136 // Callback to render field with custom arguments in the array below
3137 ASENHA_SLUG,
3138 // Settings page slug
3139 'main-section',
3140 // Section ID
3141 array(
3142 'option_name' => ASENHA_SLUG_U,
3143 'field_id' => $field_id,
3144 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3145 'field_type' => '',
3146 'field_prefix' => '',
3147 'field_suffix' => '',
3148 'field_intro' => '',
3149 'field_description' => '',
3150 'class' => 'asenha-text with-prefix-suffix narrow utilities ' . $field_slug,
3151 )
3152 );
3153 $field_id = 'smtp_security';
3154 $field_slug = 'smtp-security';
3155 add_settings_field(
3156 $field_id,
3157 // Field ID
3158 '<span class="field-sublabel sublabel-wide">Security</span>',
3159 // Field title
3160 [ $render_field, 'render_radio_buttons_subfield' ],
3161 // Callback to render field with custom arguments in the array below
3162 ASENHA_SLUG,
3163 // Settings page slug
3164 'main-section',
3165 // Section ID
3166 array(
3167 'option_name' => ASENHA_SLUG_U,
3168 'field_id' => $field_id,
3169 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3170 'field_radios' => array(
3171 'None' => 'none',
3172 'SSL' => 'ssl',
3173 'TLS' => 'tls',
3174 ),
3175 'field_default' => 'default',
3176 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3177 )
3178 );
3179 $field_id = 'smtp_username';
3180 $field_slug = 'smtp-username';
3181 add_settings_field(
3182 $field_id,
3183 // Field ID
3184 '<span class="field-sublabel sublabel-wide">Username</span>',
3185 // Field title
3186 [ $render_field, 'render_text_subfield' ],
3187 // Callback to render field with custom arguments in the array below
3188 ASENHA_SLUG,
3189 // Settings page slug
3190 'main-section',
3191 // Section ID
3192 array(
3193 'option_name' => ASENHA_SLUG_U,
3194 'field_id' => $field_id,
3195 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3196 'field_type' => '',
3197 'field_prefix' => '',
3198 'field_suffix' => '',
3199 'field_description' => '',
3200 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3201 )
3202 );
3203 $field_id = 'smtp_password';
3204 $field_slug = 'smtp-password';
3205 add_settings_field(
3206 $field_id,
3207 // Field ID
3208 '<span class="field-sublabel sublabel-wide">Password</span>',
3209 // Field title
3210 [ $render_field, 'render_password_subfield' ],
3211 // Callback to render field with custom arguments in the array below
3212 ASENHA_SLUG,
3213 // Settings page slug
3214 'main-section',
3215 // Section ID
3216 array(
3217 'option_name' => ASENHA_SLUG_U,
3218 'field_id' => $field_id,
3219 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3220 'field_type' => '',
3221 'field_prefix' => '',
3222 'field_suffix' => '',
3223 'field_description' => '',
3224 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3225 )
3226 );
3227 $field_id = 'smtp_bypass_ssl_verification';
3228 $field_slug = 'smtp-bypass-ssl-verification';
3229 add_settings_field(
3230 $field_id,
3231 // Field ID
3232 '',
3233 // Field title
3234 [ $render_field, 'render_checkbox_plain' ],
3235 // Callback to render field with custom arguments in the array below
3236 ASENHA_SLUG,
3237 // Settings page slug
3238 'main-section',
3239 // Section ID
3240 array(
3241 'option_name' => ASENHA_SLUG_U,
3242 'field_id' => $field_id,
3243 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3244 'field_label' => 'Bypass verification of SSL certificate. This would be insecure if mail is delivered across the internet but could help in certain local and/or containerized WordPress scenarios.',
3245 'class' => 'asenha-checkbox asenha-hide-th utilities ' . $field_slug,
3246 )
3247 );
3248 $field_id = 'smtp_debug';
3249 $field_slug = 'smtp-debug';
3250 add_settings_field(
3251 $field_id,
3252 // Field ID
3253 '',
3254 // Field title
3255 [ $render_field, 'render_checkbox_plain' ],
3256 // Callback to render field with custom arguments in the array below
3257 ASENHA_SLUG,
3258 // Settings page slug
3259 'main-section',
3260 // Section ID
3261 array(
3262 'option_name' => ASENHA_SLUG_U,
3263 'field_id' => $field_id,
3264 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3265 'field_label' => 'Enable debug mode and output the debug info into WordPress debug.log file.',
3266 'class' => 'asenha-checkbox asenha-hide-th bottom-border utilities ' . $field_slug,
3267 )
3268 );
3269 $field_id = 'smtp_send_test_email_description';
3270 $field_slug = 'smtp-send-test-email-description';
3271 add_settings_field(
3272 $field_id,
3273 // Field ID
3274 '',
3275 // Field title
3276 [ $render_field, 'render_description_subfield' ],
3277 // Callback to render field with custom arguments in the array below
3278 ASENHA_SLUG,
3279 // Settings page slug
3280 'main-section',
3281 // Section ID
3282 array(
3283 'option_name' => ASENHA_SLUG_U,
3284 'field_description' => 'After saving the settings above, check if everything is configured properly below.',
3285 'class' => 'asenha-description utilities ' . $field_slug,
3286 )
3287 );
3288 $field_id = 'smtp_send_test_email_to';
3289 $field_slug = 'smtp-send-test-email-to';
3290 add_settings_field(
3291 $field_id,
3292 // Field ID
3293 '<span class="field-sublabel sublabel-wide">Send a test email to</span>',
3294 // Field title
3295 [ $render_field, 'render_custom_html' ],
3296 // Callback to render field with custom arguments in the array below
3297 ASENHA_SLUG,
3298 // Settings page slug
3299 'main-section',
3300 // Section ID
3301 array(
3302 'html' => '<input type="text" id="test-email-to" class="asenha-subfield-text" name="" placeholder="" value=""><a id="send-test-email" class="button send-test-email">Send Now</a>',
3303 'class' => 'asenha-html wide utilities ' . $field_slug,
3304 )
3305 );
3306 $field_id = 'smtp_send_test_email_result';
3307 $field_slug = 'smtp-send-test-email-result';
3308 add_settings_field(
3309 $field_id,
3310 // Field ID
3311 '',
3312 // Field title
3313 [ $render_field, 'render_description_subfield' ],
3314 // Callback to render field with custom arguments in the array below
3315 ASENHA_SLUG,
3316 // Settings page slug
3317 'main-section',
3318 // Section ID
3319 array(
3320 'option_name' => ASENHA_SLUG_U,
3321 'field_description' => '<div id="ajax-result" class="ajax-result-div" style="display:none;">
3322 <div class="sending-test-email"><img src="' . ASENHA_URL . 'assets/img/oval.svg" id="sending-test-email-spinner" class="spinner-img">Sending test email...</div>
3323 <div id="test-email-success" class="test-email-success" style="display:none;"><span class="dashicons dashicons-yes"></span> <span>Test email was successfully processed</span>.<br />Please check the destination email\'s inbox to verify successful delivery.</div>
3324 <div id="test-email-failed" class="test-email-failed" style="display:none;"><span class="dashicons dashicons-no-alt"></span> <span>Oops, something went wrong</span>.<br />Please double check your settings and the destination email address.</div></div>',
3325 'class' => 'asenha-description utilities ' . $field_slug,
3326 )
3327 );
3328 // Multiple User Roles
3329 $field_id = 'multiple_user_roles';
3330 $field_slug = 'multiple-user-roles';
3331 add_settings_field(
3332 $field_id,
3333 // Field ID
3334 'Multiple User Roles',
3335 // Field title
3336 [ $render_field, 'render_checkbox_toggle' ],
3337 // Callback to render field with custom arguments in the array below
3338 ASENHA_SLUG,
3339 // Settings page slug
3340 'main-section',
3341 // Section ID
3342 array(
3343 'option_name' => ASENHA_SLUG_U,
3344 'field_id' => $field_id,
3345 'field_slug' => $field_slug,
3346 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3347 'field_description' => 'Enable assignment of multiple roles during user account creation and editing. This maybe useful for working with roles not defined in WordPress core, e.g. from e-commerce or LMS plugins.',
3348 'field_options_wrapper' => true,
3349 'class' => 'asenha-toggle utilities ' . $field_slug,
3350 )
3351 );
3352 // Image Sizes Panel
3353 $field_id = 'image_sizes_panel';
3354 $field_slug = 'image-sizes-panel';
3355 add_settings_field(
3356 $field_id,
3357 // Field ID
3358 'Image Sizes Panel',
3359 // Field title
3360 [ $render_field, 'render_checkbox_toggle' ],
3361 // Callback to render field with custom arguments in the array below
3362 ASENHA_SLUG,
3363 // Settings page slug
3364 'main-section',
3365 // Section ID
3366 array(
3367 'option_name' => ASENHA_SLUG_U,
3368 'field_id' => $field_id,
3369 'field_slug' => $field_slug,
3370 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3371 'field_description' => 'Display a panel showing and linking to all available sizes when viewing an image in the media library. Especially useful to quickly get the URL of a particular image size.',
3372 'field_options_wrapper' => true,
3373 'class' => 'asenha-toggle utilities ' . $field_slug,
3374 )
3375 );
3376 // View Admin as Role
3377 $field_id = 'view_admin_as_role';
3378 $field_slug = 'view-admin-as-role';
3379 add_settings_field(
3380 $field_id,
3381 // Field ID
3382 'View Admin as Role',
3383 // Field title
3384 [ $render_field, 'render_checkbox_toggle' ],
3385 // Callback to render field with custom arguments in the array below
3386 ASENHA_SLUG,
3387 // Settings page slug
3388 'main-section',
3389 // Section ID
3390 array(
3391 'option_name' => ASENHA_SLUG_U,
3392 'field_id' => $field_id,
3393 'field_slug' => $field_slug,
3394 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3395 'field_description' => 'View admin pages and the site (logged-in) as one of the non-administrator user roles.',
3396 'field_options_moreless' => true,
3397 'field_options_wrapper' => true,
3398 'class' => 'asenha-toggle utilities ' . $field_slug,
3399 )
3400 );
3401 $current_user = wp_get_current_user();
3402 $current_user_username = $current_user->user_login;
3403 $field_id = 'view_admin_as_role_description';
3404 $field_slug = 'view-admin-as-role-description';
3405 add_settings_field(
3406 $field_id,
3407 // Field ID
3408 '',
3409 // Field title
3410 [ $render_field, 'render_description_subfield' ],
3411 // Callback to render field with custom arguments in the array below
3412 ASENHA_SLUG,
3413 // Settings page slug
3414 'main-section',
3415 // Section ID
3416 array(
3417 'option_name' => ASENHA_SLUG_U,
3418 'field_description' => '<div class="asenha-warning"><strong>If something goes wrong</strong> and you need to regain access to your account as an administrator, please visit the following URL: <br /><strong>' . get_site_url( null, '/?reset-for=' ) . $current_user_username . '</strong><br /><br />If you use <strong>Ninja Firewall</strong>, please uncheck "Block attempts to gain administrative privileges" in the Firewall Policies settings before you try to view as a non-admin user role to <strong>prevent being locked out</strong> of your admin account.</div>',
3419 'class' => 'asenha-description utilities ' . $field_slug,
3420 )
3421 );
3422 // Enable Password Protection
3423 $field_id = 'enable_password_protection';
3424 $field_slug = 'enable-password-protection';
3425 add_settings_field(
3426 $field_id,
3427 // Field ID
3428 'Password Protection',
3429 // Field title
3430 [ $render_field, 'render_checkbox_toggle' ],
3431 // Callback to render field with custom arguments in the array below
3432 ASENHA_SLUG,
3433 // Settings page slug
3434 'main-section',
3435 // Section ID
3436 array(
3437 'option_name' => ASENHA_SLUG_U,
3438 'field_id' => $field_id,
3439 'field_slug' => $field_slug,
3440 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3441 'field_description' => 'Password-protect the entire site to hide the content from public view and search engine bots / crawlers. Logged-in administrators can still access the site as usual.',
3442 'field_options_moreless' => true,
3443 'field_options_wrapper' => true,
3444 'class' => 'asenha-toggle utilities ' . $field_slug,
3445 )
3446 );
3447 $field_id = 'password_protection_password';
3448 $field_slug = 'password-protection-password';
3449 add_settings_field(
3450 $field_id,
3451 // Field ID
3452 'Set the password:',
3453 // Field title
3454 [ $render_field, 'render_password_subfield' ],
3455 // Callback to render field with custom arguments in the array below
3456 ASENHA_SLUG,
3457 // Settings page slug
3458 'main-section',
3459 // Section ID
3460 array(
3461 'option_name' => ASENHA_SLUG_U,
3462 'field_id' => $field_id,
3463 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3464 'field_type' => 'with-prefix-suffix',
3465 'field_prefix' => '',
3466 'field_suffix' => '<span class="faded">(Default is \'secret\')</span>',
3467 'field_description' => '',
3468 'class' => 'asenha-text with-prefix-suffix utilities ' . $field_slug,
3469 )
3470 );
3471 // Maintenance Mode
3472 $field_id = 'maintenance_mode';
3473 $field_slug = 'maintenance-mode';
3474 add_settings_field(
3475 $field_id,
3476 // Field ID
3477 'Maintenance Mode',
3478 // Field title
3479 [ $render_field, 'render_checkbox_toggle' ],
3480 // Callback to render field with custom arguments in the array below
3481 ASENHA_SLUG,
3482 // Settings page slug
3483 'main-section',
3484 // Section ID
3485 array(
3486 'option_name' => ASENHA_SLUG_U,
3487 'field_id' => $field_id,
3488 'field_slug' => $field_slug,
3489 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3490 'field_description' => 'Show a customizable maintenance page on the frontend while performing a brief maintenance to your site. Logged-in administrators can still view the site as usual.',
3491 'field_options_wrapper' => true,
3492 'field_options_moreless' => true,
3493 'class' => 'asenha-toggle utilities ' . $field_slug,
3494 )
3495 );
3496 $field_id = 'maintenance_page_heading';
3497 $field_slug = 'maintenance-page-heading';
3498 add_settings_field(
3499 $field_id,
3500 // Field ID
3501 'Heading',
3502 // Field title
3503 [ $render_field, 'render_text_subfield' ],
3504 // Callback to render field with custom arguments in the array below
3505 ASENHA_SLUG,
3506 // Settings page slug
3507 'main-section',
3508 // Section ID
3509 array(
3510 'option_name' => ASENHA_SLUG_U,
3511 'field_id' => $field_id,
3512 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3513 'field_type' => '',
3514 'field_prefix' => '',
3515 'field_suffix' => '',
3516 'field_description' => '',
3517 'field_placeholder' => 'We\'ll be back soon.',
3518 'class' => 'asenha-text utilities full-width ' . $field_slug,
3519 )
3520 );
3521 $field_id = 'maintenance_page_description';
3522 $field_slug = 'maintenance-page-description';
3523 add_settings_field(
3524 $field_id,
3525 // Field ID
3526 'Description',
3527 // Field title
3528 [ $render_field, 'render_textarea_subfield' ],
3529 // Callback to render field with custom arguments in the array below
3530 ASENHA_SLUG,
3531 // Settings page slug
3532 'main-section',
3533 // Section ID
3534 array(
3535 'option_name' => ASENHA_SLUG_U,
3536 'field_id' => $field_id,
3537 'field_slug' => $field_slug,
3538 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3539 'field_type' => 'textarea',
3540 'field_rows' => 5,
3541 'field_intro' => '',
3542 'field_description' => '',
3543 'field_placeholder' => 'This site is undergoing maintenance for an extended period today. Thanks for your patience.',
3544 'class' => 'asenha-textarea utilities ' . $field_slug,
3545 )
3546 );
3547 $field_id = 'maintenance_page_background';
3548 $field_slug = 'maintenance-page-background';
3549 $field_radios = array(
3550 'Stripes' => 'stripes',
3551 'Curves' => 'curves',
3552 'Lines' => 'lines',
3553 );
3554 add_settings_field(
3555 $field_id,
3556 // Field ID
3557 'Background',
3558 // Field title
3559 [ $render_field, 'render_radio_buttons_subfield' ],
3560 // Callback to render field with custom arguments in the array below
3561 ASENHA_SLUG,
3562 // Settings page slug
3563 'main-section',
3564 // Section ID
3565 array(
3566 'option_name' => ASENHA_SLUG_U,
3567 'field_id' => $field_id,
3568 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3569 'field_radios' => $field_radios,
3570 'field_default' => 'default',
3571 'class' => 'asenha-radio-buttons utilities ' . $field_slug,
3572 )
3573 );
3574 $field_id = 'maintenance_mode_description';
3575 $field_slug = 'maintenance-mode-description';
3576 add_settings_field(
3577 $field_id,
3578 // Field ID
3579 '',
3580 // Field title
3581 [ $render_field, 'render_description_subfield' ],
3582 // Callback to render field with custom arguments in the array below
3583 ASENHA_SLUG,
3584 // Settings page slug
3585 'main-section',
3586 // Section ID
3587 array(
3588 'option_name' => ASENHA_SLUG_U,
3589 'field_description' => '<div class="asenha-warning"><strong>Please clear your cache</strong> after enabling or disabling maintenance mode. This ensures site visitors see either the maintenance page or the actual content of each page.</div>',
3590 'class' => 'asenha-description utilities ' . $field_slug,
3591 )
3592 );
3593 // Redirect 404 to Homepage
3594 $field_id = 'redirect_404_to_homepage';
3595 $field_slug = 'redirect-404-to-homepage';
3596 add_settings_field(
3597 $field_id,
3598 // Field ID
3599 'Redirect 404 to Homepage',
3600 // Field title
3601 [ $render_field, 'render_checkbox_toggle' ],
3602 // Callback to render field with custom arguments in the array below
3603 ASENHA_SLUG,
3604 // Settings page slug
3605 'main-section',
3606 // Section ID
3607 array(
3608 'option_name' => ASENHA_SLUG_U,
3609 'field_id' => $field_id,
3610 'field_slug' => $field_slug,
3611 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3612 'field_description' => 'Perform 301 (permanent) redirect to the homepage for all 404 (not found) pages.',
3613 'field_options_wrapper' => true,
3614 'class' => 'asenha-toggle utilities ' . $field_slug,
3615 )
3616 );
3617 // Display System Summary
3618 $field_id = 'display_system_summary';
3619 $field_slug = 'display-system-summary';
3620 add_settings_field(
3621 $field_id,
3622 // Field ID
3623 'Display System Summary',
3624 // Field title
3625 [ $render_field, 'render_checkbox_toggle' ],
3626 // Callback to render field with custom arguments in the array below
3627 ASENHA_SLUG,
3628 // Settings page slug
3629 'main-section',
3630 // Section ID
3631 array(
3632 'option_name' => ASENHA_SLUG_U,
3633 'field_id' => $field_id,
3634 'field_slug' => $field_slug,
3635 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3636 'field_description' => 'Show quick summary of the system the site is running on to admins, in the "At a Glance" dashboard widget. This includes the web server software, the PHP version, the database software and server IP address.',
3637 'field_options_wrapper' => true,
3638 'class' => 'asenha-toggle utilities ' . $field_slug,
3639 )
3640 );
3641 // Search Engines Visibility Status
3642 $field_id = 'search_engine_visibility_status';
3643 $field_slug = 'search-engine-visibility-status';
3644 add_settings_field(
3645 $field_id,
3646 // Field ID
3647 'Search Engines Visibility Status',
3648 // Field title
3649 [ $render_field, 'render_checkbox_toggle' ],
3650 // Callback to render field with custom arguments in the array below
3651 ASENHA_SLUG,
3652 // Settings page slug
3653 'main-section',
3654 // Section ID
3655 array(
3656 'option_name' => ASENHA_SLUG_U,
3657 'field_id' => $field_id,
3658 'field_slug' => $field_slug,
3659 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3660 'field_description' => 'Show admin bar status and admin notice when search engines are set to be discouraged from indexing the site. This is set through a "Search engine visibility" checkbox in Settings >> Reading.',
3661 'field_options_wrapper' => true,
3662 'class' => 'asenha-toggle utilities ' . $field_slug,
3663 )
3664 );
3665 }
3666
3667 }