PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.1.15
Adminify – White Label, Admin Menu Editor, Login Customizer v4.1.15
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Admin / Options / Productivity.php

Productivity.php in Adminify – White Label, Admin Menu Editor, Login Customizer 4.1.15, at Inc/Admin/Options/Productivity.php

747 lines 27.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Admin\Options;
4
5 use WPAdminify\Inc\Classes\Helper;
6 use WPAdminify\Inc\Utils;
7 use WPAdminify\Inc\Admin\Options\Productivity\Duplicate_Post;
8 use WPAdminify\Inc\Admin\Options\Productivity\PostTypesOrder;
9 use WPAdminify\Inc\Admin\AdminSettingsModel;
10
11
12 if (!defined('ABSPATH')) {
13 die;
14 } // Cannot access directly.
15
16 if (!class_exists('Productivity')) {
17 class Productivity extends AdminSettingsModel
18 {
19 public function __construct()
20 {
21 $this->productivity_settings();
22 }
23
24 protected function get_defaults()
25 {
26 return [
27 // Admin Notices
28 'hide_notices' => false,
29 'hide_notices_non_admin' => false,
30 'other_notices' => [],
31 'screen_help_tab' => [
32 'enable_for_screen' => false,
33 'screen_help_data' => []
34 ],
35
36 'media_attachments' => [
37 'enable_media' => false,
38 'media_ininite_scroll' => false,
39 'media_replace' => false,
40 'media_replace_backup_limit' => 1,
41 'thumbnails_rss_feed' => false,
42 // 'allowed_upload_files' => [],
43 // 'convert_to_webp' => false,
44 // 'featured_to_post' => false,
45 // 'media_lowercase' => false,
46 ],
47 'folders' => [
48 'enable_folders' => false,
49 'enable_for' => [ 'post', 'page' ],
50 'media' => false,
51 ],
52 'admin_pages' => false,
53 'dashboard_widgets' => false,
54 'post_types_order' => [
55 'enable_pto' => false,
56 'pto_taxonomies' => [],
57 'pto_posts' => [ 'page' ],
58 'pto_media' => false,
59 ],
60 'menu_duplicator' => false,
61 'post_duplicator' => [
62 'enable_post_duplicator' => false,
63 'post_types' => ['page'],
64 'taxonomies' => [],
65 ],
66 // Post Columns
67 'custom_admin_columns' => [
68 'enable' => false,
69 'post_page_column_thumb_image' => [],
70 'columns_data' => [],
71 'slug_column_post_types' => [],
72 ],
73
74 // Sidebar Widgets
75 'remove_widgets' => [
76 'remove_widgets_type' => 'sidebar',
77 'disable_gutenberg_editor' => false,
78 'sidebar_widgets_list' => [],
79 'dashboard_widgets_list' => [],
80 // 'sidebar_widgets_user_roles' => [],
81 ],
82 ];
83 }
84
85
86 /**
87 * Admin Notices: Settings
88 */
89 public function admin_notices_settings(&$fields)
90 {
91 $fields[] = [
92 'id' => 'productivity_sub_heading',
93 'type' => 'subheading',
94 'content' => Utils::adminfiy_help_urls(
95 '<span></span>',
96 'https://wpadminify.com/docs/adminify/productivity/hide-admin-notices',
97 'https://www.youtube.com/watch?v=49Cd3dYzYHs',
98 'https://www.facebook.com/groups/jeweltheme',
99 \WPAdminify\Inc\Admin\AdminSettings::support_url()
100 ),
101 ];
102
103 $fields[] = [
104 'id' => 'hide_notices',
105 'type' => 'switcher',
106 'title' => sprintf(__('Hide "Admin Notices"? %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
107 'subtitle' => __('Hide Admin Notices to make your Dashboard Clean. ', 'adminify'),
108 'class' => 'adminify-pro-fieldset adminify-pro-notice',
109 'text_on' => __('Yes', 'adminify'),
110 'text_off' => __('No', 'adminify'),
111 'text_width' => 80,
112 'default' => $this->get_default_field('hide_notices'),
113 ];
114 $fields[] = [
115 'id' => 'hide_notices_non_admin',
116 'type' => 'checkbox',
117 'label' => sprintf(__('Also, Hide for Non-Admin Users? %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
118 'title' => ' ',
119 'default' => $this->get_default_field('hide_notices_non_admin'),
120 'dependency' => ['hide_notices', '==', 'true', 'true'],
121 ];
122
123 $other_notices_data = [
124 'welcome_panel' => sprintf(__('Remove Welcome Panel %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
125 'php_nag' => sprintf(__('Remove "PHP Update Required" Notice %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
126 'core_update_notice' => sprintf(__('Hide Core Update Notice %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
127 'plugin_update_notice' => sprintf(__('Hide Plugin Update Notice %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
128 'theme_update_notice' => sprintf(__('Hide Theme Update Notice %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
129 'site_health' => sprintf(__('Disable Site Health checks %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
130 ];
131
132 $fields[] = [
133 'id' => 'other_notices',
134 'type' => 'checkbox',
135 'title' => sprintf(__('Other Notices %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
136 'subtitle' => __('Show/Remove Dashboard Welcome Panel, Hide WordPress Themes,Plugins,Core Update Notices', 'adminify'),
137 'options' => $other_notices_data,
138 'default' => $this->get_default_field('other_notices'),
139 'dependency' => ['hide_notices', '==', 'true', 'true'],
140 ];
141 }
142
143
144 /**
145 * Screen & Help Tab
146 */
147 public function screen_options(&$fields)
148 {
149 $screen_options_settings = [
150 'hide_screen_options' => sprintf(__('Hide Screen Options %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
151 'hide_help_tab' => sprintf(__('Hide Help Tab %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
152 ];
153
154 $fields[] = [
155 'id' => 'screen_help_tab',
156 'title' => sprintf(__('Screen Options and Help Tab %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
157 'subtitle' => __('Screen Options and Help Tab', 'adminify'),
158 'type' => 'fieldset',
159 'fields' => [
160 [
161 'id' => 'enable_for_screen',
162 'type' => 'switcher',
163 'title' => __('', 'adminify'),
164 'class' => 'adminify-pl-0 adminify-pt-0 adminify-pro-feature',
165 'text_on' => __('Show', 'adminify'),
166 'text_off' => __('Hide', 'adminify'),
167 'text_width' => 80,
168 'default' => $this->get_default_field('screen_help_tab')['enable_for_screen'],
169 ],
170 [
171 'id' => 'screen_help_data',
172 'type' => 'checkbox',
173 'class' => 'adminify-one-col',
174 'title' => __('', 'adminify'),
175 'options' => $screen_options_settings,
176 'default' => $this->get_default_field('screen_help_tab')['screen_help_data'],
177 'dependency' => ['enable_for_screen', '==', 'true', 'true']
178 ]
179 ]
180 ];
181 }
182
183
184 /**
185 * Folders: Post Types Settings
186 */
187 public function folders_post_types_settings( &$fields ) {
188
189 $fields[] = [
190 'id' => 'folders',
191 'title' => __('Folders', 'adminify'),
192 'subtitle' => __('Folders for Posts/Pages/Custom Post Types etc.', 'adminify'),
193 'class' => 'adminify-two-columns',
194 'type' => 'fieldset',
195 'fields' => [
196 [
197 'id' => 'enable_folders',
198 'type' => 'switcher',
199 'title' => __('', 'adminify'),
200 'class' => 'adminify-pl-0',
201 'text_on' => __('Show', 'adminify'),
202 'text_off' => __('Hide', 'adminify'),
203 'text_width' => 80,
204 'default' => $this->get_default_field('folders')['enable_folders'],
205 ],
206 [
207 'id' => 'enable_for',
208 'type' => 'checkbox',
209 'title' => __('Enable for', 'adminify'),
210 'subtitle' => __('Select Post Types for enabling Folders', 'adminify'),
211 'options' => 'WPAdminify\Inc\Admin\Options\Productivity::get_all_post_types',
212 'default' => $this->get_default_field('folders')['enable_for'],
213 'dependency' => ['enable_folders', '==', 'true', 'true']
214 ],
215 [
216 'id' => 'media',
217 'type' => 'switcher',
218 'text_on' => __('Yes', 'adminify'),
219 'text_off' => __('No', 'adminify'),
220 'text_width' => 80,
221 'title' => __('Enable Media Folders', 'adminify'),
222 'subtitle' => __('Enabling Folders for Media Files', 'adminify'),
223 'default' => $this->get_default_field('folders')['media'],
224 'dependency' => ['enable_folders', '==', 'true', 'true']
225 ]
226
227 ],
228 ];
229
230 $fields[] = [
231 'id' => 'admin_pages',
232 'type' => 'switcher',
233 'title' => sprintf(__('Admin Pages %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
234 'class' => 'adminify-pro-notice adminify-pro-fieldset',
235 'text_on' => __('Yes', 'adminify'),
236 'text_off' => __('No', 'adminify'),
237 'text_width' => 80,
238 'subtitle' => __('Custom Admin Pages for Creating Top Level or Sub Level Menu. Supports all page builders - Gutenberg, Elementor, Bricks, Oxygen, Divi etc', 'adminify'),
239 'default' => $this->get_default_field('admin_pages'),
240 ];
241
242 }
243
244
245 /**
246 * Post Types Order: Options
247 */
248 public function post_types_order_options( &$fields ) {
249
250 $post_types_order_fieldset= [];
251
252 $post_types_order_fieldset[] = [
253 'id' => 'enable_pto',
254 'title' => __('', 'adminify'),
255 'class' => 'adminify-pl-0',
256 'type' => 'switcher',
257 'text_on' => __('Show', 'adminify'),
258 'text_off' => __('Hide', 'adminify'),
259 'text_width' => 80,
260 'default' => $this->get_default_field('post_types_order')['enable_pto'],
261 ];
262
263 $post_types_order_fieldset[] = [
264 'id' => 'pto_posts',
265 'type' => 'checkbox',
266 'title' => __( 'Sortable Post Types', 'adminify' ),
267 'subtitle' => __( 'Select Post Types for sorting', 'adminify' ),
268 'options' => 'WPAdminify\Inc\Admin\Options\Productivity::get_all_post_types',
269 'default' => $this->get_default_field('post_types_order')['pto_posts'],
270 'dependency' => ['enable_pto', '==', 'true', 'true'],
271 ];
272
273 $post_types_order_fieldset[] = [
274 'id' => 'pto_media',
275 'type' => 'switcher',
276 'title' => __( 'Sortable Media Files', 'adminify' ),
277 'subtitle' => __( 'Enable/Disable Sortable Media Files on List View', 'adminify' ),
278 'text_on' => __('Yes', 'adminify'),
279 'text_off' => __('No', 'adminify'),
280 'text_width' => 80,
281 'default' => $this->get_default_field('post_types_order')[ 'pto_media' ],
282 'dependency' => ['enable_pto', '==', 'true', 'true'],
283 ];
284
285 $post_types_order_fieldset[] = [
286 'id' => 'pto_taxonomies',
287 'type' => 'checkbox',
288 'title' => sprintf(__('Sortable Taxonomies %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
289 'subtitle' => __('Select for Sortable Taxonomies', 'adminify'),
290 'options' => 'WPAdminify\Inc\Admin\Options\Productivity::get_all_taxonomies',
291 'query_args' => [
292 'orderby' => 'post_title',
293 'order' => 'ASC',
294 ],
295 'default' => $this->get_default_field('post_types_order')['pto_taxonomies'],
296 'dependency' => ['enable_pto', '==', 'true', 'true'],
297 ];
298
299
300 // Dashboard Widgets Added
301 $fields[] = [
302 'id' => 'dashboard_widgets',
303 'type' => 'switcher',
304 'title' => __('Dashboard & Welcome Widget', 'adminify'),
305 'subtitle' => __('Create Custom Dashboard & Sidebar Widgets', 'adminify'),
306 'text_on' => __('Yes', 'adminify'),
307 'text_off' => __('No', 'adminify'),
308 'text_width' => 80,
309 'default' => $this->get_default_field('dashboard_widgets'),
310 ];
311
312 $fields[] = [
313 'id' => 'post_types_order',
314 'title' => __('Post Types Order', 'adminify'),
315 'subtitle' => __('Enable/Disable Post Types Orders to increase your productivity.', 'adminify'),
316 'type' => 'fieldset',
317 'fields' => $post_types_order_fieldset,
318 ];
319 }
320
321
322 public static function get_all_post_types() {
323
324 $post_types = get_post_types(
325 [
326 'show_ui' => true,
327 ],
328 'objects'
329 );
330
331 $post_type_names = [];
332 foreach ($post_types as $post_type) {
333 if (in_array($post_type->name, ['attachment', 'wp_navigation', 'wp_block'])) {
334 continue;
335 }
336 if($post_type->name === 'post' || $post_type->name === 'page' ){
337 $post_type_names[$post_type->name] = $post_type->label;
338 } else {
339 $is_pro = false;
340 if(class_exists('\\WPAdminify\\Pro\\Adminify_Pro')){
341 $is_pro = \WPAdminify\Pro\Adminify_Pro::is_premium();
342 }
343 $pro_notice = empty($is_pro) ? Utils::adminify_upgrade_pro_class() : '';
344 $post_type_names[$post_type->name] = $post_type->label . $pro_notice;
345 }
346 }
347 return $post_type_names;
348 }
349
350 public static function get_all_taxonomies() {
351 $taxonomies = get_taxonomies(
352 [
353 'show_ui' => true,
354 ],
355 'objects'
356 );
357 $taxonomy_names = [];
358 foreach ( $taxonomies as $taxonomy ) {
359 if ( $taxonomy->name == 'post_format' ) {
360 continue;
361 }
362
363 $is_pro = false;
364 if (class_exists('\\WPAdminify\\Pro\\Adminify_Pro')) {
365 $is_pro = \WPAdminify\Pro\Adminify_Pro::is_premium();
366 }
367 $pro_notice = empty($is_pro) ? Utils::adminify_upgrade_pro_class() : '';
368 $taxonomy_names[ $taxonomy->name ] = $taxonomy->label . $pro_notice;
369
370 }
371 return $taxonomy_names;
372 }
373
374
375 /**
376 * Modules
377 *
378 */
379 public function modules_settings(&$fields)
380 {
381 $fields[] = [
382 'id' => 'menu_duplicator',
383 'type' => 'switcher',
384 'title' => __('Menu Duplicator', 'adminify'),
385 'subtitle' => __('Enable Menu Duplicator to increase your productivity.', 'adminify'),
386 'text_on' => __('Yes', 'adminify'),
387 'text_off' => __('No', 'adminify'),
388 'text_width' => 80,
389 'default' => $this->get_default_field('menu_duplicator'),
390 ];
391
392 $fields[] = [
393 'id' => 'post_duplicator',
394 'title' => __('Post Duplicator', 'adminify'),
395 'subtitle' => __('Enable Post/Page/Custom Post Types Duplicator to increase your productivity.', 'adminify'),
396 'type' => 'fieldset',
397 'default' => $this->get_default_field('post_duplicator'),
398 'fields' => [
399 [
400 'id' => 'enable_post_duplicator',
401 'type' => 'switcher',
402 'title' => __('', 'adminify'),
403 'class' => 'adminify-pl-0',
404 'text_on' => __('Show', 'adminify'),
405 'text_off' => __('Hide', 'adminify'),
406 'text_width' => 80,
407 'default' => $this->get_default_field('post_duplicator')['enable_post_duplicator'],
408 ],
409 [
410 'id' => 'post_types',
411 'type' => 'checkbox',
412 'title' => __('Enable for Post Types', 'adminify'),
413 'subtitle' => __('Select Post Types for Enabling Duplicate feature', 'adminify'),
414 'options' => 'WPAdminify\Inc\Admin\Options\Productivity::get_all_post_types',
415 'default' => $this->get_default_field('post_duplicator')['post_types'],
416 'dependency' => ['enable_post_duplicator', '==', 'true', 'true'],
417 ],
418 [
419 'id' => 'taxonomies',
420 'type' => 'checkbox',
421 'title' => sprintf(__('Enable for Taxonomies %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
422 'subtitle' => __('Enable for Taxonomies', 'adminify'),
423 'options' => 'WPAdminify\Inc\Admin\Options\Productivity::get_all_taxonomies',
424 'query_args' => [
425 'orderby' => 'post_title',
426 'order' => 'ASC',
427 ],
428 'default' => $this->get_default_field('post_duplicator')['taxonomies'],
429 'dependency' => ['enable_post_duplicator', '==', 'true', 'true'],
430 ]
431
432 ],
433 ];
434 }
435
436
437
438 /**
439 * Post/Page Columns
440 */
441
442 public function custom_admin_columns(&$admin_columns)
443 {
444 $admin_columns[] = [
445 'id' => 'custom_admin_columns',
446 'title' => __('Custom Admin Columns', 'adminify'),
447 'subtitle' => __('Add Custom Admin Columns for Post Types or Taxonomies', 'adminify'),
448 'type' => 'fieldset',
449 'fields' => [
450 [
451 'id' => 'enable',
452 'type' => 'switcher',
453 'class' => 'adminify-pl-0',
454 'title' => __('', 'adminify'),
455 'text_on' => __('Show', 'adminify'),
456 'text_off' => __('Hide', 'adminify'),
457 'text_width' => 80,
458 'default' => $this->get_default_field('custom_admin_columns')['enable'],
459 ],
460 [
461 'id' => 'columns_data',
462 'type' => 'checkbox',
463 'class' => 'adminify-one-col',
464 'title' => __('', 'adminify'),
465 'options' => [
466 'post_thumb_column' => sprintf(__('Show Post Thumbnails Column? %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
467 'post_page_id_column' => sprintf(__('Show Post/Page ID Column. Display "ID" column for post and page table lists. %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
468 'comment_id_column' => __('Show "Comment ID" Column for Comment, Also show "Parent ID"', 'adminify'),
469 'last_login_column' => sprintf(__('Show "Last Login" Column for Users %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
470 'taxonomy_id_column' => __('Show "Taxonomy ID" Column for all possible types of taxonomies', 'adminify'),
471 'posts_slug_column' => __('Show "URL Path" Column for Post Types', 'adminify'),
472 ],
473 'default' => $this->get_default_field('custom_admin_columns')['columns_data'],
474 'dependency' => ['enable', '==', 'true', true],
475 ],
476 [
477 'id' => 'post_page_column_thumb_image',
478 'type' => 'media',
479 'class' => 'custom-thumb-image',
480 'title' => __('Column Thumbnail Image', 'adminify'),
481 'library' => 'image',
482 'preview_size' => 'thumbnail',
483 'button_title' => __('Add Thumbnail Image', 'adminify'),
484 'remove_title' => __('Remove Thumbnail Image', 'adminify'),
485 'default' => $this->get_default_field('custom_admin_columns')['post_page_column_thumb_image'],
486 'dependency' => array('columns_data', 'any', 'post_thumb_column', 'true'),
487 ],
488 [
489 'id' => 'slug_column_post_types',
490 'type' => 'checkbox',
491 'title' => __('"URL Path" Column for Post Types', 'adminify'),
492 'subtitle' => __('Select Post Types for Enabling "URL Path" Column Slug', 'adminify'),
493 'options' => 'WPAdminify\Inc\Admin\Options\Productivity::get_all_post_types',
494 'default' => $this->get_default_field('custom_admin_columns')['slug_column_post_types'],
495 'dependency' => array('columns_data', 'any', 'posts_slug_column', 'true'),
496 ],
497 ]
498 ];
499 }
500
501
502
503
504 /**
505 * Gutenberg Settings
506 */
507
508 public function gutenberg_settings(&$fields)
509 {
510
511 $fields[] = [
512 'id' => 'remove_widgets',
513 'title' => __('Widgets Removal', 'adminify'),
514 'type' => 'fieldset',
515 'subtitle' => __('Remove unwanted Sidebar Widgets & Dashboard Widgets', 'adminify'),
516 'fields' => [
517 [
518 'id' => 'remove_widgets_type',
519 'type' => 'button_set',
520 'class' => 'adminify-pl-0 !adminify-flex',
521 'options' => [
522 'sidebar' => __('Sidebar Widgets', 'adminify'),
523 'dashboard' => __('Dashboard Widgets', 'adminify'),
524 ],
525 'default' => $this->get_default_field('remove_widgets')['remove_widgets_type'],
526 ],
527 [
528 'id' => 'disable_gutenberg_editor',
529 'type' => 'switcher',
530 'label' => sprintf(__('<h4>%s</h4>', 'adminify'), __('Disable Gutenberg Editor for Widgets', 'adminify')),
531 'class' => 'adminify-pl-0 adminify-col-fit',
532 'text_on' => __('Yes', 'adminify'),
533 'text_off' => __('No', 'adminify'),
534 'text_width' => 80,
535 'default' => $this->get_default_field('remove_widgets')['disable_gutenberg_editor'],
536 'dependency' => ['remove_widgets_type', '==', 'sidebar', true],
537 ],
538 [
539 'id' => 'sidebar_widgets_list',
540 'type' => 'checkbox',
541 'class' => 'adminify-one-col',
542 'title' => __('', 'adminify'),
543 'options' => '\WPAdminify\Inc\Classes\Sidebar_Widgets::render_sidebar_checkboxes',
544 'default' => $this->get_default_field('remove_widgets')['sidebar_widgets_list'],
545 'dependency' => ['remove_widgets_type|disable_gutenberg_editor', '==|==', 'sidebar|true', true],
546 ],
547 [
548 'id' => 'dashboard_widgets_list',
549 'type' => 'checkbox',
550 'class' => "adminify-one-col",
551 'title' => __('', 'adminify'),
552 'options' => '\WPAdminify\Inc\Classes\Remove_DashboardWidgets::render_dashboard_checkboxes',
553 'default' => $this->get_default_field('remove_widgets')['dashboard_widgets_list'],
554 'dependency' => ['remove_widgets_type', '==', 'dashboard', true],
555 ],
556 ]
557 ];
558 }
559
560
561 /**
562 * Security: Attachments
563 *
564 * @return void
565 */
566 public function productivity_attachment_fields(&$attachment_fields)
567 {
568
569 $allowed_upload_files_type = [
570 'svg' => sprintf(__('SVG Files %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
571 'avif' => sprintf(__('AVIF Files %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
572 'ico' => sprintf(__('ICO Files %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
573 'webp' => sprintf(__('WEBP Files %s', 'adminify'), Utils::adminify_upgrade_pro_class()),
574 ];
575
576 $attachment_fields_data = [
577 [
578 'id' => 'enable_media',
579 'type' => 'switcher',
580 'title' => __('', 'adminify'),
581 'class' => 'adminify-pl-0',
582 'text_on' => __('Show', 'adminify'),
583 'text_off' => __('Hide', 'adminify'),
584 'text_width' => 80,
585 'default' => $this->get_default_field('media_attachments')['enable_media'],
586 ],
587 [
588 'id' => 'media_ininite_scroll',
589 'type' => 'switcher',
590 'title' => sprintf(__('Infinite Scroll for Media Library? %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
591 'class' => 'adminify-pl-0 adminify-pt-0 adminify-pro-fieldset adminify-pro-notice',
592 'text_on' => __('Yes', 'adminify'),
593 'text_off' => __('No', 'adminify'),
594 'text_width' => 80,
595 'subtitle' => __('Re-enable infinite scrolling in the media library\'s grid view to ease navigation through a large collection.', 'adminify'),
596 'default' => $this->get_default_field('media_attachments')['media_ininite_scroll'],
597 'dependency' => ['enable_media', '==', 'true', true],
598 ],
599 [
600 'id' => 'media_replace',
601 'type' => 'switcher',
602 'title' => sprintf(__('Media Replace %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
603 'class' => 'adminify-pl-0 adminify-pt-0 adminify-pro-fieldset adminify-pro-notice',
604 'text_on' => __('Yes', 'adminify'),
605 'text_off' => __('No', 'adminify'),
606 'text_width' => 80,
607 'subtitle' => __('Swap any media file with new one. URL & metadata stay same. All existing links keep working.', 'adminify'),
608 'default' => $this->get_default_field('media_attachments')['media_replace'],
609 'dependency' => ['enable_media', '==', 'true', true],
610 ],
611 [
612 'id' => 'media_replace_backup_limit',
613 'type' => 'number',
614 'title' => sprintf(__('Backup Restore Limit %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
615 'class' => 'adminify-pl-0 adminify-pro-feature adminify-pro-notice',
616 'subtitle' => __('Set how many backups to store per file. (Default: 1)', 'adminify'),
617 'min' => 1,
618 'default' => $this->get_default_field('media_attachments')['media_replace_backup_limit'],
619 'dependency' => [
620 ['enable_media', '==', 'true', true],
621 ['media_replace', '==', 'true', true],
622 ],
623 ],
624 [
625 'id' => 'thumbnails_rss_feed',
626 'type' => 'switcher',
627 'title' => __('Post Thumbnails on RSS', 'adminify'),
628 'class' => 'adminify-pl-0',
629 'text_on' => __('Yes', 'adminify'),
630 'text_off' => __('No', 'adminify'),
631 'text_width' => 80,
632 'subtitle' => __('Show/Hide Post Thumbnails on RSS excerpt and Content Feed.', 'adminify'),
633 'default' => $this->get_default_field('media_attachments')['thumbnails_rss_feed'],
634 'dependency' => ['enable_media', '==', 'true', true],
635 ],
636 // [
637 // 'id' => 'allowed_upload_files',
638 // 'type' => 'checkbox',
639 // 'class' => 'adminify-pl-0',
640 // 'title' => sprintf(__('Allowed Files Uploads %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
641 // 'subtitle' => __('Allow SVG/JPEG/WEBP/ICO/AVIF Files Upload', 'adminify'),
642 // 'options' => $allowed_upload_files_type,
643 // 'default' => $this->get_default_field('media_attachments')['allowed_upload_files'],
644 // 'dependency' => ['enable_media', '==', 'true', true],
645 // ],
646 // [
647 // 'id' => 'convert_to_webp',
648 // 'type' => 'switcher',
649 // 'class' => 'adminify-pl-0',
650 // 'text_on' => __('Yes', 'adminify'),
651 // 'text_off' => __('No', 'adminify'),
652 // 'text_width' => 80,
653 // 'class' => 'adminify-pl-0',
654 // 'title' => sprintf(__('Convert to WEBP %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
655 // 'subtitle' => __('Convert Uploaded image to WEBP', 'adminify'),
656 // 'default' => $this->get_default_field('media_attachments')['convert_to_webp'],
657 // 'dependency' => ['enable_media', '==', 'true', true],
658 // ],
659 // [
660 // 'id' => 'featured_to_post',
661 // 'type' => 'switcher',
662 // 'class' => 'adminify-pl-0',
663 // 'text_on' => __('Yes', 'adminify'),
664 // 'text_off' => __('No', 'adminify'),
665 // 'text_width' => 80,
666 // 'class' => 'adminify-pl-0',
667 // 'title' => sprintf(__('Link Featured Images to Post %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
668 // 'subtitle' => __('Wrap featured images in your theme in links to posts.', 'adminify'),
669 // 'default' => $this->get_default_field('media_attachments')['featured_to_post'],
670 // 'dependency' => ['enable_media', '==', 'true', true],
671 // ],
672 // [
673 // 'id' => 'media_lowercase',
674 // 'type' => 'switcher',
675 // 'title' => sprintf(__('Lowercase Filenames for Uploads %s', 'adminify'), Utils::adminify_upgrade_pro_badge()),
676 // 'subtitle' => __('Make all the filenames of new uploads to lowercase', 'adminify'),
677 // 'class' => 'adminify-pl-0',
678 // 'text_on' => __('Yes', 'adminify'),
679 // 'text_off' => __('No', 'adminify'),
680 // 'text_width' => 80,
681 // 'class' => 'adminify-pl-0',
682 // 'default' => $this->get_default_field('media_attachments')['media_lowercase'],
683 // 'dependency' => ['enable_media', '==', 'true', true],
684 // ],
685 ];
686
687 $attachment_fields[] = array(
688 'id' => 'media_attachments',
689 'type' => 'fieldset',
690 'title' => __('Media Settings', 'adminify'),
691 'subtitle' => __('Media Attachement Settings', 'adminify'),
692 'fields' => $attachment_fields_data,
693 // 'default' => $this->get_default_field('media_attachments'),
694 );
695 }
696
697
698 /**
699 * Productivity Settings
700 *
701 * @return void
702 */
703 public function productivity_settings()
704 {
705 if (!class_exists('ADMINIFY')) {
706 return;
707 }
708
709 $fields = [];
710
711 $this->admin_notices_settings($fields);
712
713 $this->screen_options($fields);
714
715 // Folders
716 $this->folders_post_types_settings( $fields );
717
718 // Post Types Order
719 $this->post_types_order_options( $fields );
720
721 // Duplicator Settings
722 $this->modules_settings( $fields );
723
724 // Admin Columns
725 $this->custom_admin_columns($fields);
726
727 // Media Attachment files
728 $this->productivity_attachment_fields($fields);
729
730 $this->gutenberg_settings($fields);
731
732 $fields = apply_filters('adminify_settings/productivity', $fields, $this);
733
734 // Productivity Section
735 \ADMINIFY::createSection(
736 $this->prefix,
737 [
738 'title' => __('Productivity', 'adminify'),
739 'id' => 'productivity',
740 'icon' => 'fas fa-business-time',
741 'fields' => $fields,
742 ]
743 );
744 }
745 }
746 }
747