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