PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.1.6
Adminify – White Label, Admin Menu Editor, Login Customizer v3.1.6
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 / AdminBar.php

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

469 lines 17.6 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 * WP Adminify
9 *
10 * @package WP Admin Bar
11 *
12 * @author Jewel Theme <support@jeweltheme.com>
13 */
14 class AdminBar extends AdminSettingsModel
15 {
16 public function __construct()
17 {
18 $this->admin_bar_settings();
19 }
20
21 public function get_defaults()
22 {
23 return [
24 'admin_bar_settings' => [
25 'admin_bar_user_roles' => [],
26 'enable_admin_bar' => true,
27 'admin_bar_hide_frontend' => 'show',
28 'admin_bar_position' => 'top',
29 'admin_bar_hide_frontend_user_roles' => [],
30 'admin_bar_search' => true,
31 'admin_bar_comments' => true,
32 'admin_bar_howdy_text' => __( 'Howdy', 'adminify' ),
33 'admin_bar_view_website' => true,
34 'admin_bar_view_website_window_type' => 'new_tab',
35 'admin_bar_user_offcanvas_menu' => true,
36 'admin_bar_dark_light_btn' => true,
37 'admin_bar_container' => 'admin_bar_only',
38 'admin_bar_light_bg' => 'color',
39 'admin_bar_light_bg_color' => '',
40 'admin_bar_font_typography' => '',
41 'admin_bar_light_bg_gradient' => [
42 'background-color' => '',
43 'background-gradient-color' => '',
44 'background-gradient-direction' => '135deg',
45 ],
46 'admin_bar_dark_bg' => 'color',
47 'admin_bar_dark_bg_color' => '',
48 'admin_bar_dark_bg_gradient' => [
49 'background-color' => '',
50 'background-gradient-color' => '',
51 'background-gradient-direction' => '135deg',
52 ],
53 'admin_bar_text_color' => '',
54 'admin_bar_link_color' => [
55 'bg_color' => '',
56 'link_color' => '',
57 'hover_color' => '',
58 ],
59 'admin_bar_link_dropdown_color' => [
60 'wrapper_bg' => '',
61 'bg_color' => '',
62 'link_color' => '',
63 'hover_color' => '',
64 ],
65 'admin_bar_icon_color' => '',
66 ],
67 ];
68 }
69
70 public function admin_bar_settings_user_roles( &$fields )
71 {
72 // $fields[] = array(
73 // 'id' => 'admin_bar_user_roles',
74 // 'type' => 'select',
75 // 'title' => __('Disable for', 'adminify'),
76 // 'placeholder' => __('Select User roles you don\'t want to show', 'adminify'),
77 // 'options' => 'roles',
78 // 'multiple' => true,
79 // 'chosen' => true,
80 // 'default' => $this->get_default_field('admin_bar_settings')['admin_bar_user_roles'],
81 // );
82 $fields[] = [
83 'id' => 'enable_admin_bar',
84 'type' => 'switcher',
85 'title' => __( 'Admin Bar Settings', 'adminify' ),
86 'label' => __( 'Enable/Disable Admin Bar includes Logo, Search, Dark/Light Mode, User Info etc.', 'adminify' ),
87 'text_on' => __( 'Enabled', 'adminify' ),
88 'text_off' => __( 'Disabled', 'adminify' ),
89 'text_width' => 100,
90 'default' => $this->get_default_field( 'admin_bar_settings' )['enable_admin_bar'],
91 ];
92 $fields[] = [
93 'id' => 'admin_bar_hide_frontend',
94 'type' => 'button_set',
95 'title' => __( 'Frontend Admin Bar', 'adminify' ),
96 'options' => [
97 'show' => __( 'Show', 'adminify' ),
98 'hide' => __( 'Hide', 'adminify' ),
99 ],
100 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_hide_frontend'],
101 'dependency' => [
102 'enable_admin_bar',
103 '==',
104 'true',
105 'true'
106 ],
107 ];
108 $fields[] = [
109 'type' => 'notice',
110 'title' => __( '"Frontend Admin Bar" Disable for', 'adminify' ),
111 'style' => 'warning',
112 'content' => Utils::adminify_upgrade_pro(),
113 'dependency' => [
114 'enable_admin_bar|admin_bar_hide_frontend',
115 '==|==',
116 'true|show',
117 'true'
118 ],
119 ];
120 $fields[] = [
121 'type' => 'notice',
122 'title' => __( 'Admin Bar Position', 'adminify' ),
123 'style' => 'warning',
124 'content' => Utils::adminify_upgrade_pro(),
125 'dependency' => [
126 'enable_admin_bar|admin_bar_position',
127 '==|==',
128 'true|pro_feature',
129 'true'
130 ],
131 ];
132 $fields[] = [
133 'id' => 'admin_bar_search',
134 'type' => 'switcher',
135 'title' => __( 'Search Form', 'adminify' ),
136 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_search'],
137 'text_on' => __( 'Show', 'adminify' ),
138 'text_off' => __( 'Hide', 'adminify' ),
139 'text_width' => '100',
140 'dependency' => [
141 'admin_ui|enable_admin_bar',
142 '==|==',
143 'true|true',
144 'true'
145 ],
146 ];
147 $fields[] = [
148 'id' => 'admin_bar_dark_light_btn',
149 'type' => 'switcher',
150 'title' => __( 'Light/Dark Switcher', 'adminify' ),
151 'text_on' => __( 'Show', 'adminify' ),
152 'text_off' => __( 'Hide', 'adminify' ),
153 'text_width' => '100',
154 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_dark_light_btn'],
155 'dependency' => [
156 'admin_ui|enable_admin_bar',
157 '==|==',
158 'true|true',
159 'true'
160 ],
161 ];
162 $fields[] = [
163 'id' => 'admin_bar_comments',
164 'type' => 'switcher',
165 'title' => __( 'Comments Icon', 'adminify' ),
166 'text_on' => __( 'Show', 'adminify' ),
167 'text_off' => __( 'Hide', 'adminify' ),
168 'text_width' => '100',
169 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_comments'],
170 'dependency' => [
171 'enable_admin_bar',
172 '==',
173 'true',
174 'true'
175 ],
176 ];
177 $fields[] = [
178 'id' => 'admin_bar_howdy_text',
179 'type' => 'text',
180 'title' => __( '"Howdy" Text', 'adminify' ),
181 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_howdy_text'],
182 'dependency' => [
183 'admin_ui|enable_admin_bar',
184 '!=|==',
185 'true|true',
186 'true'
187 ],
188 ];
189 $fields[] = [
190 'id' => 'admin_bar_view_website',
191 'type' => 'switcher',
192 'title' => 'View Website Icon',
193 'text_on' => __( 'Show', 'adminify' ),
194 'text_off' => __( 'Hide', 'adminify' ),
195 'text_width' => '100',
196 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_view_website'],
197 'dependency' => [
198 'admin_ui|enable_admin_bar',
199 '==|==',
200 'true|true',
201 'true'
202 ],
203 ];
204 $fields[] = [
205 'id' => 'admin_bar_view_website_window_type',
206 'type' => 'button_set',
207 'title' => __( 'Website Open In', 'adminify' ),
208 'options' => [
209 'same_tab' => __( 'Same Window', 'adminify' ),
210 'new_tab' => __( 'New Window', 'adminify' ),
211 ],
212 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_view_website_window_type'],
213 'dependency' => [
214 'admin_ui|enable_admin_bar|admin_bar_view_website',
215 '==|==|==',
216 'true|true|true',
217 'true'
218 ],
219 ];
220 $fields[] = [
221 'id' => 'admin_bar_user_offcanvas_menu',
222 'type' => 'switcher',
223 'title' => __( 'User Offcanvas Menu', 'adminify' ),
224 'text_on' => __( 'Enabled', 'adminify' ),
225 'text_off' => __( 'Disabled', 'adminify' ),
226 'text_width' => '100',
227 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_user_offcanvas_menu'],
228 'dependency' => [
229 'admin_ui|enable_admin_bar',
230 '==|==',
231 'true|true',
232 'true'
233 ],
234 ];
235 // $fields[] = [
236 // 'id' => 'admin_bar_sticky',
237 // 'type' => 'switcher',
238 // 'title' => __( 'Sticky Admin Bar', 'adminify' ),
239 // 'text_on' => __( 'Enabled', 'adminify' ),
240 // 'text_off' => __( 'Disabled', 'adminify' ),
241 // 'text_width' => '100',
242 // 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_sticky'],
243 // 'dependency' => [ 'admin_ui|enable_admin_bar', '==|==', 'true|true', 'true' ],
244 // ];
245 }
246
247 /**
248 * Style Tab Settings
249 *
250 * @return void
251 */
252 public function admin_bar_style_tab_settings( &$fields )
253 {
254 $fields[] = [
255 'id' => 'admin_bar_container',
256 'type' => 'button_set',
257 'title' => __( 'Admin Bar Select', 'adminify' ),
258 'description' => __( 'Select to change Colors of Full Container(with Admin bar and Navigation) or Admin Bar only', 'adminify' ),
259 'options' => [
260 'full_container' => __( 'Full Container', 'adminify' ),
261 'admin_bar_only' => __( 'Admin Bar', 'adminify' ),
262 ],
263 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_container'],
264 'dependency' => [
265 'layout_type',
266 '==',
267 'horizontal',
268 'true'
269 ],
270 ];
271 $fields[] = [
272 'type' => 'notice',
273 'title' => __( '', 'adminify' ),
274 'style' => 'warning',
275 'content' => Utils::adminify_upgrade_pro(),
276 'dependency' => [
277 'admin_bar_container',
278 '==',
279 'full_container',
280 'true'
281 ],
282 ];
283 $fields[] = [
284 'id' => 'admin_bar_font_typography',
285 'type' => 'typography',
286 'title' => __( 'Font Settings', 'adminify' ),
287 'font_family' => false,
288 'font_weight' => true,
289 'font_style' => true,
290 'font_size' => true,
291 'line_height' => true,
292 'letter_spacing' => true,
293 'text_align' => true,
294 'text-transform' => true,
295 'color' => false,
296 'subset' => false,
297 'backup_font_family' => false,
298 'font_variant' => false,
299 'word_spacing' => false,
300 'text_decoration' => true,
301 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_font_typography'],
302 ];
303 $fields[] = [
304 'id' => 'admin_bar_light_bg',
305 'type' => 'button_set',
306 'title' => __( 'Background', 'adminify' ),
307 'options' => [
308 'color' => __( 'Color', 'adminify' ),
309 'gradient' => __( 'Gradient', 'adminify' ),
310 ],
311 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_light_bg'],
312 'dependency' => [
313 'admin_bar_mode',
314 '==',
315 'light',
316 'true'
317 ],
318 ];
319 $fields[] = [
320 'id' => 'admin_bar_light_bg_color',
321 'type' => 'color',
322 'title' => __( 'Background Color', 'adminify' ),
323 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_light_bg_color'],
324 'dependency' => [
325 'admin_bar_light_bg|admin_bar_mode',
326 '==|==',
327 'color|light',
328 'true'
329 ],
330 ];
331 $fields[] = [
332 'type' => 'notice',
333 'title' => __( '', 'adminify' ),
334 'style' => 'warning',
335 'content' => Utils::adminify_upgrade_pro(),
336 'dependency' => [
337 'admin_bar_light_bg|admin_bar_mode',
338 '==|==',
339 'gradient|light',
340 'true'
341 ],
342 ];
343 // Dark Background
344 $fields[] = [
345 'id' => 'admin_bar_dark_bg',
346 'type' => 'button_set',
347 'title' => __( 'Background Type', 'adminify' ),
348 'options' => [
349 'color' => __( 'Color', 'adminify' ),
350 'gradient' => __( 'Gradient', 'adminify' ),
351 ],
352 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_dark_bg'],
353 'dependency' => [
354 'admin_bar_mode',
355 '==',
356 'dark',
357 'true'
358 ],
359 ];
360 $fields[] = [
361 'id' => 'admin_bar_dark_bg_color',
362 'type' => 'color',
363 'title' => __( 'Background Color', 'adminify' ),
364 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_dark_bg_color'],
365 'dependency' => [
366 'admin_bar_dark_bg|admin_bar_mode',
367 '==|==',
368 'color|dark',
369 'true'
370 ],
371 ];
372 $fields[] = [
373 'type' => 'notice',
374 'title' => __( '', 'adminify' ),
375 'style' => 'warning',
376 'content' => Utils::adminify_upgrade_pro(),
377 'dependency' => [
378 'admin_bar_dark_bg|admin_bar_mode',
379 '==|==',
380 'gradient|dark',
381 'true'
382 ],
383 ];
384 $fields[] = [
385 'id' => 'admin_bar_text_color',
386 'type' => 'color',
387 'title' => __( 'Text Color', 'adminify' ),
388 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_text_color'],
389 ];
390 $fields[] = [
391 'type' => 'subheading',
392 'content' => __( '"New" Button Style', 'adminify' ),
393 ];
394 $fields[] = [
395 'id' => 'admin_bar_link_color',
396 'type' => 'color_group',
397 'title' => __( '"New" Button color', 'adminify' ),
398 'subtitle' => __( '"New" Button Link colors active, hover, background etc ', 'adminify' ),
399 'options' => [
400 'bg_color' => __( 'Background Color', 'adminify' ),
401 'link_color' => __( 'Text Color', 'adminify' ),
402 'hover_color' => __( 'Hover Color', 'adminify' ),
403 ],
404 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_link_color'],
405 ];
406 $fields[] = [
407 'id' => 'admin_bar_link_dropdown_color',
408 'type' => 'color_group',
409 'title' => __( '"New" Dropdown', 'adminify' ),
410 'subtitle' => __( '"New" Dropdown Link colors active, hover, background etc ', 'adminify' ),
411 'options' => [
412 'wrapper_bg' => __( 'Wrapper BG', 'adminify' ),
413 'bg_color' => __( 'Item Hover BG', 'adminify' ),
414 'link_color' => __( 'Link Color', 'adminify' ),
415 'hover_color' => __( 'Hover Color', 'adminify' ),
416 ],
417 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_link_dropdown_color'],
418 ];
419 $fields[] = [
420 'type' => 'subheading',
421 'content' => __( 'Icon Color', 'adminify' ),
422 ];
423 $fields[] = [
424 'id' => 'admin_bar_icon_color',
425 'type' => 'color',
426 'title' => __( 'Color', 'adminify' ),
427 'default' => $this->get_default_field( 'admin_bar_settings' )['admin_bar_icon_color'],
428 ];
429 }
430
431 public function admin_bar_settings()
432 {
433 if ( !class_exists( 'ADMINIFY' ) ) {
434 return;
435 }
436 $settings_tab_fields = [];
437 $style_tab_fields = [];
438 $this->admin_bar_settings_user_roles( $settings_tab_fields );
439 $this->admin_bar_style_tab_settings( $style_tab_fields );
440 // Admin Bar Section
441 \ADMINIFY::createSection( $this->prefix, [
442 'title' => __( 'Admin Bar', 'adminify' ),
443 'icon' => 'fas fa-user-shield',
444 'fields' => [ [
445 'type' => 'subheading',
446 'content' => Utils::adminfiy_help_urls(
447 __( 'Admin Bar Settings', 'adminify' ),
448 'https://wpadminify.com/kb/wp-admin-bar/',
449 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
450 'https://www.facebook.com/groups/jeweltheme',
451 'https://wpadminify.com/support/'
452 ),
453 ], [
454 'id' => 'admin_bar_settings',
455 'type' => 'tabbed',
456 'title' => '',
457 'tabs' => [ [
458 'title' => __( 'Settings', 'adminify' ),
459 'fields' => $settings_tab_fields,
460 ], [
461 'title' => 'Styles',
462 'fields' => $style_tab_fields,
463 ] ],
464 'default' => $this->get_defaults()['admin_bar_settings'],
465 ] ],
466 ] );
467 }
468
469 }