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

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

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