PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 2.0.0
Adminify – White Label, Admin Menu Editor, Login Customizer v2.0.0
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 2.0.0, at Inc/Admin/Options/AdminBar.php

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