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 / General_Layout_Mode.php

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

303 lines 11.9 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 class General_Layout_Mode extends AdminSettingsModel
13 {
14 public function __construct()
15 {
16 $this->general_layout_mode_settings();
17 }
18
19
20 public function get_defaults()
21 {
22 return [
23 'admin_bar_mode' => 'light',
24 'admin_bar_logo_type' => 'image_logo',
25 'admin_bar_light_mode' => array(
26 'admin_bar_light_logo_text' => 'WP Adminify',
27 'admin_bar_light_logo' => '',
28 'light_logo_size' => array(
29 'width' => '150',
30 'height' => '45',
31 'unit' => 'px',
32 ),
33 ),
34
35 'admin_bar_dark_mode' => array(
36 'admin_bar_dark_logo_text' => 'WP Adminify',
37 'admin_bar_dark_logo' => '',
38 'dark_logo_size' => array(
39 'width' => '150',
40 'height' => '45',
41 'unit' => 'px',
42 ),
43 ),
44
45 'enable_schedule_dark_mode' => false,
46 'schedule_dark_mode_type' => 'system',
47 'schedule_dark_mode_start_time' => '',
48 'schedule_dark_mode_end_time' => '',
49 ];
50 }
51
52
53 /**
54 * Dark/Light Mode Settings
55 *
56 * @return void
57 */
58 public function layout_mode_setting_fields(&$fields)
59 {
60 $fields[] = array(
61 'type' => 'subheading',
62 'content' => Utils::adminfiy_help_urls(
63 __('Dark/Light Mode Settings', WP_ADMINIFY_TD),
64 'https://wpadminify.com/kb/configure-wordpress-dashboard-dark-mode/',
65 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
66 'https://www.facebook.com/groups/jeweltheme',
67 'https://wpadminify.com/support/'
68 )
69 );
70
71 $fields[] = array(
72 'id' => 'admin_bar_mode',
73 'type' => 'button_set',
74 'title' => __('Color Mode', WP_ADMINIFY_TD),
75 'options' => array(
76 'light' => __('Light Mode', WP_ADMINIFY_TD),
77 'dark' => __('Dark Mode', WP_ADMINIFY_TD),
78 ),
79 'default' => $this->get_default_field('admin_bar_mode'),
80 );
81
82 $fields[] = array(
83 'id' => 'admin_bar_logo_type',
84 'type' => 'button_set',
85 'title' => __('Logo Type', WP_ADMINIFY_TD),
86 'options' => array(
87 'image_logo' => __('Image', WP_ADMINIFY_TD),
88 'text_logo' => __('Text', WP_ADMINIFY_TD),
89 ),
90 'default' => $this->get_default_field('admin_bar_logo_type'),
91 );
92
93 $fields[] = array(
94 'id' => 'admin_bar_light_mode',
95 'type' => 'fieldset',
96 'fields' => array(
97 array(
98 'id' => 'admin_bar_light_logo_text',
99 'type' => 'text',
100 'title' => __('Logo Text', WP_ADMINIFY_TD),
101 'dependency' => array('admin_bar_logo_type', '==', 'text_logo', 'true'),
102 'default' => $this->get_default_field('admin_bar_light_mode')['admin_bar_light_logo_text'],
103 ),
104 array(
105 'id' => 'admin_bar_light_logo',
106 'type' => 'media',
107 'title' => __('Light Logo', WP_ADMINIFY_TD),
108 'library' => 'image',
109 'preview_size' => 'thumbnail',
110 'button_title' => __('Add Light Logo', WP_ADMINIFY_TD),
111 'remove_title' => __('Remove Light Logo', WP_ADMINIFY_TD),
112 'default' => $this->get_default_field('admin_bar_light_mode')['admin_bar_light_logo'],
113 'dependency' => array('admin_bar_logo_type', '==', 'image_logo', 'true'),
114 ),
115 array(
116 'id' => 'light_logo_size',
117 'type' => 'dimensions',
118 'title' => __('Logo Size', WP_ADMINIFY_TD),
119 'default' => $this->get_default_field('admin_bar_light_mode')['light_logo_size'],
120 'dependency' => array('admin_bar_logo_type', '==', 'image_logo', 'true'),
121 ),
122 ),
123 'dependency' => array('admin_bar_mode', '==', 'light', 'true')
124 );
125
126 $fields[] = array(
127 'id' => 'admin_bar_dark_mode',
128 'type' => 'fieldset',
129 'fields' => array(
130 array(
131 'id' => 'admin_bar_dark_logo_text',
132 'type' => 'text',
133 'title' => __('Logo Text', WP_ADMINIFY_TD),
134 'default' => $this->get_default_field('admin_bar_dark_mode')['admin_bar_dark_logo_text'],
135 'dependency' => array('admin_bar_logo_type', '==', 'text_logo', 'true'),
136 ),
137 array(
138 'id' => 'admin_bar_dark_logo',
139 'type' => 'media',
140 'title' => __('Dark Logo', WP_ADMINIFY_TD),
141 'library' => 'image',
142 'preview_size' => 'thumbnail',
143 'button_title' => __('Add Dark Logo', WP_ADMINIFY_TD),
144 'remove_title' => __('Remove Dark Logo', WP_ADMINIFY_TD),
145 'default' => $this->get_default_field('admin_bar_dark_mode')['admin_bar_dark_logo'],
146 'dependency' => array('admin_bar_logo_type', '==', 'image_logo', 'true'),
147 ),
148 array(
149 'id' => 'dark_logo_size',
150 'type' => 'dimensions',
151 'title' => __('Logo Size', WP_ADMINIFY_TD),
152 'default' => $this->get_default_field('admin_bar_dark_mode')['dark_logo_size'],
153 'dependency' => array('admin_bar_logo_type', '==', 'image_logo', 'true'),
154 ),
155 ),
156 'dependency' => array('admin_bar_mode', '==', 'dark', 'true')
157 );
158 }
159
160
161 public function schedule_dark_mode_fields(&$fields)
162 {
163
164 $fields[] = array(
165 'type' => 'subheading',
166 'content' => __('Schedule Dark Mode', WP_ADMINIFY_TD),
167 'dependency' => array('admin_bar_mode', '==', 'dark', 'true')
168 );
169
170 if (jltwp_adminify()->can_use_premium_code__premium_only()) {
171 $fields[] = array(
172 'id' => 'enable_schedule_dark_mode',
173 'type' => 'switcher',
174 'title' => __('Enable Schedule Dark Mode', WP_ADMINIFY_TD),
175 'text_on' => __('Enable', WP_ADMINIFY_TD),
176 'text_off' => __('Disable', WP_ADMINIFY_TD),
177 'text_width' => '100',
178 'default' => $this->get_default_field('enable_schedule_dark_mode')
179 );
180
181 $fields[] = array(
182 'id' => 'schedule_dark_mode_type',
183 'title' => __('Schedule Type', WP_ADMINIFY_TD),
184 'type' => 'button_set',
185 'options' => array(
186 'system' => __('System', WP_ADMINIFY_TD),
187 'custom' => __('Custom', WP_ADMINIFY_TD),
188 ),
189 'default' => $this->get_default_field('schedule_dark_mode_type'),
190 'dependency' => [
191 ['enable_schedule_dark_mode', '==', 'true', 'true'],
192 ]
193 );
194
195 $fields[] = array(
196 'id' => 'schedule_dark_mode_start_time',
197 'type' => 'select',
198 'title' => __('Start Time', WP_ADMINIFY_TD),
199 'after' => __('Select Start time for Scheduling Dark Mode', WP_ADMINIFY_TD),
200 'placeholder' => __('Select a time', WP_ADMINIFY_TD),
201 'options' => array(
202 '00:00' => '00:00',
203 '01:00' => '01:00',
204 '02:00' => '02:00',
205 '03:00' => '03:00',
206 '04:00' => '04:00',
207 '05:00' => '05:00',
208 '06:00' => '06:00',
209 '07:00' => '07:00',
210 '08:00' => '08:00',
211 '09:00' => '09:00',
212 '10:00' => '10:00',
213 '11:00' => '11:00',
214 '12:00' => '12:00',
215 '13:00' => '13:00',
216 '14:00' => '14:00',
217 '15:00' => '15:00',
218 '16:00' => '16:00',
219 '17:00' => '17:00',
220 '18:00' => '18:00',
221 '19:00' => '19:00',
222 '20:00' => '20:00',
223 '21:00' => '21:00',
224 '22:00' => '22:00',
225 '23:00' => '23:00',
226 ),
227 'default' => $this->get_default_field('schedule_dark_mode_start_time'),
228 'dependency' => [
229 ['enable_schedule_dark_mode', '==', 'true', 'true'],
230 ['schedule_dark_mode_type', '==', 'custom', 'true']
231 ]
232 );
233
234 $fields[] = array(
235 'id' => 'schedule_dark_mode_end_time',
236 'type' => 'select',
237 'title' => __('End Time', WP_ADMINIFY_TD),
238 'after' => __('Select End time for Scheduling Dark Mode', WP_ADMINIFY_TD),
239 'placeholder' => __('Select a time', WP_ADMINIFY_TD),
240 'options' => array(
241 '00:00' => '00:00',
242 '01:00' => '01:00',
243 '02:00' => '02:00',
244 '03:00' => '03:00',
245 '04:00' => '04:00',
246 '05:00' => '05:00',
247 '06:00' => '06:00',
248 '07:00' => '07:00',
249 '08:00' => '08:00',
250 '09:00' => '09:00',
251 '10:00' => '10:00',
252 '11:00' => '11:00',
253 '12:00' => '12:00',
254 '13:00' => '13:00',
255 '14:00' => '14:00',
256 '15:00' => '15:00',
257 '16:00' => '16:00',
258 '17:00' => '17:00',
259 '18:00' => '18:00',
260 '19:00' => '19:00',
261 '20:00' => '20:00',
262 '21:00' => '21:00',
263 '22:00' => '22:00',
264 '23:00' => '23:00',
265 ),
266 'default' => $this->get_default_field('schedule_dark_mode_end_time'),
267 'dependency' => [
268 ['enable_schedule_dark_mode', '==', 'true', 'true'],
269 ['schedule_dark_mode_type', '==', 'custom', 'true']
270 ]
271 );
272 } else {
273
274 $fields[] = array(
275 'type' => 'notice',
276 'title' => __('Enable Schedule Dark Mode', WP_ADMINIFY_TD),
277 'style' => 'warning',
278 'content' => Utils::adminify_upgrade_pro(),
279 'dependency' => array(
280 array('admin_bar_mode', '==', 'dark', 'true')
281 )
282 );
283 }
284 }
285
286 public function general_layout_mode_settings()
287 {
288 if (!class_exists('ADMINIFY')) {
289 return;
290 }
291
292 $fields = [];
293 $this->layout_mode_setting_fields($fields);
294 $this->schedule_dark_mode_fields($fields);
295
296 \ADMINIFY::createSection($this->prefix, array(
297 'title' => __('Dark/Light Mode', WP_ADMINIFY_TD),
298 'icon' => 'fas fa-adjust',
299 'fields' => $fields
300 ));
301 }
302 }
303