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