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