PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.7
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.7
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 / Module_Folders.php

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

127 lines 4.2 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\Utils;
6 use WPAdminify\Inc\Admin\AdminSettingsModel;
7
8 if (!defined('ABSPATH')) {
9 die;
10 } // Cannot access directly.
11
12 if (!class_exists('Module_Folders')) {
13 class Module_Folders extends AdminSettingsModel
14 {
15 public function __construct()
16 {
17 $this->folders_settings();
18 }
19
20 public function get_defaults()
21 {
22 return [
23 'folders_user_roles' => [],
24 'folders_enable_for' => ['post', 'page'],
25 'folders_media' => true
26 ];
27 }
28
29 /**
30 * User Roles
31 */
32 public function folders_user_roles(&$fields)
33 {
34 $fields[] = array(
35 'type' => 'subheading',
36 'content' => Utils::adminfiy_help_urls(
37 __('Folders Settings', WP_ADMINIFY_TD),
38 'https://wpadminify.com/kb/organize-media-library-pages-posts-post-type-using-folder/',
39 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
40 'https://www.facebook.com/groups/jeweltheme',
41 'https://wpadminify.com/support/folders/'
42 )
43 );
44 $fields[] = array(
45 'id' => 'folders_user_roles',
46 'type' => 'select',
47 'title' => __('Disable for', WP_ADMINIFY_TD),
48 'placeholder' => __('Select User roles you want to show', WP_ADMINIFY_TD),
49 'options' => 'roles',
50 'multiple' => true,
51 'chosen' => true,
52 'default' => $this->get_default_field('folders_user_roles'),
53 );
54 $fields[] = array(
55 'id' => 'folders_enable_for',
56 'type' => 'checkbox',
57 'title' => __('Enable Folders for', WP_ADMINIFY_TD),
58 'subtitle' => __('Select Post Types for enabling Folders Module', WP_ADMINIFY_TD),
59 'options' => 'post_types',
60 'query_args' => array(
61 'orderby' => 'post_title',
62 'order' => 'ASC',
63 ),
64 'default' => $this->get_default_field('folders_enable_for'),
65 );
66
67 if (!jltwp_adminify()->can_use_premium_code__premium_only()) {
68 $fields[] = array(
69 'type' => 'notice',
70 'style' => 'warning',
71 'content' => Utils::adminify_upgrade_pro(),
72 'dependency' => array(
73 array('folders_enable_for', 'not-any', 'post,page', 'true'),
74 array('folders_enable_for', '!=', '', 'true'),
75 ),
76 );
77 }
78 }
79
80
81 /**
82 * Media Elements Sortable
83 *
84 * @return void
85 */
86
87 public function folders_for_media(&$fields)
88 {
89 $fields[] = array(
90 'id' => 'folders_media',
91 'type' => 'switcher',
92 'title' => __('Enable for Media', WP_ADMINIFY_TD),
93 'text_on' => __('Enabled', WP_ADMINIFY_TD),
94 'text_off' => __('Disabled', WP_ADMINIFY_TD),
95 'text_width' => 100,
96 'default' => $this->get_default_field('folders_media'),
97 );
98 }
99
100
101 /**
102 * Module: Folders
103 *
104 * @return void
105 */
106 public function folders_settings()
107 {
108 if (!class_exists('ADMINIFY')) {
109 return;
110 }
111
112 $fields = [];
113 $this->folders_user_roles($fields);
114 $this->folders_for_media($fields);
115
116 // Folders Order Section
117 \ADMINIFY::createSection($this->prefix, array(
118 'title' => __('Folders', WP_ADMINIFY_TD),
119 'id' => 'module_folders_section',
120 'parent' => 'module_settings',
121 'icon' => 'far fa-folder-open',
122 'fields' => $fields
123 ));
124 }
125 }
126 }
127