PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 3.0.0
Admin and Site Enhancements (ASE) v3.0.0
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-deactivation.php 3 years ago class-disable-components.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
1112 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', // Section ID
23 '', // Section title. Can be blank.
24 '', // Callback function to output section intro. Can be blank.
25 ASENHA_SLUG // Settings page slug
26 );
27
28 // Register main setttings
29
30 // Instantiate object for sanitization of settings fields values
31 $sanitization = new Settings_Sanitization;
32
33 // Instantiate object for rendering of settings fields for the admin page
34 $render_field = new Settings_Fields_Render;
35
36 register_setting(
37 ASENHA_ID, // Option group or option_page
38 ASENHA_SLUG_U, // Option name in wp_options table
39 array(
40 'type' => 'array', // 'string', 'boolean', 'integer', 'number', 'array', or 'object'
41 'description' => '', // A description of the data attached to this setting.
42 'sanitize_callback' => [ $sanitization, 'sanitize_for_options' ],
43 'show_in_rest' => false,
44 'default' => array(), // When calling get_option()
45 )
46 );
47
48 // Call WordPress globals required for the fields
49
50 global $wp_roles, $wpdb, $asenha_public_post_types, $asenha_gutenberg_post_types;
51
52 $roles = $wp_roles->get_names();
53
54 // Get array of slugs and plural labels for public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
55 $asenha_public_post_types = array();
56 $public_post_type_names = get_post_types( array( 'public' => true ), 'names' );
57 foreach( $public_post_type_names as $post_type_name ) {
58 $post_type_object = get_post_type_object( $post_type_name );
59 $asenha_public_post_types[$post_type_name] = $post_type_object->label;
60 }
61
62 // 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' )
63 $asenha_gutenberg_post_types = array();
64 $gutenberg_not_applicable_types = array( 'attachment', 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache', 'user_request', 'wp_block' );
65 $all_post_types = get_post_types( array(), 'objects' );
66 foreach ( $all_post_types as $post_type_slug => $post_type_info ) {
67 $asenha_gutenberg_post_types[$post_type_slug] = $post_type_info->label;
68 if ( in_array( $post_type_slug, $gutenberg_not_applicable_types ) ) {
69 unset( $asenha_gutenberg_post_types[$post_type_slug] );
70 }
71 }
72
73 // ===== CONTENT MANAGEMENT =====
74
75 // Enable Page and Post Duplication
76
77 $field_id = 'enable_duplication';
78 $field_slug = 'enable-duplication';
79
80 add_settings_field(
81 $field_id, // Field ID
82 'Enable Page and Post Duplication', // Field title
83 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
84 ASENHA_SLUG, // Settings page slug
85 'main-section', // Section ID
86 array(
87 'field_id' => $field_id, // Custom argument
88 'field_slug' => $field_slug, // Custom argument
89 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
90 'field_description' => 'Enable one-click duplication of pages, posts and custom posts. The corresponding taxonomy terms and post meta will also be duplicated.', // Custom argument
91 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
92 )
93 );
94
95 // Enable Media Replacement
96
97 $field_id = 'enable_media_replacement';
98 $field_slug = 'enable-media-replacement';
99
100 add_settings_field(
101 $field_id, // Field ID
102 'Enable Media Replacement', // Field title
103 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
104 ASENHA_SLUG, // Settings page slug
105 'main-section', // Section ID
106 array(
107 'field_id' => $field_id, // Custom argument
108 'field_slug' => $field_slug, // Custom argument
109 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
110 '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.', // Custom argument
111 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
112 )
113 );
114
115 // Enable SVG Upload
116
117 $field_id = 'enable_svg_upload';
118 $field_slug = 'enable-svg-upload';
119
120 add_settings_field(
121 $field_id, // Field ID
122 'Enable SVG Upload', // Field title
123 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
124 ASENHA_SLUG, // Settings page slug
125 'main-section', // Section ID
126 array(
127 'field_id' => $field_id, // Custom argument
128 'field_slug' => $field_slug, // Custom argument
129 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
130 'field_description' => 'Allow some or all user roles to upload SVG files, which will then be sanitized to keep things secure.', // Custom argument
131 'field_options_wrapper' => true, // Custom argument. Add container for additional options
132 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
133 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
134 )
135 );
136
137 $field_id = 'enable_svg_upload_for';
138 $field_slug = 'enable-svg-upload-for';
139
140 if ( is_array( $roles ) ) {
141 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
142
143 add_settings_field(
144 $field_id . '_' . $role_slug, // Field ID
145 '', // Field title
146 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
147 ASENHA_SLUG, // Settings page slug
148 'main-section', // Section ID
149 array(
150 'parent_field_id' => $field_id, // Custom argument
151 'field_id' => $role_slug, // Custom argument
152 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
153 'field_label' => $role_label, // Custom argument
154 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
155 )
156 );
157
158 }
159 }
160
161 // Enhance List Tables
162
163 $field_id = 'enhance_list_tables';
164 $field_slug = 'enhance-list-tables';
165
166 add_settings_field(
167 $field_id, // Field ID
168 'Enhance List Tables', // Field title
169 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
170 ASENHA_SLUG, // Settings page slug
171 'main-section', // Section ID
172 array(
173 'field_id' => $field_id, // Custom argument
174 'field_slug' => $field_slug, // Custom argument
175 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
176 'field_description' => 'Improve the usefulness of listing pages of various post types by adding / removing columns and elements.', // Custom argument
177 'field_options_wrapper' => true, // Custom argument. Add container for additional options
178 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
179 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
180 )
181 );
182
183 // Show Featured Image Column
184
185 $field_id = 'show_featured_image_column';
186 $field_slug = 'show-featured-image-column';
187
188 add_settings_field(
189 $field_id, // Field ID
190 '', // Field title
191 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
192 ASENHA_SLUG, // Settings page slug
193 'main-section', // Section ID
194 array(
195 'field_id' => $field_id, // Custom argument
196 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
197 'field_label' => 'Show featured image column.', // Custom argument
198 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
199 )
200 );
201
202 // Show Excerpt Column
203
204 $field_id = 'show_excerpt_column';
205 $field_slug = 'show-excerpt-column';
206
207 add_settings_field(
208 $field_id, // Field ID
209 '', // Field title
210 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
211 ASENHA_SLUG, // Settings page slug
212 'main-section', // Section ID
213 array(
214 'field_id' => $field_id, // Custom argument
215 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
216 'field_label' => 'Show excerpt column.', // Custom argument
217 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
218 )
219 );
220
221 // Show ID Column
222
223 $field_id = 'show_id_column';
224 $field_slug = 'show-id-column';
225
226 add_settings_field(
227 $field_id, // Field ID
228 '', // Field title
229 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
230 ASENHA_SLUG, // Settings page slug
231 'main-section', // Section ID
232 array(
233 'field_id' => $field_id, // Custom argument
234 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
235 'field_label' => 'Show ID column.', // Custom argument
236 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
237 )
238 );
239
240 // Hide Comments Column
241
242 $field_id = 'hide_comments_column';
243 $field_slug = 'hide-comments-column';
244
245 add_settings_field(
246 $field_id, // Field ID
247 '', // Field title
248 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
249 ASENHA_SLUG, // Settings page slug
250 'main-section', // Section ID
251 array(
252 'field_id' => $field_id, // Custom argument
253 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
254 'field_label' => 'Remove comments column.', // Custom argument
255 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
256 )
257 );
258
259 // Hide Post Tags Column
260
261 $field_id = 'hide_post_tags_column';
262 $field_slug = 'hide-post-tags-column';
263
264 add_settings_field(
265 $field_id, // Field ID
266 '', // Field title
267 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
268 ASENHA_SLUG, // Settings page slug
269 'main-section', // Section ID
270 array(
271 'field_id' => $field_id, // Custom argument
272 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
273 'field_label' => 'Remove tags column (for posts).', // Custom argument
274 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
275 )
276 );
277
278 // Show Custom Taxonomy Filters
279
280 $field_id = 'show_custom_taxonomy_filters';
281 $field_slug = 'show-custom-taxonomy-filters';
282
283 add_settings_field(
284 $field_id, // Field ID
285 '', // Field title
286 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
287 ASENHA_SLUG, // Settings page slug
288 'main-section', // Section ID
289 array(
290 'field_id' => $field_id, // Custom argument
291 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
292 'field_label' => 'Show additional filter(s) for hierarchical, custom taxonomies.', // Custom argument
293 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
294 )
295 );
296
297 // ===== ADMIN INTERFACE =====
298
299 // Hide Admin Notices
300
301 $field_id = 'hide_admin_notices';
302 $field_slug = 'hide-admin-notices';
303
304 add_settings_field(
305 $field_id, // Field ID
306 'Hide Admin Notices', // Field title
307 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
308 ASENHA_SLUG, // Settings page slug
309 'main-section', // Section ID
310 array(
311 'field_id' => $field_id, // Custom argument
312 'field_slug' => $field_slug, // Custom argument
313 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
314 'field_description' => 'Clean up admin pages by moving notices into a separate panel easily accessible via the admin bar.', // Custom argument
315 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
316 )
317 );
318
319 // View Admin as Role
320
321 $field_id = 'view_admin_as_role';
322 $field_slug = 'view-admin-as-role';
323
324 add_settings_field(
325 $field_id, // Field ID
326 'View Admin as Role', // Field title
327 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
328 ASENHA_SLUG, // Settings page slug
329 'main-section', // Section ID
330 array(
331 'field_id' => $field_id, // Custom argument
332 'field_slug' => $field_slug, // Custom argument
333 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
334 'field_description' => 'View admin pages and the site (logged-in) as one of the non-administrator user roles.', // Custom argument
335 'field_options_wrapper' => true, // Custom argument. Add container for additional options
336 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
337 )
338 );
339
340 // Hide or Modify Elements
341
342 $field_id = 'hide_modify_elements';
343 $field_slug = 'hide-modify-elements';
344
345 add_settings_field(
346 $field_id, // Field ID
347 'Clean Up Admin Bar', // Field title
348 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
349 ASENHA_SLUG, // Settings page slug
350 'main-section', // Section ID
351 array(
352 'field_id' => $field_id, // Custom argument
353 'field_slug' => $field_slug, // Custom argument
354 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
355 'field_description' => 'Remove various elements from the admin bar.', // Custom argument
356 'field_options_wrapper' => true, // Custom argument. Add container for additional options
357 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
358 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
359 )
360 );
361
362 $field_id = 'hide_ab_wp_logo_menu';
363 $field_slug = 'hide-ab-wp-logo-menu';
364
365 add_settings_field(
366 $field_id, // Field ID
367 '', // Field title
368 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
369 ASENHA_SLUG, // Settings page slug
370 'main-section', // Section ID
371 array(
372 'field_id' => $field_id, // Custom argument
373 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
374 'field_label' => 'Remove WordPress logo/menu', // Custom argument
375 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
376 )
377 );
378
379 $field_id = 'hide_ab_customize_menu';
380 $field_slug = 'hide-ab-customize-menu';
381
382 add_settings_field(
383 $field_id, // Field ID
384 '', // Field title
385 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
386 ASENHA_SLUG, // Settings page slug
387 'main-section', // Section ID
388 array(
389 'field_id' => $field_id, // Custom argument
390 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
391 'field_label' => 'Remove customize menu', // Custom argument
392 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
393 )
394 );
395
396 $field_id = 'hide_ab_updates_menu';
397 $field_slug = 'hide-ab-updates-menu';
398
399 add_settings_field(
400 $field_id, // Field ID
401 '', // Field title
402 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
403 ASENHA_SLUG, // Settings page slug
404 'main-section', // Section ID
405 array(
406 'field_id' => $field_id, // Custom argument
407 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
408 'field_label' => 'Remove updates counter/link', // Custom argument
409 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
410 )
411 );
412
413 $field_id = 'hide_ab_comments_menu';
414 $field_slug = 'hide-ab-comments-menu';
415
416 add_settings_field(
417 $field_id, // Field ID
418 '', // Field title
419 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
420 ASENHA_SLUG, // Settings page slug
421 'main-section', // Section ID
422 array(
423 'field_id' => $field_id, // Custom argument
424 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
425 'field_label' => 'Remove comments counter/link', // Custom argument
426 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
427 )
428 );
429
430 $field_id = 'hide_ab_new_content_menu';
431 $field_slug = 'hide-ab-new-content-menu';
432
433 add_settings_field(
434 $field_id, // Field ID
435 '', // Field title
436 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
437 ASENHA_SLUG, // Settings page slug
438 'main-section', // Section ID
439 array(
440 'field_id' => $field_id, // Custom argument
441 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
442 'field_label' => 'Remove new content menu', // Custom argument
443 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
444 )
445 );
446
447 $field_id = 'hide_ab_howdy';
448 $field_slug = 'hide-ab-howdy';
449
450 add_settings_field(
451 $field_id, // Field ID
452 '', // Field title
453 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
454 ASENHA_SLUG, // Settings page slug
455 'main-section', // Section ID
456 array(
457 'field_id' => $field_id, // Custom argument
458 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
459 'field_label' => 'Remove \'Howdy\'', // Custom argument
460 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
461 )
462 );
463
464 // Hide Admin Bar
465
466 $field_id = 'hide_admin_bar';
467 $field_slug = 'hide-admin-bar';
468
469 add_settings_field(
470 $field_id, // Field ID
471 'Hide Admin Bar', // Field title
472 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
473 ASENHA_SLUG, // Settings page slug
474 'main-section', // Section ID
475 array(
476 'field_id' => $field_id, // Custom argument
477 'field_slug' => $field_slug, // Custom argument
478 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
479 'field_description' => 'Hide admin bar on the front end for all or some user roles.', // Custom argument
480 'field_options_wrapper' => true, // Custom argument. Add container for additional options
481 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
482 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
483 )
484 );
485
486 $field_id = 'hide_admin_bar_for';
487 $field_slug = 'hide-admin-bar-for';
488
489 if ( is_array( $roles ) ) {
490 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
491
492 add_settings_field(
493 $field_id . '_' . $role_slug, // Field ID
494 '', // Field title
495 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
496 ASENHA_SLUG, // Settings page slug
497 'main-section', // Section ID
498 array(
499 'parent_field_id' => $field_id, // Custom argument
500 'field_id' => $role_slug, // Custom argument
501 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
502 'field_label' => $role_label, // Custom argument
503 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
504 )
505 );
506
507 }
508 }
509
510 // Customize Admin Menu
511
512 $field_id = 'customize_admin_menu';
513 $field_slug = 'customize-admin-menu';
514
515 add_settings_field(
516 $field_id, // Field ID
517 'Admin Menu Organizer', // Field title
518 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
519 ASENHA_SLUG, // Settings page slug
520 'main-section', // Section ID
521 array(
522 'field_id' => $field_id, // Custom argument
523 'field_slug' => $field_slug, // Custom argument
524 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
525 'field_description' => 'Customize the order of the admin menu and optionally change menu item title or hide some items.', // Custom argument
526 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
527 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
528 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
529 )
530 );
531
532 $field_id = 'custom_menu_order';
533 $field_slug = 'custom-menu-order';
534
535 add_settings_field(
536 $field_id, // Field ID
537 '', // Field title
538 [ $render_field, 'render_sortable_menu' ], // Callback to render field with custom arguments in the array below
539 ASENHA_SLUG, // Settings page slug
540 'main-section', // Section ID
541 array(
542 'field_id' => $field_id, // Custom argument
543 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
544 'field_type' => 'sortable-menu', // Custom argument
545 'field_description' => '', // Custom argument
546 'class' => 'asenha-sortable asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
547 )
548 );
549
550 // ===== DISABLE COMPONENTS =====
551
552 // Disable Gutenberg
553
554 $field_id = 'disable_gutenberg';
555 $field_slug = 'disable-gutenberg';
556
557 add_settings_field(
558 $field_id, // Field ID
559 'Disable Gutenberg', // Field title
560 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
561 ASENHA_SLUG, // Settings page slug
562 'main-section', // Section ID
563 array(
564 'field_id' => $field_id, // Custom argument
565 'field_slug' => $field_slug, // Custom argument
566 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
567 'field_description' => 'Disable the Gutenberg block editor for some or all applicable post types.', // Custom argument
568 'field_options_wrapper' => true, // Custom argument. Add container for additional options
569 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
570 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
571 )
572 );
573
574 $field_id = 'disable_gutenberg_for';
575 $field_slug = 'disable-gutenberg-for';
576
577 if ( is_array( $asenha_gutenberg_post_types ) ) {
578 foreach ( $asenha_gutenberg_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
579 add_settings_field(
580 $field_id . '_' . $post_type_slug, // Field ID
581 '', // Field title
582 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
583 ASENHA_SLUG, // Settings page slug
584 'main-section', // Section ID
585 array(
586 'parent_field_id' => $field_id, // Custom argument
587 'field_id' => $post_type_slug, // Custom argument
588 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
589 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
590 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
591 )
592 );
593 }
594 }
595
596 $field_id = 'disable_gutenberg_frontend_styles';
597 $field_slug = 'disable-gutenberg-frontend-styles';
598
599 add_settings_field(
600 $field_id, // Field ID
601 '', // Field title
602 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
603 ASENHA_SLUG, // Settings page slug
604 'main-section', // Section ID
605 array(
606 'field_id' => $field_id, // Custom argument
607 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
608 'field_label' => 'Also disable frontend block styles / CSS files for the selected post types.', // Custom argument
609 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-top disable-components ' . $field_slug, // Custom class for the <tr> element
610 )
611 );
612
613 // Disable Comments
614
615 $field_id = 'disable_comments';
616 $field_slug = 'disable-comments';
617
618 add_settings_field(
619 $field_id, // Field ID
620 'Disable Comments', // Field title
621 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
622 ASENHA_SLUG, // Settings page slug
623 'main-section', // Section ID
624 array(
625 'field_id' => $field_id, // Custom argument
626 'field_slug' => $field_slug, // Custom argument
627 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
628 'field_description' => 'Disable comments for some or all public post types. When disabled, existing comments will also be hidden on the frontend.', // Custom argument
629 'field_options_wrapper' => true, // Custom argument. Add container for additional options
630 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
631 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
632 )
633 );
634
635 $field_id = 'disable_comments_for';
636 $field_slug = 'disable-comments-for';
637
638 if ( is_array( $asenha_public_post_types ) ) {
639 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
640 add_settings_field(
641 $field_id . '_' . $post_type_slug, // Field ID
642 '', // Field title
643 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
644 ASENHA_SLUG, // Settings page slug
645 'main-section', // Section ID
646 array(
647 'parent_field_id' => $field_id, // Custom argument
648 'field_id' => $post_type_slug, // Custom argument
649 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
650 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
651 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
652 )
653 );
654 }
655 }
656
657 // Disable REST API
658
659 $field_id = 'disable_rest_api';
660 $field_slug = 'disable-rest-api';
661
662 add_settings_field(
663 $field_id, // Field ID
664 'Disable REST API', // Field title
665 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
666 ASENHA_SLUG, // Settings page slug
667 'main-section', // Section ID
668 array(
669 'field_id' => $field_id, // Custom argument
670 'field_slug' => $field_slug, // Custom argument
671 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
672 'field_description' => 'Disable REST API access for non-authenticated users and remove URL traces from <head>, HTTP headers and WP RSD endpoint.', // Custom argument
673 'field_options_wrapper' => true, // Custom argument. Add container for additional options
674 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
675 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
676 )
677 );
678
679 // Disable Feeds
680
681 $field_id = 'disable_feeds';
682 $field_slug = 'disable-feeds';
683
684 add_settings_field(
685 $field_id, // Field ID
686 'Disable Feeds', // Field title
687 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
688 ASENHA_SLUG, // Settings page slug
689 'main-section', // Section ID
690 array(
691 'field_id' => $field_id, // Custom argument
692 'field_slug' => $field_slug, // Custom argument
693 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
694 '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;.', // Custom argument
695 'field_options_wrapper' => true, // Custom argument. Add container for additional options
696 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
697 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
698 )
699 );
700
701 // ===== SECURITY =====
702
703 // Change Login URL
704
705 $field_id = 'change_login_url';
706 $field_slug = 'change-login-url';
707
708 add_settings_field(
709 $field_id, // Field ID
710 'Change Login URL', // Field title
711 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
712 ASENHA_SLUG, // Settings page slug
713 'main-section', // Section ID
714 array(
715 'field_id' => $field_id, // Custom argument
716 'field_slug' => $field_slug, // Custom argument
717 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
718 'field_description' => 'Default is ' . get_site_url() . '/wp-admin/', // Custom argument
719 'field_options_wrapper' => true, // Custom argument. Add container for additional options
720 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
721 )
722 );
723
724 $field_id = 'custom_login_slug';
725 $field_slug = 'custom-login-slug';
726
727 add_settings_field(
728 $field_id, // Field ID
729 'New URL:', // Field title
730 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
731 ASENHA_SLUG, // Settings page slug
732 'main-section', // Section ID
733 array(
734 'field_id' => $field_id, // Custom argument
735 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
736 'field_type' => 'with-prefix-suffix', // Custom argument
737 'field_prefix' => get_site_url() . '/', // Custom argument
738 'field_suffix' => '/', // Custom argument
739 'field_description' => '', // Custom argument
740 'class' => 'asenha-text with-prefix-suffix security ' . $field_slug, // Custom class for the <tr> element
741 )
742 );
743
744 // Limit Login Attempts
745
746 $field_id = 'limit_login_attempts';
747 $field_slug = 'limit-login-attempts';
748
749 add_settings_field(
750 $field_id, // Field ID
751 'Limit Login Attempts', // Field title
752 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
753 ASENHA_SLUG, // Settings page slug
754 'main-section', // Section ID
755 array(
756 'field_id' => $field_id, // Custom argument
757 'field_slug' => $field_slug, // Custom argument
758 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
759 'field_description' => 'Prevent brute force attacks by limiting the number of failed login attempts allowed per IP address.', // Custom argument
760 'field_options_wrapper' => true, // Custom argument. Add container for additional options
761 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
762 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
763 )
764 );
765
766 $field_id = 'login_fails_allowed';
767 $field_slug = 'login-fails-allowed';
768
769 add_settings_field(
770 $field_id, // Field ID
771 '', // Field title
772 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
773 ASENHA_SLUG, // Settings page slug
774 'main-section', // Section ID
775 array(
776 'field_id' => $field_id, // Custom argument
777 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
778 'field_type' => 'with-prefix-suffix', // Custom argument
779 'field_prefix' => '', // Custom argument
780 'field_suffix' => 'failed login attempts allowed before 15 minutes lockout', // Custom argument
781 'field_description' => '', // Custom argument
782 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug, // Custom class for the <tr> element
783 )
784 );
785
786 $field_id = 'login_lockout_maxcount';
787 $field_slug = 'login-lockout-maxcount';
788
789 add_settings_field(
790 $field_id, // Field ID
791 '', // Field title
792 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
793 ASENHA_SLUG, // Settings page slug
794 'main-section', // Section ID
795 array(
796 'field_id' => $field_id, // Custom argument
797 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
798 'field_type' => 'with-prefix-suffix', // Custom argument
799 'field_prefix' => '', // Custom argument
800 'field_suffix' => 'lockout(s) will block further login attempts for 24 hours', // Custom argument
801 'field_description' => '', // Custom argument
802 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug, // Custom class for the <tr> element
803 )
804 );
805
806 $field_id = 'login_attempts_log_table';
807 $field_slug = 'login-attempts-log-table';
808
809 add_settings_field(
810 $field_id, // Field ID
811 '', // Field title
812 [ $render_field, 'render_datatable' ], // Callback to render field with custom arguments in the array below
813 ASENHA_SLUG, // Settings page slug
814 'main-section', // Section ID
815 array(
816 'field_id' => $field_id, // Custom argument
817 'field_slug' => $field_slug, // Custom argument
818 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
819 'field_type' => 'datatable', // Custom argument
820 'field_description' => '', // Custom argument
821 'class' => 'asenha-text datatable asenha-hide-th security ' . $field_slug, // Custom class for the <tr> element
822 'table_title' => 'Failed Login Attempts Log',
823 'table_name' => $wpdb->prefix . 'asenha_failed_logins',
824 )
825 );
826
827 // Obfuscate Author Slugs
828
829 $field_id = 'obfuscate_author_slugs';
830 $field_slug = 'obfuscate-author-slugs';
831
832 add_settings_field(
833 $field_id, // Field ID
834 'Obfuscate Author Slugs', // Field title
835 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
836 ASENHA_SLUG, // Settings page slug
837 'main-section', // Section ID
838 array(
839 'field_id' => $field_id, // Custom argument
840 'field_slug' => $field_slug, // Custom argument
841 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
842 '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.', // Custom argument
843 'field_options_wrapper' => false, // Custom argument. Add container for additional options
844 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
845 )
846 );
847
848 // Disable XML-RPC
849
850 $field_id = 'disable_xmlrpc';
851 $field_slug = 'disable-xmlrpc';
852
853 add_settings_field(
854 $field_id, // Field ID
855 'Disable XML-RPC', // Field title
856 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
857 ASENHA_SLUG, // Settings page slug
858 'main-section', // Section ID
859 array(
860 'field_id' => $field_id, // Custom argument
861 'field_slug' => $field_slug, // Custom argument
862 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
863 '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. ', // Custom argument
864 'field_options_wrapper' => false, // Custom argument. Add container for additional options
865 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
866 )
867 );
868
869 // ===== UTILITIES ======
870
871 // Redirect After Login
872
873 $field_id = 'redirect_after_login';
874 $field_slug = 'redirect-after-login';
875
876 add_settings_field(
877 $field_id, // Field ID
878 'Redirect After Login', // Field title
879 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
880 ASENHA_SLUG, // Settings page slug
881 'main-section', // Section ID
882 array(
883 'field_id' => $field_id, // Custom argument
884 'field_slug' => $field_slug, // Custom argument
885 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
886 'field_description' => 'Set custom redirect URL for all or some user roles after login.', // Custom argument
887 'field_options_wrapper' => true, // Custom argument. Add container for additional options
888 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
889 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
890 )
891 );
892
893 $field_id = 'redirect_after_login_to_slug';
894 $field_slug = 'redirect-after-login-to-slug';
895
896 add_settings_field(
897 $field_id, // Field ID
898 'Redirect to:', // Field title
899 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
900 ASENHA_SLUG, // Settings page slug
901 'main-section', // Section ID
902 array(
903 'field_id' => $field_id, // Custom argument
904 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
905 'field_type' => 'with-prefix-suffix', // Custom argument
906 'field_prefix' => get_site_url() . '/', // Custom argument
907 'field_suffix' => '/ for:', // Custom argument
908 'field_description' => '', // Custom argument
909 'class' => 'asenha-text with-prefix-suffix utilities ' . $field_slug, // Custom class for the <tr> element
910 )
911 );
912
913 $field_id = 'redirect_after_login_for';
914 $field_slug = 'redirect-after-login-for';
915
916 if ( is_array( $roles ) ) {
917 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
918
919 add_settings_field(
920 $field_id . '_' . $role_slug, // Field ID
921 '', // Field title
922 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
923 ASENHA_SLUG, // Settings page slug
924 'main-section', // Section ID
925 array(
926 'parent_field_id' => $field_id, // Custom argument
927 'field_id' => $role_slug, // Custom argument
928 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
929 'field_label' => $role_label, // Custom argument
930 'class' => 'asenha-checkbox asenha-hide-th asenha-half utilities ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
931 )
932 );
933
934 }
935 }
936
937 // Redirect After Logout
938
939 $field_id = 'redirect_after_logout';
940 $field_slug = 'redirect-after-logout';
941
942 add_settings_field(
943 $field_id, // Field ID
944 'Redirect After Logout', // Field title
945 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
946 ASENHA_SLUG, // Settings page slug
947 'main-section', // Section ID
948 array(
949 'field_id' => $field_id, // Custom argument
950 'field_slug' => $field_slug, // Custom argument
951 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
952 'field_description' => 'Set custom redirect URL for all or some user roles after logout.', // Custom argument
953 'field_options_wrapper' => true, // Custom argument. Add container for additional options
954 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
955 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
956 )
957 );
958
959 $field_id = 'redirect_after_logout_to_slug';
960 $field_slug = 'redirect-after-logout-to-slug';
961
962 add_settings_field(
963 $field_id, // Field ID
964 'Redirect to:', // Field title
965 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
966 ASENHA_SLUG, // Settings page slug
967 'main-section', // Section ID
968 array(
969 'field_id' => $field_id, // Custom argument
970 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
971 'field_type' => 'with-prefix-suffix', // Custom argument
972 'field_prefix' => get_site_url() . '/', // Custom argument
973 'field_suffix' => '/ for:', // Custom argument
974 'field_description' => '', // Custom argument
975 'class' => 'asenha-text with-prefix-suffix utilities ' . $field_slug, // Custom class for the <tr> element
976 )
977 );
978
979 $field_id = 'redirect_after_logout_for';
980 $field_slug = 'redirect-after-logout-for';
981
982 if ( is_array( $roles ) ) {
983 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
984
985 add_settings_field(
986 $field_id . '_' . $role_slug, // Field ID
987 '', // Field title
988 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
989 ASENHA_SLUG, // Settings page slug
990 'main-section', // Section ID
991 array(
992 'parent_field_id' => $field_id, // Custom argument
993 'field_id' => $role_slug, // Custom argument
994 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
995 'field_label' => $role_label, // Custom argument
996 'class' => 'asenha-checkbox asenha-hide-th asenha-half utilities ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
997 )
998 );
999
1000 }
1001 }
1002
1003 // Redirect 404 to Homepage
1004
1005 $field_id = 'redirect_404_to_homepage';
1006 $field_slug = 'redirect-404-to-homepage';
1007
1008 add_settings_field(
1009 $field_id, // Field ID
1010 'Redirect 404 to Homepage', // Field title
1011 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1012 ASENHA_SLUG, // Settings page slug
1013 'main-section', // Section ID
1014 array(
1015 'field_id' => $field_id, // Custom argument
1016 'field_slug' => $field_slug, // Custom argument
1017 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1018 'field_description' => 'Perform 301 (permanent) redirect to the homepage for all 404 (not found) pages.', // Custom argument
1019 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1020 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
1021 )
1022 );
1023
1024 // Enable Custom Admin CSS
1025
1026 $field_id = 'enable_custom_admin_css';
1027 $field_slug = 'enable-custom-admin-css';
1028
1029 add_settings_field(
1030 $field_id, // Field ID
1031 'Enable Custom Admin CSS', // Field title
1032 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1033 ASENHA_SLUG, // Settings page slug
1034 'main-section', // Section ID
1035 array(
1036 'field_id' => $field_id, // Custom argument
1037 'field_slug' => $field_slug, // Custom argument
1038 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1039 'field_description' => 'Add custom CSS on all admin pages for all user roles.', // Custom argument
1040 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1041 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1042 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
1043 )
1044 );
1045
1046 $field_id = 'custom_admin_css';
1047 $field_slug = 'custom-admin-css';
1048
1049 add_settings_field(
1050 $field_id, // Field ID
1051 '', // Field title
1052 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1053 ASENHA_SLUG, // Settings page slug
1054 'main-section', // Section ID
1055 array(
1056 'field_id' => $field_id, // Custom argument
1057 'field_slug' => $field_slug, // Custom argument
1058 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1059 'field_type' => 'textarea', // Custom argument
1060 'field_prefix' => '', // Custom argument
1061 'field_suffix' => '', // Custom argument
1062 'field_description' => '', // Custom argument
1063 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted utilities ' . $field_slug, // Custom class for the <tr> element
1064 )
1065 );
1066
1067 // Enable Custom Frontend CSS
1068
1069 $field_id = 'enable_custom_frontend_css';
1070 $field_slug = 'enable-custom-frontend-css';
1071
1072 add_settings_field(
1073 $field_id, // Field ID
1074 'Enable Custom Frontend CSS', // Field title
1075 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1076 ASENHA_SLUG, // Settings page slug
1077 'main-section', // Section ID
1078 array(
1079 'field_id' => $field_id, // Custom argument
1080 'field_slug' => $field_slug, // Custom argument
1081 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1082 'field_description' => 'Add custom CSS on all frontend pages for all user roles.', // Custom argument
1083 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1084 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1085 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
1086 )
1087 );
1088
1089 $field_id = 'custom_frontend_css';
1090 $field_slug = 'custom-frontend-css';
1091
1092 add_settings_field(
1093 $field_id, // Field ID
1094 '', // Field title
1095 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1096 ASENHA_SLUG, // Settings page slug
1097 'main-section', // Section ID
1098 array(
1099 'field_id' => $field_id, // Custom argument
1100 'field_slug' => $field_slug, // Custom argument
1101 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1102 'field_type' => 'textarea', // Custom argument
1103 'field_prefix' => '', // Custom argument
1104 'field_suffix' => '', // Custom argument
1105 'field_description' => '', // Custom argument
1106 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted utilities ' . $field_slug, // Custom class for the <tr> element
1107 )
1108 );
1109
1110 }
1111
1112 }