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 / Classes / AdminBar.php

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

1,311 lines 46.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\Classes;
4
5 use WPAdminify\Inc\Utils ;
6 use WPAdminify\Inc\Admin\AdminSettings ;
7 use WPAdminify\Inc\Admin\AdminSettingsModel ;
8 // no direct access allowed
9 if ( !defined( 'ABSPATH' ) ) {
10 exit;
11 }
12 class AdminBar extends AdminSettingsModel
13 {
14 public $post_types ;
15 public function __construct()
16 {
17 $this->options = (array) AdminSettings::get_instance()->get( 'admin_bar_settings' );
18 $admin_bar_user_roles = ( !empty($this->options['admin_bar_user_roles']) ? $this->options['admin_bar_user_roles'] : '' );
19 // if (Utils::restricted_for($admin_bar_user_roles)) {
20 // return;
21 // }
22 // Disable the default admin bar
23 // add_filter('show_admin_bar', '__return_false');
24 // Add admin-bar support if not already activated
25 add_theme_support( 'admin-bar', [
26 'callback' => '__return_false',
27 ] );
28 // Check Adminify Setup Wizard Page
29 if ( !empty($_GET['page']) && 'wp-adminify-setup-wizard' == $_GET['page'] ) {
30 return;
31 }
32 add_action( 'plugins_loaded', [ $this, 'initialize' ] );
33 add_action( 'wp_admin_bar_class', [ $this, 'load_wp_admin_bar_class' ] );
34 add_action( 'adminify/before/secondary_menu', [ $this, 'before_secondary_menu' ] );
35 }
36
37 public function initialize()
38 {
39 $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
40
41 if ( is_admin() ) {
42 if ( $admin_bar_position == 'top' || $admin_bar_position == 'bottom' ) {
43 add_action( 'admin_init', [ $this, 'jltwp_adminify_add_admin_bar' ] );
44 }
45 // Remove Unnecessary Menus from Admin bar
46 // add_action('wp_before_admin_bar_render', [$this, 'jltma_adminify_remove_admin_bar_menus'], 0);
47 add_filter( 'admin_body_class', [ $this, 'admin_bar_body_class' ] );
48 add_action( 'admin_head', [ $this, 'jltwp_adminify_admin_bar_css' ], 999 );
49 add_action( 'wp_ajax_adminify_all_search', [ $this, 'adminify_all_search' ] );
50 add_action( 'wp_ajax_wp_adminify_color_mode', [ $this, 'wp_adminify_color_mode' ] );
51 add_action( 'admin_enqueue_scripts', [ $this, 'jltwp_adminify_admin_scripts' ], 100 );
52 // Screen Option and Help Tab
53 add_action(
54 'admin_head',
55 [ $this, 'jltwp_adminify_remove_screen_options' ],
56 10,
57 3
58 );
59 add_action( 'admin_head', [ $this, 'jltwp_adminify_remove_help_tab' ] );
60 } else {
61 // Admin bar Frontend settings
62 $frontend_admin = ( !empty($this->options['admin_bar_hide_frontend']) ? $this->options['admin_bar_hide_frontend'] : 'show' );
63 $this->jltwp_adminify_front_bar();
64 add_action( 'init', [ $this, 'admin_bar_front_style_init' ] );
65 if ( $frontend_admin == 'hide' ) {
66 add_filter( 'show_admin_bar', '__return_false' );
67 }
68 }
69
70 }
71
72 public function before_secondary_menu()
73 {
74 if ( !empty($this->options['admin_bar_search']) ) {
75 ?>
76 <div class="wp-adminify-top-header--search--form">
77 <form class="top-header--search--form" action="$">
78 <span class="adminify-search-expand"><i class="icon-magnifier icons"></i></span>
79 <input id="top-header-search-input" class="top-header-search-input" type="search" placeholder="Search here">
80 </form>
81
82 <div id="top-header-search-results" class=" top-header-search-results" style="display: none;">
83 <div class="top-header-results-wrapper">
84 </div>
85 </div>
86 </div>
87 <?php
88 }
89 }
90
91 public function load_wp_admin_bar_class()
92 {
93 return 'WPAdminify\\Inc\\Classes\\Adminify_Admin_Bar';
94 }
95
96 public function jltwp_adminify_front_bar()
97 {
98 add_action( 'admin_init', [ $this, 'jltwp_adminify_add_admin_bar' ] );
99 add_filter( 'body_class', [ $this, 'admin_bar_body_class' ] );
100 }
101
102 public function admin_bar_front_style_init()
103 {
104 add_filter( 'wp_enqueue_scripts', [ $this, 'admin_bar_front_style' ] );
105 }
106
107 // Frontend Admin bar style
108 public function admin_bar_front_style()
109 {
110 $admin_bar_css = '';
111 $admin_bar_css .= '.admin-bar-position-bottom #wpadminbar{
112 top:auto;
113 bottom: 0;
114 }
115 .admin-bar-position-bottom #wpadminbar .menupop .ab-sub-wrapper{
116 bottom: 32px;
117 }
118
119 @media all and (max-width:600px){
120 body.logged-in.admin-bar-position-bottom {
121 position: relative;
122 }
123 }';
124 wp_add_inline_style( 'admin-bar', $admin_bar_css );
125 }
126
127 // Remove Screen Options
128 public function jltwp_adminify_remove_screen_options()
129 {
130 $enable_screen_tab = Utils::get_user_preference( 'screen_options_tab' );
131 if ( $enable_screen_tab ) {
132 add_filter( 'screen_options_show_screen', '__return_false' );
133 }
134 }
135
136 // Contextual Help Tab Remove
137 public function jltwp_adminify_remove_help_tab()
138 {
139 $enable_screen_tab = Utils::get_user_preference( 'adminify_help_tab' );
140
141 if ( $enable_screen_tab ) {
142 $screen = get_current_screen();
143 $screen->remove_help_tabs();
144 }
145
146 }
147
148 // Get All registered WP Admin Menus
149 public static function get_wp_admin_menus( $thismenu, $thissubmenu )
150 {
151 $options = [];
152 if ( !empty($thismenu) && is_array( $thismenu ) ) {
153 foreach ( $thismenu as $item ) {
154 if ( !empty($item[0]) ) {
155 // the preg_replace removes "Comments" & "Plugins" menu spans.
156 $options[$item[2]] = preg_replace( '/\\<span.*?>.*?\\<\\/span><\\/span>/s', '', $item[0] );
157 }
158 }
159 }
160 if ( !empty($thissubmenu) && is_array( $thissubmenu ) ) {
161 foreach ( $thissubmenu as $items ) {
162 foreach ( $items as $item ) {
163 if ( !empty($item[0]) ) {
164 $options[$item[1]] = preg_replace( '/\\<span.*?>.*?\\<\\/span><\\/span>/s', '', $item[0] );
165 }
166 }
167 }
168 }
169 return $options;
170 }
171
172 public function jltwp_adminify_admin_scripts()
173 {
174 global $pagenow ;
175 if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
176 return;
177 }
178 if ( is_admin_bar_showing() ) {
179 }
180 wp_enqueue_style( 'wp-adminify-admin-bar' );
181 wp_localize_script( 'wp-adminify-admin', 'WPAdminify', $this->adminify_create_admin_bar_js_object() );
182 $this->admin_topbar_loader_css();
183 // wp_enqueue_style('wp-adminify-admin-bar', WP_ADMINIFY_ASSETS . 'css/admin-bar.css', false, WP_ADMINIFY_VER);
184 // wp_enqueue_script('wp-adminify-admin', WP_ADMINIFY_ASSETS . 'js/wp-adminify.js', ['jquery'], WP_ADMINIFY_VER, true);
185 // wp_localize_script('wp-adminify-admin', 'WPAdminify', $this->adminify_create_admin_bar_js_object());
186 }
187
188 public function adminify_create_admin_bar_js_object()
189 {
190 return [
191 'ajax_url' => admin_url( 'admin-ajax.php' ),
192 'security_nonce' => wp_create_nonce( 'adminify-admin-bar-security-nonce' ),
193 'notice_nonce' => wp_create_nonce( 'adminify-notice-nonce' ),
194 ];
195 }
196
197 /**
198 * Preloader
199 *
200 * @return void
201 */
202 public function admin_topbar_loader_css()
203 {
204 $output_css = '';
205 $topbar_wireframe_img = WP_ADMINIFY_ASSETS_IMAGE . 'topbar-wireframe.svg';
206 $output_css .= '.js .wp-adminify-topbar-loader{background: url(' . esc_url( $topbar_wireframe_img ) . '); }';
207 echo '<style>' . wp_strip_all_tags( $output_css ) . '</style>' ;
208 }
209
210 /**
211 * Save Color Mode by Ajax
212 *
213 * @return void
214 */
215 public function wp_adminify_color_mode()
216 {
217
218 if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-admin-bar-security-nonce', 'security' ) > 0 ) {
219 $admin_bar_mode = AdminSettings::get_instance()->get();
220
221 if ( !empty($_POST['key']) ) {
222 $key = sanitize_key( $_POST['key'] );
223 $value = Utils::clean_ajax_input( wp_unslash( $_POST['value'] ) );
224
225 if ( $key == '' ) {
226 $message = __( 'No Color Mode supplied to save', 'adminify' );
227 echo Utils::ajax_error_message( $message ) ;
228 die;
229 }
230
231 }
232
233 // Light/Dark Mode
234
235 if ( $key === 'color_mode' ) {
236 $admin_bar_mode['admin_bar_mode'] = $value;
237 $admin_bar_mode['enable_schedule_dark_mode'] = false;
238 update_option( '_wpadminify', $admin_bar_mode );
239 die;
240 }
241
242 // Screen Options, Help Tabs and WP Hide Links
243
244 if ( $key === 'screen_options_tab' || $key === 'hide_wp_links' || $key === 'adminify_help_tab' ) {
245 $userid = get_current_user_id();
246 $current = get_user_meta( $userid, '_wpadminify_preferences', true );
247
248 if ( is_array( $current ) ) {
249 $current[$key] = $value;
250 } else {
251 $current = [];
252 $current[$key] = $value;
253 }
254
255 $state = update_user_meta( $userid, '_wpadminify_preferences', $current );
256
257 if ( $state ) {
258 $returndata = [];
259 $returndata['success'] = true;
260 $returndata['message'] = __( 'Preferences saved', 'adminify' );
261 echo json_encode( $returndata ) ;
262 } else {
263 $message = __( 'Unable to save user preferences', 'adminify' );
264 echo Utils::ajax_error_message( $message ) ;
265 die;
266 }
267
268 }
269
270 }
271
272 }
273
274 /**
275 * Search Everything
276 *
277 * @return void
278 */
279 public function adminify_all_search()
280 {
281
282 if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-admin-bar-security-nonce', 'security' ) > 0 ) {
283 if ( !empty($_POST['search']) ) {
284 $term = sanitize_text_field( wp_unslash( $_POST['search'] ) );
285 }
286 // Search Arguments
287 $args = [
288 'numberposts' => -1,
289 's' => $term,
290 'post_status' => [
291 'publish',
292 'pending',
293 'draft',
294 'future',
295 'private',
296 'inherit'
297 ],
298 ];
299 // All Post Types
300 $post_types = $this->get_post_types();
301 foreach ( $post_types as $type ) {
302 $args['post_type'][] = $type->name;
303 }
304 // All Categories/Taxonomies
305 $all_taxonomies = get_taxonomies();
306 // Get Comments
307 $all_comments = get_comments();
308 // Get All Users
309 $all_users = get_users();
310 // All Users
311 // $blogusers = get_users();
312 // foreach ($blogusers as $type) {
313 // $name = $type->user_login;
314 // $id = $type->ID;
315 // $args['author__in'][] = $type->ID;
316 // }
317 // // All Menus
318 // $all_admin_menus = self::get_wp_admin_menus();
319 // All Plugins
320 if ( !function_exists( 'get_plugins' ) ) {
321 require_once ABSPATH . 'wp-admin/includes/plugin.php';
322 }
323 $all_plugins = get_plugins();
324 $foundposts = get_posts( $args );
325 // $count_items = '';
326 // if (count($foundposts) > 0) {
327 // $count_items .= count($foundposts);
328 // } elseif (count($all_plugins)) {
329 // $count_items .= count($all_plugins);
330 // }
331 ob_start();
332 ?>
333
334 <p><span class="count"></span><?php
335 echo count( $foundposts ) . wp_kses_post( ' item<span>s</span> found' ) ;
336 ?></p>
337
338 <table class="top-header-result-table" style="height:500px;">
339 <thead>
340 <tr class="has-text-left">
341 <th><?php
342 esc_html_e( 'Title', 'adminify' );
343 ?></th>
344 <th><?php
345 esc_html_e( 'Type', 'adminify' );
346 ?></th>
347 <th><?php
348 esc_html_e( 'User', 'adminify' );
349 ?></th>
350 <th><?php
351 esc_html_e( 'Date', 'adminify' );
352 ?></th>
353 </tr>
354 </thead>
355 <tbody>
356
357 <?php
358 foreach ( $foundposts as $item ) {
359 $author_id = $item->post_author;
360 $editurl = get_edit_post_link( $item );
361 $public = get_permalink( $item );
362 ?>
363 <tr>
364 <td><span class="table-title"><a href="<?php
365 echo esc_url( $editurl ) ;
366 ?>"><?php
367 echo wp_kses_post( get_the_title( $item ) ) ;
368 ?></a></span></td>
369 <td><span class="type"><?php
370 echo wp_kses_post( get_post_type( $item ) ) ;
371 ?></span></td>
372 <td><span class="user"><?php
373 echo wp_kses_post( the_author_meta( 'user_login', $author_id ) ) ;
374 ?></span></td>
375 <td><span class="date"><?php
376 echo wp_kses_post( get_the_date( get_option( 'date_format' ), $item ) ) ;
377 ?></span></td>
378 </tr>
379 <?php
380 }
381 ?>
382
383 <?php
384 foreach ( $all_taxonomies as $tax_name ) {
385 $terms = get_terms( [
386 'taxonomy' => $tax_name,
387 'hide_empty' => 1,
388 ] );
389 foreach ( $terms as $cat ) {
390 if ( strpos( strtolower( $cat->name ), strtolower( $term ) ) === false ) {
391 continue;
392 }
393 // $user = get_userdata($cat->term_id);
394 ?>
395 <tr>
396 <td>
397 <span class="table-title">
398 <a href="<?php
399 echo esc_url( get_term_link( $cat->slug, $cat->taxonomy ) ) ;
400 ?>">
401 <?php
402 echo esc_html( $cat->name ) ;
403 ?>
404 </a>
405 </span>
406 </td>
407 <td>
408 <span class="type"><?php
409 echo esc_html( $cat->taxonomy ) ;
410 ?></span>
411 </td>
412 <td>
413 <span class="user">
414 <?php
415 esc_html_e( 'N/A', 'adminify' );
416 ?>
417 </span>
418 </td>
419 <td>
420 <span class="date">
421 <?php
422 esc_html_e( 'N/A', 'adminify' );
423 ?>
424 </span>
425 </td>
426 <td>
427 </td>
428 </tr>
429 <?php
430 }
431 }
432 ?>
433
434
435 <!-- Get Comments -->
436 <?php
437 foreach ( $all_comments as $comment ) {
438 if ( strpos( strtolower( $comment->comment_content ), strtolower( $term ) ) === false ) {
439 continue;
440 }
441 ?>
442 <tr>
443 <td>
444 <span class="table-title">
445 <a href="<?php
446 echo esc_url_raw( admin_url( 'comment.php?action=editcomment&c=' . esc_attr( $comment->comment_ID ) ) ) ;
447 ?>">
448 <?php
449 echo wp_kses_post( $comment->comment_content ) ;
450 ?>
451 </a>
452 </span>
453 </td>
454 <td>
455 <span class="type">
456 <?php
457 echo wp_kses_post( ucwords( $comment->comment_type ) ) ;
458 ?>
459 </span>
460 </td>
461 <td>
462 <span class="user">
463 <?php
464 echo wp_kses_post( the_author_meta( 'display_name', $comment->user_id ) ) ;
465 ?>
466 </span>
467 </td>
468 <td>
469 <span class="date">
470 <?php
471 echo esc_html( get_the_date( get_option( 'date_format' ), $comment->comment_date ) ) ;
472 ?>
473 </span>
474 </td>
475 </tr>
476 <?php
477 }
478 ?>
479
480
481
482 <!-- Get Users -->
483 <?php
484 foreach ( $all_users as $user ) {
485 if ( strpos( strtolower( $user->user_login ), strtolower( $term ) ) === false ) {
486 continue;
487 }
488 ?>
489 <tr>
490 <td>
491 <span class="table-title">
492 <a href="<?php
493 echo esc_url( admin_url( 'user-edit.php?user_id=' . $user->ID ) ) ;
494 ?>">
495 <?php
496 echo esc_html( $user->display_name ) ;
497 ?>
498 </a>
499 </span>
500 </td>
501 <td>
502 <span class="type">
503 <?php
504 esc_html_e( 'User', 'adminify' );
505 ?>
506 </span>
507 </td>
508 <td>
509 <span class="user">
510 <?php
511 echo wp_kses_post( the_author_meta( 'display_name', $user->ID ) ) ;
512 ?>
513 </span>
514 </td>
515 <td>
516 <span class="date">
517 <?php
518 echo wp_kses_post( get_the_date( get_option( 'date_format' ), $user->user_registered ) ) ;
519 ?>
520 </span>
521 </td>
522 </tr>
523 <?php
524 }
525 ?>
526
527
528
529 <!-- Get Plugins -->
530 <?php
531 foreach ( $all_plugins as $plugin ) {
532 if ( strpos( strtolower( $plugin['Name'] ), strtolower( $term ) ) === false ) {
533 continue;
534 }
535 ?>
536 <tr>
537 <td>
538 <span class="table-title">
539 <a href="<?php
540 echo esc_url( admin_url( 'plugins.php' ) ) ;
541 ?>">
542 <?php
543 echo esc_html( $plugin['Name'] ) ;
544 ?>
545 </a>
546 </span>
547 </td>
548 <td>
549 <span class="type">
550 <?php
551 esc_html_e( 'Plugin', 'adminify' );
552 ?>
553 </span>
554 </td>
555 <td>
556 <span class="user">
557 <?php
558 echo esc_html( $plugin['AuthorName'] ) ;
559 ?>
560 </span>
561 </td>
562 <td>
563 <span class="date">
564 <?php
565 esc_html_e( 'N/A', 'adminify' );
566 ?>
567 </span>
568 </td>
569 </tr>
570 <?php
571 }
572 ?>
573
574
575 </tbody>
576 </table>
577
578
579 <?php
580 $output_data = ob_get_clean();
581 echo json_encode( $output_data ) ;
582 }
583
584 die;
585 }
586
587 public function jltwp_adminify_admin_bar_css()
588 {
589 $admin_bar_mode = AdminSettings::get_instance()->get();
590 $admin_bar_mode = ( !empty($admin_bar_mode['admin_bar_mode']) ? $admin_bar_mode['admin_bar_mode'] : '' );
591 $output_css = '';
592 $output_css .= '<style type="text/css">';
593 $admin_bar_container = ( !empty($this->options['admin_bar_container']) ? $this->options['admin_bar_container'] : 'full_container' );
594
595 if ( $admin_bar_mode === 'light' ) {
596 $light_bg_type = ( !empty($this->options['admin_bar_light_bg']) ? $this->options['admin_bar_light_bg'] : 'color' );
597 $light_bg_color = ( !empty($this->options['admin_bar_light_bg_color']) ? $this->options['admin_bar_light_bg_color'] : '' );
598 // Full Container Colors
599
600 if ( $admin_bar_container == 'full_container' ) {
601 if ( $light_bg_type === 'color' ) {
602 $output_css .= '.wp-adminify.adminify-light-mode .adminify-top_bar nav.navbar, .wp-adminify .wp-adminify-horizontal-menu { background-color:' . esc_attr( $light_bg_color ) . ' ; }';
603 }
604 } elseif ( $admin_bar_container == 'admin_bar_only' ) {
605 // Admin Bar Colors
606 if ( $light_bg_type === 'color' ) {
607 if ( !empty($this->options['admin_bar_light_bg_color']) ) {
608 $output_css .= '.wp-adminify.adminify-light-mode .adminify-top_bar nav.navbar { background-color:' . esc_attr( $light_bg_color ) . ' }';
609 }
610 }
611 }
612
613 if ( !empty($admin_bar_colors['icon_color']) ) {
614 $output_css .= '.adminify-top_bar nav.navbar .navbar-menu .topbar-icon { fill: ' . esc_attr( $admin_bar_colors['icon_color'] ) . ' }';
615 }
616 } elseif ( $admin_bar_mode === 'dark' ) {
617 $dark_bg_type = ( isset( $this->options['admin_bar_dark_bg'] ) ? $this->options['admin_bar_dark_bg'] : 'color' );
618
619 if ( $admin_bar_container == 'full_container' ) {
620
621 if ( $dark_bg_type === 'color' ) {
622 $dark_bg_color = $this->options['admin_bar_dark_bg_color'];
623 $output_css .= '.wp-adminify.adminify-dark-mode .adminify-top_bar nav.navbar, .wp-adminify .wp-adminify-horizontal-menu{ background-color:' . esc_attr( $dark_bg_color ) . ' }';
624 } elseif ( $dark_bg_type === 'gradient' ) {
625 $dark_gradient_bg_color = $this->options['admin_bar_dark_bg_gradient']['background-color'];
626 $dark_gradient_color = $this->options['admin_bar_dark_bg_gradient']['background-gradient-color'];
627 $dark_gradient_color_dir = $this->options['admin_bar_dark_bg_gradient']['background-gradient-direction'];
628 $output_css .= '.wp-adminify.adminify-dark-mode .adminify-top_bar nav.navbar, .wp-adminify .wp-adminify-horizontal-menu{ background-image : linear-gradient(' . esc_attr( $dark_gradient_color_dir ) . ', ' . esc_attr( $dark_gradient_bg_color ) . ' , ' . esc_attr( $dark_gradient_color ) . '); }';
629 }
630
631 } elseif ( $admin_bar_container == 'admin_bar_only' ) {
632
633 if ( $dark_bg_type === 'color' ) {
634 $dark_bg_color = $this->options['admin_bar_dark_bg_color'];
635 $output_css .= '.wp-adminify.adminify-dark-mode .adminify-top_bar nav.navbar{ background-color:' . esc_attr( $dark_bg_color ) . ' }';
636 }
637
638 }
639
640 }
641
642 // "New" Button Colors
643 $new_btn_colors = ( !empty($this->options['admin_bar_link_color']) ? $this->options['admin_bar_link_color'] : '' );
644 if ( !empty($new_btn_colors['link_color']) ) {
645 $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content > .ab-item .ab-label, .wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content .ab-item .ab-icon:before { color:' . esc_attr( $new_btn_colors['link_color'] ) . ' }';
646 }
647 if ( !empty($new_btn_colors['hover_color']) ) {
648 $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content > .ab-item:hover .ab-label, .wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content .ab-item:hover .ab-icon:before{ color:' . esc_attr( $new_btn_colors['hover_color'] ) . ' }';
649 }
650 if ( !empty($new_btn_colors['bg_color']) ) {
651 $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content > .ab-item, .wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content:hover > .ab-item { background:' . esc_attr( $new_btn_colors['bg_color'] ) . ';}';
652 }
653 // "New" Button Hover Colors
654 $new_btn_dropwon = ( !empty($this->options['admin_bar_link_dropdown_color']) ? $this->options['admin_bar_link_dropdown_color'] : '' );
655 if ( !empty($new_btn_dropwon['wrapper_bg']) ) {
656 $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper, .wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu, .wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item { background-color:' . esc_attr( $new_btn_dropwon['wrapper_bg'] ) . ' !important;}';
657 }
658 if ( !empty($new_btn_dropwon['bg_color']) ) {
659 $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item:hover { background-color:' . esc_attr( $new_btn_dropwon['bg_color'] ) . ' !important;}';
660 }
661 if ( !empty($new_btn_dropwon['link_color']) ) {
662 $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item { color:' . esc_attr( $new_btn_dropwon['link_color'] ) . ' !important }';
663 }
664 if ( !empty($new_btn_dropwon['hover_color']) ) {
665 $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item:hover { color:' . esc_attr( $new_btn_dropwon['hover_color'] ) . ' !important }';
666 }
667 // Text Color
668
669 if ( !empty($this->options['admin_bar_text_color']) ) {
670 $output_css .= '.adminify-top_bar nav.navbar .navbar-brand .navbar-item .wp-adminify-site-name, .adminify-top_bar nav.navbar .navbar-menu .wp-adminify-user-site-list button { color:' . esc_attr( $this->options['admin_bar_text_color'] ) . ' }';
671 $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-post > .ab-item { color:' . esc_attr( $this->options['admin_bar_text_color'] ) . ' ; }';
672 $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-post > .ab-item .ab-icon:before { color:' . esc_attr( $this->options['admin_bar_text_color'] ) . ' ; }';
673 $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-post > .ab-item .ab-label { color:' . esc_attr( $this->options['admin_bar_text_color'] ) . ' ; }';
674 }
675
676 // Icon Color
677
678 if ( !empty($this->options['admin_bar_icon_color']) ) {
679 $output_css .= '.adminify-top_bar nav.navbar .navbar-menu .topbar-icon svg path { fill:' . esc_attr( $this->options['admin_bar_icon_color'] ) . ' }';
680 $output_css .= '.adminify-top_bar nav.navbar .navbar-end i, .adminify-top_bar nav.navbar .navbar-burger i { color:' . esc_attr( $this->options['admin_bar_icon_color'] ) . ' }';
681 }
682
683 $output_css .= ' </style>';
684 echo Utils::wp_kses_custom( $output_css ) ;
685 }
686
687 // Admin Bar Body Class
688 public function admin_bar_body_class( $classes )
689 {
690
691 if ( is_admin() ) {
692 $classes .= ' wp-adminify-admin-bar';
693 $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
694
695 if ( $admin_bar_position === 'top' ) {
696 $classes .= ' position-top';
697 } elseif ( $admin_bar_position === 'bottom' ) {
698 $classes .= ' position-bottom';
699 }
700
701 if ( !empty($this->options['enable_admin_bar']) ) {
702 $classes .= ' topbar-disabled';
703 }
704 } else {
705 global $pagenow ;
706 if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
707 return $classes;
708 }
709 $classes[] = 'wp-adminify-admin-bar';
710 $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
711
712 if ( $admin_bar_position === 'top' ) {
713 $classes[] = 'admin-bar-position-top';
714 } elseif ( $admin_bar_position === 'bottom' ) {
715 $classes[] = 'admin-bar-position-bottom';
716 }
717
718 if ( !empty($this->options['enable_admin_bar']) ) {
719 $classes[] = 'topbar-disabled';
720 }
721 }
722
723 return $classes;
724 }
725
726 public function get_post_types()
727 {
728
729 if ( is_array( $this->post_types ) ) {
730 return $this->post_types;
731 } else {
732 $args = [
733 'public' => true,
734 ];
735 $output = 'objects';
736 $post_types = get_post_types( $args, $output );
737 $this->post_types = $post_types;
738 return $post_types;
739 }
740
741 }
742
743 public function jltwp_adminify_add_admin_bar()
744 {
745 // For Testing Admin Bar on Setup Wizard
746 // add_action('admin_head', [$this, 'jltwp_adminify_render_admin_bar']);
747 add_action( 'in_admin_header', [ $this, 'jltwp_adminify_render_admin_bar' ], -999999999 );
748 // on frontend area
749 add_action( 'wp_head', [ $this, 'jltwp_adminify_render_admin_bar' ] );
750 }
751
752 public function jltwp_adminify_render_admin_bar()
753 {
754 global $pagenow ;
755 if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
756 return;
757 }
758 if ( !is_admin_bar_showing() ) {
759 return false;
760 }
761 global $wp_admin_bar ;
762 if ( empty($wp_admin_bar) ) {
763 return false;
764 }
765 $admin_bar_mode = AdminSettings::get_instance()->get();
766 $admin_bar_mode = ( empty($admin_bar_mode['admin_bar_mode']) ? 'light' : $admin_bar_mode['admin_bar_mode'] );
767 // Light/Dark Mode
768 $enable_dark_mode = $admin_bar_mode != 'light';
769 // Screen Option && Hide WP Links
770 $enable_screen_tab = Utils::get_user_preference( 'screen_options_tab' );
771 $enable_help_tab = Utils::get_user_preference( 'adminify_help_tab' );
772 // $enable_hide_wp_links = Utils::get_user_preference( 'hide_wp_links' );
773 // Admin Bar Position
774
775 if ( !empty($this->options['admin_bar_position']) === 'top' ) {
776 $admin_bar_position = 'top_bar';
777 } elseif ( !empty($this->options['admin_bar_position']) === 'bottom' ) {
778 $admin_bar_position = 'bottom_bar is-fixed-bottom';
779 } else {
780 $admin_bar_position = 'top_bar';
781 }
782
783 $current_user = wp_get_current_user();
784 ob_start();
785 // Temporarily removing Topbar
786 // <div class="wp-adminify-topbar-loader"></div>
787 // 17-7-23, removed opacity for Conflicting Opacity Issue
788 // <div class="wp-adminify adminify-top_bar" style="opacity: 0;">
789 ?>
790
791
792
793 <div class="wp-adminify adminify-top_bar">
794 <nav class="navbar adminify-top-navbar <?php
795 echo esc_attr( $admin_bar_position ) ;
796 ?>">
797
798 <?php
799 $this->jltwp_adminify_logo();
800 ?>
801 <div class="adminify-admin-wrapper">
802 <div class="adminify-legacy-admin">
803 <?php
804 echo wp_admin_bar_render() ;
805 ?>
806 </div>
807
808 <div id="wp-adminify-top-adminbar" class="navbar-menu">
809
810 <div class="navbar-end">
811 <div class="field is-grouped">
812
813 <?php
814
815 if ( !empty($this->options['admin_bar_dark_light_btn']) ) {
816 ?>
817 <div class="wp-admnify--mode--switcher pr-4">
818 <label class="admnify-switcher is-pulled-right">
819 <input type="checkbox" id="light-dark-switcher-btn" <?php
820 checked( $enable_dark_mode, 1 );
821 ?>>
822 <span class="slider round"></span>
823 </label>
824 </div>
825 <?php
826 }
827
828 ?>
829
830 <?php
831
832 if ( !empty($this->options['admin_bar_comments']) ) {
833 ?>
834 <div class="wp-adminify--top--comment ml-4 mr-4">
835 <button class="comment-trigger is-clickable">
836 <div class="topbar-icon">
837 <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
838 <path d="M0.25 13.75V1.75C0.25 0.921573 0.921572 0.25 1.75 0.25H12.25C13.0784 0.25 13.75 0.921573 13.75 1.75V9.25C13.75 10.0784 13.0784 10.75 12.25 10.75H4.75C4.42535 10.7494 4.10936 10.8547 3.85 11.05L0.25 13.75ZM1.75 1.75V10.75L3.3505 9.55C3.60973 9.35448 3.9258 9.24913 4.2505 9.25H12.25V1.75H1.75Z" fill="#4E4B66" />
839 </svg>
840 </div>
841 <span class="comment-counter p-0 tag is-rounded">
842 <?php
843 $comments_count = wp_count_comments();
844 echo esc_html( $comments_count->moderated ) ;
845 ?>
846 </span>
847 </button>
848 </div>
849
850 <?php
851 }
852
853
854 if ( !empty($this->options['admin_bar_view_website']) ) {
855 ?>
856 <div class="wp-adminify--preview mr-4">
857 <a class="preview-trigger is-clickable" href="<?php
858 echo esc_url( get_home_url() ) ;
859 ?>"
860 <?php
861 if ( !empty($this->options['admin_bar_view_website_window_type']) && $this->options['admin_bar_view_website_window_type'] == 'new_tab' ) {
862 ?>
863 target="_blank"
864 <?php
865 }
866 ?>
867 >
868 <i class="dashicons dashicons-visibility"></i>
869 </a>
870 </div>
871 <?php
872 }
873
874 ?>
875
876 <div class="wp-adminify--user--account">
877 <button class="user-avatar is-clickable">
878 <div class="image is-45x45">
879 <?php
880 echo get_avatar(
881 $current_user->user_email,
882 45,
883 '',
884 '',
885 [
886 'class' => 'is-rounded',
887 ]
888 ) ;
889 ?>
890 </div>
891 <span class="user-status tag p-0 is-rounded"></span>
892 </button>
893 </div>
894
895 </div>
896 </div>
897 </div>
898 </div>
899 </nav>
900
901 <?php
902
903 if ( !empty($this->options['admin_bar_user_offcanvas_menu']) ) {
904 ?>
905 <div class="wp-adminify--user--wrapper">
906 <div class="user-wqrapper-inner">
907 <button class="user-wrapper-close is-clickable">
908 <img src="<?php
909 echo esc_url( WP_ADMINIFY_ASSETS ) ;
910 ?>images/header/close.svg" alt="Close Icon">
911 </button>
912
913 <div class="user-wrapper-top media">
914 <figure class="media-left">
915 <p class="image is-85x85">
916 <?php
917 echo get_avatar(
918 $current_user->user_email,
919 85,
920 '',
921 '',
922 [
923 'class' => 'is-rounded',
924 ]
925 ) ;
926 ?>
927 </p>
928 </figure>
929 <div class="media-content">
930 <div class="content">
931 <h3 class="name">
932 <?php
933 echo esc_html( $current_user->display_name ) ;
934 ?>
935 </h3>
936 <a href="<?php
937 echo esc_url( admin_url( 'profile.php' ) ) ;
938 ?>" class="email">
939 <?php
940 echo wp_kses_post( is_email( $current_user->user_email ) ) ;
941 ?>
942 </a>
943 <br>
944 <a href="<?php
945 echo esc_url( wp_logout_url() ) ;
946 ?>" class="logout button">
947 <?php
948 echo esc_html__( 'Log Out', 'adminify' ) ;
949 ?>
950 </a>
951 </div>
952 </div>
953 </div>
954
955
956 <div class="user-wrapper-content">
957 <div class="panel-insider">
958 <h4 class="title"><?php
959 esc_html__( 'Overview', 'adminify' );
960 ?></h4>
961 <ul>
962 <li>
963 <a href="<?php
964 echo esc_url( get_home_url() ) ;
965 ?>" target="_blank">
966 <img class="user-panel-icon" src="<?php
967 echo esc_url( WP_ADMINIFY_ASSETS ) ;
968 ?>images/header/panel/building.svg" alt="<?php
969 echo esc_html__( 'View Website Icon', 'adminify' ) ;
970 ?>">
971 <?php
972 echo esc_html_e( 'View Website', 'adminify' ) ;
973 ?>
974 </a>
975 </li>
976 <li>
977 <a href="<?php
978 echo esc_url( admin_url( 'profile.php' ) ) ;
979 ?>">
980 <img class="user-panel-icon" src="<?php
981 echo esc_url( WP_ADMINIFY_ASSETS ) ;
982 ?>images/header/panel/users.svg" alt="<?php
983 echo esc_html__( 'Profile Icon', 'adminify' ) ;
984 ?>">
985 <?php
986 esc_html_e( 'View Profile', 'adminify' );
987 ?>
988 </a>
989 </li>
990 </ul>
991 </div>
992
993 <?php
994 $all_updates = Utils::get_all_updates();
995 $total_updates = $all_updates['total'];
996 $plugin_updates = $all_updates['plugin'];
997 $theme_updates = $all_updates['theme'];
998 $wp_updates = $all_updates['wordpress'];
999 ?>
1000
1001
1002 <div class="panel-insider">
1003 <h4 class="title"><?php
1004 esc_html_e( 'Updates', 'adminify' );
1005 ?></h4>
1006 <?php
1007
1008 if ( $total_updates < 1 ) {
1009 ?>
1010 <p class="adminify-meta">
1011 <?php
1012 esc_html_e( 'Everything is up to date', 'adminify' );
1013 ?>
1014 </p>
1015 <?php
1016 } else {
1017 ?>
1018 <ul>
1019
1020 <li>
1021 <a href="<?php
1022 echo esc_url( admin_url( 'update-core.php' ) ) ;
1023 ?>">
1024 <span class="icon-reload"></span>
1025 <?php
1026 esc_html_e( 'All Updates', 'adminify' );
1027 ?>
1028 <span class="count tag is-rounded">
1029 <?php
1030 echo esc_html( $total_updates ) ;
1031 ?>
1032 </span>
1033 </a>
1034 </li>
1035 <li>
1036 <a href="<?php
1037 echo esc_url( admin_url( 'update-core.php' ) ) ;
1038 ?>">
1039 <span class="dashicons dashicons-wordpress"></span>
1040 <?php
1041 esc_html_e( ' WordPress Core', 'adminify' );
1042 ?>
1043 <span class="count tag is-rounded">
1044 <?php
1045 echo esc_html( $wp_updates ) ;
1046 ?>
1047 </span>
1048 </a>
1049 </li>
1050 <li>
1051 <a href="<?php
1052 echo esc_url( admin_url( 'plugins.php' ) ) ;
1053 ?>">
1054 <span class="icon-energy"></span>
1055 <?php
1056 esc_html_e( ' Plugins', 'adminify' );
1057 ?>
1058 <span class="count tag is-rounded"><?php
1059 echo esc_html( count( $plugin_updates ) ) ;
1060 ?></span>
1061 </a>
1062 </li>
1063 <li>
1064 <a href="<?php
1065 echo esc_url( admin_url( 'themes.php' ) ) ;
1066 ?>">
1067 <img class="user-panel-icon" src="<?php
1068 echo esc_url( WP_ADMINIFY_ASSETS ) ;
1069 ?>images/header/panel/plugins.svg" />
1070 <?php
1071 esc_html_e( ' Themes', 'adminify' );
1072 ?>
1073 <span class="count tag is-rounded"><?php
1074 echo esc_html( count( $theme_updates ) ) ;
1075 ?></span>
1076 </a>
1077 </li>
1078 </ul>
1079 <?php
1080 }
1081
1082 ?>
1083 </div>
1084
1085 <div class="panel-insider">
1086 <h4 class="title"><?php
1087 esc_html_e( 'Preferences', 'adminify' );
1088 ?></h4>
1089 <ul>
1090 <li>
1091 <?php
1092 esc_html_e( 'Screen Tab Hide', 'adminify' );
1093 ?>
1094 <label class="admnify-switcher is-pulled-right">
1095 <input type="checkbox" id="screen-option-switcher-btn" <?php
1096 checked( $enable_screen_tab, 1 );
1097 ?>>
1098 <span class="slider round"></span>
1099 </label>
1100 </li>
1101 <li>
1102 <?php
1103 esc_html_e( 'Help Tab Hide ', 'adminify' );
1104 ?>
1105 <label class="admnify-switcher is-pulled-right">
1106 <input type="checkbox" id="help-option-switcher-btn" <?php
1107 checked( $enable_help_tab, 1 );
1108 ?>>
1109 <span class="slider round"></span>
1110 </label>
1111 </li>
1112 <?php
1113 $on = false;
1114 // temporary hide this menu
1115
1116 if ( $on == true ) {
1117 ?>
1118 <li>
1119 <?php
1120 esc_html_e( 'Hide WP Links', 'adminify' );
1121 ?>
1122 <label class="admnify-switcher is-pulled-right">
1123 <input type="checkbox" id="hide-wp-links-switcher-btn" <?php
1124 checked( $enable_hide_wp_links, 1 );
1125 ?>>
1126 <span class="slider round"></span>
1127 </label>
1128 </li>
1129 <?php
1130 }
1131
1132 ?>
1133 </ul>
1134 </div>
1135 </div>
1136
1137 <!-- <div class="user-notification-area pb-5">
1138 <h4>
1139 <?php
1140 // esc_html_e('All Notifications', 'adminify');
1141 ?>
1142 </h4>
1143 <ul class="m-0 p-0">
1144 <li>
1145 <a href="#">Dashboard: <span class="count has-text-centered is-pulled-right">2</span></a>
1146 </li>
1147 <li>
1148 <a href="#">Themes: <span class="count has-text-centered is-pulled-right">2</span></a>
1149 </li>
1150 <li>
1151 <a href="#">Plugins: <span class="count has-text-centered is-pulled-right">2</span></a>
1152 </li>
1153 <li>
1154 <a href="#">Settings: <span class="count has-text-centered is-pulled-right">2</span></a>
1155 </li>
1156 </ul>
1157 </div> -->
1158
1159 </div>
1160 </div>
1161 <?php
1162 }
1163
1164 ?>
1165 </div>
1166
1167 <?php
1168 $output_wp_admin_bar = ob_get_clean();
1169 echo Utils::wp_kses_custom( $output_wp_admin_bar ) ;
1170 }
1171
1172 public function jltwp_adminify_logo()
1173 {
1174 global $wp_admin_bar ;
1175 $adminurl = get_admin_url();
1176 $homeurl = $adminurl;
1177 // Light Logo
1178 $admin_bar_mode = AdminSettings::get_instance()->get();
1179 $menu_layout = (array) $admin_bar_mode['menu_layout_settings'];
1180 // Menu Layouts
1181 $menu_layout = ( !empty($admin_bar_mode['menu_layout_settings']) ? $admin_bar_mode['menu_layout_settings'] : '' );
1182 $menu_mode = ( !empty($menu_layout['menu_mode']) ? $menu_layout['menu_mode'] : 'classic' );
1183 $menu_layout = ( !empty($menu_layout['layout_type']) ? $menu_layout['layout_type'] : 'vertical' );
1184 $admin_bar_logo_type = ( !empty($admin_bar_mode['admin_bar_logo_type']) ? $admin_bar_mode['admin_bar_logo_type'] : 'image_logo' );
1185 $light_mode = ( !empty($admin_bar_mode['admin_bar_light_mode']) ? $admin_bar_mode['admin_bar_light_mode'] : '' );
1186
1187 if ( $admin_bar_logo_type == 'image_logo' ) {
1188 // Logo Image
1189
1190 if ( !empty($light_mode['admin_bar_light_logo']['url']) ) {
1191 $light_logo = $light_mode['admin_bar_light_logo']['url'];
1192 } else {
1193
1194 if ( $menu_layout == 'vertical' && $menu_mode == 'icon_menu' ) {
1195 $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
1196 } else {
1197 $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
1198 }
1199
1200 }
1201
1202 } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1203 // Text Logo
1204 if ( $admin_bar_mode['admin_bar_mode'] == 'light' ) {
1205 $text_logo = $light_mode['admin_bar_light_logo_text'];
1206 }
1207 }
1208
1209 // Logo Size
1210 $light_width = ( isset( $light_mode['light_logo_size']['width'] ) ? $light_mode['light_logo_size']['width'] : '150' );
1211 $light_height = ( isset( $light_mode['light_logo_size']['height'] ) ? $light_mode['light_logo_size']['height'] : '45' );
1212 // Dark Logo
1213 $dark_mode = ( !empty($admin_bar_mode['admin_bar_dark_mode']) ? $admin_bar_mode['admin_bar_dark_mode'] : '' );
1214
1215 if ( $admin_bar_logo_type == 'image_logo' ) {
1216 // Dark Logo Image
1217
1218 if ( isset( $dark_mode['admin_bar_dark_logo']['url'] ) && $dark_mode['admin_bar_dark_logo']['url'] ) {
1219 $dark_logo = $dark_mode['admin_bar_dark_logo']['url'];
1220 } else {
1221
1222 if ( $menu_layout == 'vertical' && $menu_mode === 'icon_menu' ) {
1223 $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1224 } else {
1225 $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1226 }
1227
1228 }
1229
1230 } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1231 // Text Logo
1232 if ( $admin_bar_mode['admin_bar_mode'] == 'dark' ) {
1233 $text_logo = $dark_mode['admin_bar_dark_logo_text'];
1234 }
1235 }
1236
1237 // Dark Logo Size
1238 $dark_width = ( isset( $dark_mode['dark_logo_size']['width'] ) ? $dark_mode['dark_logo_size']['width'] : '150' );
1239 $dark_height = ( isset( $dark_mode['dark_logo_size']['height'] ) ? $dark_mode['dark_logo_size']['height'] : '45' );
1240 ?>
1241
1242 <div class="navbar-brand">
1243 <a class="navbar-item p-0" href="<?php
1244 echo esc_url( $homeurl ) ;
1245 ?>">
1246 <?php
1247
1248 if ( $admin_bar_logo_type == 'image_logo' ) {
1249 ?>
1250 <img alt="<?php
1251 echo esc_attr( get_bloginfo( 'name' ) ) ;
1252 ?>" class="logo-light" src="<?php
1253 echo esc_url( $light_logo ) ;
1254 ?>" width="<?php
1255 echo esc_attr( $light_width ) ;
1256 ?>" height="<?php
1257 echo esc_attr( $light_height ) ;
1258 ?>">
1259 <img alt="<?php
1260 echo esc_attr( get_bloginfo( 'name' ) ) ;
1261 ?>" class="logo-dark" src="<?php
1262 echo esc_url( $dark_logo ) ;
1263 ?>" width="<?php
1264 echo esc_attr( $dark_width ) ;
1265 ?>" height="<?php
1266 echo esc_attr( $dark_height ) ;
1267 ?>">
1268 <?php
1269 } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1270 ?>
1271 <span class="wp-adminify-site-name">
1272 <?php
1273 echo esc_html( $text_logo ) ;
1274 ?>
1275 </span>
1276 <?php
1277 }
1278
1279 ?>
1280 </a>
1281
1282
1283 <div class="navbar-burger" data-target="wp-adminify-top-adminbar">
1284 <i class="dashicons dashicons-menu-alt"></i>
1285 </div>
1286
1287 </div>
1288
1289 <?php
1290 }
1291
1292 /* Remove from the administration bar */
1293 public function jltma_adminify_remove_admin_bar_menus()
1294 {
1295 global $wp_admin_bar ;
1296 $restricted_user = ( !empty($this->options['admin_bar_new_button_user_roles']) ? $this->options['admin_bar_new_button_user_roles'] : '' );
1297 if ( $restricted_user ) {
1298
1299 if ( Utils::restrict_for( $this->options['admin_bar_new_button_user_roles'] ) ) {
1300 $wp_admin_bar->remove_menu( 'new-content' );
1301 return;
1302 }
1303
1304 }
1305 $wp_admin_bar->remove_menu( 'wp-logo' );
1306 $wp_admin_bar->remove_menu( 'site-name' );
1307 $wp_admin_bar->remove_menu( 'updates' );
1308 $wp_admin_bar->remove_menu( 'menu-toggle' );
1309 }
1310
1311 }