PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.4
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.4
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 1.0.4, at Inc/admin/Options/AdminBar.php

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