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