PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.3.1
Adminify – White Label, Admin Menu Editor, Login Customizer v4.3.1
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.3.1, at Inc/Admin/Options/Productivity.php

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