PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.1.9
Adminify – White Label, Admin Menu Editor, Login Customizer v3.1.9
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.9, at Inc/Classes/AdminBar.php

1,324 lines 46.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\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 $current_screen = get_current_screen();
590 $admin_bar_mode = AdminSettings::get_instance()->get();
591 $admin_bar_mode = ( !empty($admin_bar_mode['admin_bar_mode']) ? $admin_bar_mode['admin_bar_mode'] : '' );
592 $output_css = '';
593 $output_css .= '<style type="text/css">';
594 if ( !empty($current_screen->is_block_editor) ) {
595 $output_css .= '.wp-adminify.block-editor-page .interface-interface-skeleton { top: 0 !important; border-top: 0 !important; border-left: 0 !important; }';
596 }
597 $admin_bar_container = ( !empty($this->options['admin_bar_container']) ? $this->options['admin_bar_container'] : 'full_container' );
598
599 if ( $admin_bar_mode === 'light' ) {
600 $light_bg_type = ( !empty($this->options['admin_bar_light_bg']) ? $this->options['admin_bar_light_bg'] : 'color' );
601 $light_bg_color = ( !empty($this->options['admin_bar_light_bg_color']) ? $this->options['admin_bar_light_bg_color'] : '' );
602 // Full Container Colors
603
604 if ( $admin_bar_container == 'full_container' ) {
605 if ( $light_bg_type === 'color' ) {
606 $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 ) . ' ; }';
607 }
608 } elseif ( $admin_bar_container == 'admin_bar_only' ) {
609 // Admin Bar Colors
610 if ( $light_bg_type === 'color' ) {
611 if ( !empty($this->options['admin_bar_light_bg_color']) ) {
612 $output_css .= '.wp-adminify.adminify-light-mode .adminify-top_bar nav.navbar { background-color:' . esc_attr( $light_bg_color ) . ' }';
613 }
614 }
615 }
616
617 if ( !empty($admin_bar_colors['icon_color']) ) {
618 $output_css .= '.adminify-top_bar nav.navbar .navbar-menu .topbar-icon { fill: ' . esc_attr( $admin_bar_colors['icon_color'] ) . ' }';
619 }
620 } elseif ( $admin_bar_mode === 'dark' ) {
621 $dark_bg_type = ( isset( $this->options['admin_bar_dark_bg'] ) ? $this->options['admin_bar_dark_bg'] : 'color' );
622
623 if ( $admin_bar_container == 'full_container' ) {
624
625 if ( $dark_bg_type === 'color' ) {
626 $dark_bg_color = $this->options['admin_bar_dark_bg_color'];
627 $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 ) . ' }';
628 } elseif ( $dark_bg_type === 'gradient' ) {
629 $dark_gradient_bg_color = $this->options['admin_bar_dark_bg_gradient']['background-color'];
630 $dark_gradient_color = $this->options['admin_bar_dark_bg_gradient']['background-gradient-color'];
631 $dark_gradient_color_dir = $this->options['admin_bar_dark_bg_gradient']['background-gradient-direction'];
632 $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 ) . '); }';
633 }
634
635 } elseif ( $admin_bar_container == 'admin_bar_only' ) {
636
637 if ( $dark_bg_type === 'color' ) {
638 $dark_bg_color = $this->options['admin_bar_dark_bg_color'];
639 $output_css .= '.wp-adminify.adminify-dark-mode .adminify-top_bar nav.navbar{ background-color:' . esc_attr( $dark_bg_color ) . ' }';
640 }
641
642 }
643
644 }
645
646 // "New" Button Colors
647 $new_btn_colors = ( !empty($this->options['admin_bar_link_color']) ? $this->options['admin_bar_link_color'] : '' );
648 if ( !empty($new_btn_colors['link_color']) ) {
649 $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'] ) . ' }';
650 }
651 if ( !empty($new_btn_colors['hover_color']) ) {
652 $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'] ) . ' }';
653 }
654 if ( !empty($new_btn_colors['bg_color']) ) {
655 $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'] ) . ';}';
656 }
657 // "New" Button Hover Colors
658 $new_btn_dropwon = ( !empty($this->options['admin_bar_link_dropdown_color']) ? $this->options['admin_bar_link_dropdown_color'] : '' );
659 if ( !empty($new_btn_dropwon['wrapper_bg']) ) {
660 $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;}';
661 }
662 if ( !empty($new_btn_dropwon['bg_color']) ) {
663 $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;}';
664 }
665 if ( !empty($new_btn_dropwon['link_color']) ) {
666 $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item { color:' . esc_attr( $new_btn_dropwon['link_color'] ) . ' !important }';
667 }
668 if ( !empty($new_btn_dropwon['hover_color']) ) {
669 $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 }';
670 }
671 // Text Color
672
673 if ( !empty($this->options['admin_bar_text_color']) ) {
674 $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'] ) . ' }';
675 $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'] ) . ' ; }';
676 $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'] ) . ' ; }';
677 $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'] ) . ' ; }';
678 }
679
680 // Icon Color
681
682 if ( !empty($this->options['admin_bar_icon_color']) ) {
683 $output_css .= '.adminify-top_bar nav.navbar .navbar-menu .topbar-icon svg path { fill:' . esc_attr( $this->options['admin_bar_icon_color'] ) . ' }';
684 $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'] ) . ' }';
685 }
686
687 $output_css .= ' </style>';
688 echo Utils::wp_kses_custom( $output_css ) ;
689 }
690
691 // Admin Bar Body Class
692 public function admin_bar_body_class( $classes )
693 {
694
695 if ( is_admin() ) {
696 $classes .= ' wp-adminify-admin-bar';
697 $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
698
699 if ( $admin_bar_position === 'top' ) {
700 $classes .= ' position-top';
701 } elseif ( $admin_bar_position === 'bottom' ) {
702 $classes .= ' position-bottom';
703 }
704
705 if ( !empty($this->options['enable_admin_bar']) ) {
706 $classes .= ' topbar-disabled';
707 }
708 } else {
709 global $pagenow ;
710 if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
711 return $classes;
712 }
713 $classes[] = 'wp-adminify-admin-bar';
714 $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
715
716 if ( $admin_bar_position === 'top' ) {
717 $classes[] = 'admin-bar-position-top';
718 } elseif ( $admin_bar_position === 'bottom' ) {
719 $classes[] = 'admin-bar-position-bottom';
720 }
721
722 if ( !empty($this->options['enable_admin_bar']) ) {
723 $classes[] = 'topbar-disabled';
724 }
725 }
726
727 return $classes;
728 }
729
730 public function get_post_types()
731 {
732
733 if ( is_array( $this->post_types ) ) {
734 return $this->post_types;
735 } else {
736 $args = [
737 'public' => true,
738 ];
739 $output = 'objects';
740 $post_types = get_post_types( $args, $output );
741 $this->post_types = $post_types;
742 return $post_types;
743 }
744
745 }
746
747 public function jltwp_adminify_add_admin_bar()
748 {
749 // For Testing Admin Bar on Setup Wizard
750 // add_action('admin_head', [$this, 'jltwp_adminify_render_admin_bar']);
751 add_action( 'in_admin_header', [ $this, 'jltwp_adminify_render_admin_bar' ], -999999999 );
752 // on frontend area
753 add_action( 'wp_head', [ $this, 'jltwp_adminify_render_admin_bar' ] );
754 }
755
756 public function jltwp_adminify_render_admin_bar()
757 {
758 global $pagenow ;
759 if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
760 return;
761 }
762 if ( !is_admin_bar_showing() ) {
763 return false;
764 }
765 // Remove Adminbar from Gutenberg Block Editor Page
766 if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) {
767 // The Gutenberg plugin is on.
768 return;
769 }
770
771 if ( function_exists( 'get_current_screen' ) ) {
772 $current_screen = get_current_screen();
773 if ( !empty($current_screen->is_block_editor) ) {
774 return;
775 }
776 }
777
778 global $wp_admin_bar ;
779 if ( empty($wp_admin_bar) ) {
780 return false;
781 }
782 $admin_bar_mode = AdminSettings::get_instance()->get();
783 $admin_bar_mode = ( empty($admin_bar_mode['admin_bar_mode']) ? 'light' : $admin_bar_mode['admin_bar_mode'] );
784 // Light/Dark Mode
785 $enable_dark_mode = $admin_bar_mode != 'light';
786 // Screen Option && Hide WP Links
787 $enable_screen_tab = Utils::get_user_preference( 'screen_options_tab' );
788 $enable_help_tab = Utils::get_user_preference( 'adminify_help_tab' );
789 // $enable_hide_wp_links = Utils::get_user_preference( 'hide_wp_links' );
790 // Admin Bar Position
791
792 if ( !empty($this->options['admin_bar_position']) === 'top' ) {
793 $admin_bar_position = 'top_bar';
794 } elseif ( !empty($this->options['admin_bar_position']) === 'bottom' ) {
795 $admin_bar_position = 'bottom_bar is-fixed-bottom';
796 } else {
797 $admin_bar_position = 'top_bar';
798 }
799
800 $current_user = wp_get_current_user();
801 ob_start();
802 // Temporarily removing Topbar
803 // <div class="wp-adminify-topbar-loader"></div>
804 // 17-7-23, removed opacity for Conflicting Opacity Issue
805 // <div class="wp-adminify adminify-top_bar" style="opacity: 0;">
806 ?>
807
808
809
810 <div class="wp-adminify adminify-top_bar">
811 <nav class="navbar adminify-top-navbar <?php
812 echo esc_attr( $admin_bar_position ) ;
813 ?>">
814
815 <?php
816 $this->jltwp_adminify_logo();
817 ?>
818 <div class="adminify-admin-wrapper">
819 <div class="adminify-legacy-admin">
820 <?php
821 echo wp_admin_bar_render() ;
822 ?>
823 </div>
824
825 <div id="wp-adminify-top-adminbar" class="navbar-menu">
826
827 <div class="navbar-end">
828 <div class="field is-grouped">
829
830 <?php
831
832 if ( !empty($this->options['admin_bar_dark_light_btn']) ) {
833 ?>
834 <div class="wp-admnify--mode--switcher pr-4">
835 <label class="admnify-switcher is-pulled-right">
836 <input type="checkbox" id="light-dark-switcher-btn" <?php
837 checked( $enable_dark_mode, 1 );
838 ?>>
839 <span class="slider round"></span>
840 </label>
841 </div>
842 <?php
843 }
844
845 ?>
846
847 <?php
848
849 if ( !empty($this->options['admin_bar_comments']) ) {
850 ?>
851 <div class="wp-adminify--top--comment ml-4 mr-4">
852 <button class="comment-trigger is-clickable">
853 <div class="topbar-icon">
854 <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
855 <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" />
856 </svg>
857 </div>
858 <span class="comment-counter p-0 tag is-rounded">
859 <?php
860 $comments_count = wp_count_comments();
861 echo esc_html( $comments_count->moderated ) ;
862 ?>
863 </span>
864 </button>
865 </div>
866
867 <?php
868 }
869
870
871 if ( !empty($this->options['admin_bar_view_website']) ) {
872 ?>
873 <div class="wp-adminify--preview mr-4">
874 <a class="preview-trigger is-clickable" href="<?php
875 echo esc_url( get_home_url() ) ;
876 ?>" <?php
877 if ( !empty($this->options['admin_bar_view_website_window_type']) && $this->options['admin_bar_view_website_window_type'] == 'new_tab' ) {
878 ?> target="_blank" <?php
879 }
880 ?>>
881 <i class="dashicons dashicons-visibility"></i>
882 </a>
883 </div>
884 <?php
885 }
886
887 ?>
888
889 <div class="wp-adminify--user--account">
890 <button class="user-avatar is-clickable">
891 <div class="image is-45x45">
892 <?php
893 echo get_avatar(
894 $current_user->user_email,
895 45,
896 '',
897 '',
898 [
899 'class' => 'is-rounded',
900 ]
901 ) ;
902 ?>
903 </div>
904 <span class="user-status tag p-0 is-rounded"></span>
905 </button>
906 </div>
907
908 </div>
909 </div>
910 </div>
911 </div>
912 </nav>
913
914 <?php
915
916 if ( !empty($this->options['admin_bar_user_offcanvas_menu']) ) {
917 ?>
918 <div class="wp-adminify--user--wrapper">
919 <div class="user-wqrapper-inner">
920 <button class="user-wrapper-close is-clickable">
921 <img src="<?php
922 echo esc_url( WP_ADMINIFY_ASSETS ) ;
923 ?>images/header/close.svg" alt="Close Icon">
924 </button>
925
926 <div class="user-wrapper-top media">
927 <figure class="media-left">
928 <p class="image is-85x85">
929 <?php
930 echo get_avatar(
931 $current_user->user_email,
932 85,
933 '',
934 '',
935 [
936 'class' => 'is-rounded',
937 ]
938 ) ;
939 ?>
940 </p>
941 </figure>
942 <div class="media-content">
943 <div class="content">
944 <h3 class="name">
945 <?php
946 echo esc_html( $current_user->display_name ) ;
947 ?>
948 </h3>
949 <a href="<?php
950 echo esc_url( admin_url( 'profile.php' ) ) ;
951 ?>" class="email">
952 <?php
953 echo wp_kses_post( is_email( $current_user->user_email ) ) ;
954 ?>
955 </a>
956 <br>
957 <a href="<?php
958 echo esc_url( wp_logout_url() ) ;
959 ?>" class="logout button">
960 <?php
961 echo esc_html__( 'Log Out', 'adminify' ) ;
962 ?>
963 </a>
964 </div>
965 </div>
966 </div>
967
968
969 <div class="user-wrapper-content">
970 <div class="panel-insider">
971 <h4 class="title"><?php
972 esc_html__( 'Overview', 'adminify' );
973 ?></h4>
974 <ul>
975 <li>
976 <a href="<?php
977 echo esc_url( get_home_url() ) ;
978 ?>" target="_blank">
979 <img class="user-panel-icon" src="<?php
980 echo esc_url( WP_ADMINIFY_ASSETS ) ;
981 ?>images/header/panel/building.svg" alt="<?php
982 echo esc_html__( 'View Website Icon', 'adminify' ) ;
983 ?>">
984 <?php
985 echo esc_html_e( 'View Website', 'adminify' ) ;
986 ?>
987 </a>
988 </li>
989 <li>
990 <a href="<?php
991 echo esc_url( admin_url( 'profile.php' ) ) ;
992 ?>">
993 <img class="user-panel-icon" src="<?php
994 echo esc_url( WP_ADMINIFY_ASSETS ) ;
995 ?>images/header/panel/users.svg" alt="<?php
996 echo esc_html__( 'Profile Icon', 'adminify' ) ;
997 ?>">
998 <?php
999 esc_html_e( 'View Profile', 'adminify' );
1000 ?>
1001 </a>
1002 </li>
1003 </ul>
1004 </div>
1005
1006 <?php
1007 $all_updates = Utils::get_all_updates();
1008 $total_updates = $all_updates['total'];
1009 $plugin_updates = $all_updates['plugin'];
1010 $theme_updates = $all_updates['theme'];
1011 $wp_updates = $all_updates['wordpress'];
1012 ?>
1013
1014
1015 <div class="panel-insider">
1016 <h4 class="title"><?php
1017 esc_html_e( 'Updates', 'adminify' );
1018 ?></h4>
1019 <?php
1020
1021 if ( $total_updates < 1 ) {
1022 ?>
1023 <p class="adminify-meta">
1024 <?php
1025 esc_html_e( 'Everything is up to date', 'adminify' );
1026 ?>
1027 </p>
1028 <?php
1029 } else {
1030 ?>
1031 <ul>
1032
1033 <li>
1034 <a href="<?php
1035 echo esc_url( admin_url( 'update-core.php' ) ) ;
1036 ?>">
1037 <span class="icon-reload"></span>
1038 <?php
1039 esc_html_e( 'All Updates', 'adminify' );
1040 ?>
1041 <span class="count tag is-rounded">
1042 <?php
1043 echo esc_html( $total_updates ) ;
1044 ?>
1045 </span>
1046 </a>
1047 </li>
1048 <li>
1049 <a href="<?php
1050 echo esc_url( admin_url( 'update-core.php' ) ) ;
1051 ?>">
1052 <span class="dashicons dashicons-wordpress"></span>
1053 <?php
1054 esc_html_e( ' WordPress Core', 'adminify' );
1055 ?>
1056 <span class="count tag is-rounded">
1057 <?php
1058 echo esc_html( $wp_updates ) ;
1059 ?>
1060 </span>
1061 </a>
1062 </li>
1063 <li>
1064 <a href="<?php
1065 echo esc_url( admin_url( 'plugins.php' ) ) ;
1066 ?>">
1067 <span class="icon-energy"></span>
1068 <?php
1069 esc_html_e( ' Plugins', 'adminify' );
1070 ?>
1071 <span class="count tag is-rounded"><?php
1072 echo esc_html( count( $plugin_updates ) ) ;
1073 ?></span>
1074 </a>
1075 </li>
1076 <li>
1077 <a href="<?php
1078 echo esc_url( admin_url( 'themes.php' ) ) ;
1079 ?>">
1080 <img class="user-panel-icon" src="<?php
1081 echo esc_url( WP_ADMINIFY_ASSETS ) ;
1082 ?>images/header/panel/plugins.svg" />
1083 <?php
1084 esc_html_e( ' Themes', 'adminify' );
1085 ?>
1086 <span class="count tag is-rounded"><?php
1087 echo esc_html( count( $theme_updates ) ) ;
1088 ?></span>
1089 </a>
1090 </li>
1091 </ul>
1092 <?php
1093 }
1094
1095 ?>
1096 </div>
1097
1098 <div class="panel-insider">
1099 <h4 class="title"><?php
1100 esc_html_e( 'Preferences', 'adminify' );
1101 ?></h4>
1102 <ul>
1103 <li>
1104 <?php
1105 esc_html_e( 'Screen Tab Hide', 'adminify' );
1106 ?>
1107 <label class="admnify-switcher is-pulled-right">
1108 <input type="checkbox" id="screen-option-switcher-btn" <?php
1109 checked( $enable_screen_tab, 1 );
1110 ?>>
1111 <span class="slider round"></span>
1112 </label>
1113 </li>
1114 <li>
1115 <?php
1116 esc_html_e( 'Help Tab Hide ', 'adminify' );
1117 ?>
1118 <label class="admnify-switcher is-pulled-right">
1119 <input type="checkbox" id="help-option-switcher-btn" <?php
1120 checked( $enable_help_tab, 1 );
1121 ?>>
1122 <span class="slider round"></span>
1123 </label>
1124 </li>
1125 <?php
1126 $on = false;
1127 // temporary hide this menu
1128
1129 if ( $on == true ) {
1130 ?>
1131 <li>
1132 <?php
1133 esc_html_e( 'Hide WP Links', 'adminify' );
1134 ?>
1135 <label class="admnify-switcher is-pulled-right">
1136 <input type="checkbox" id="hide-wp-links-switcher-btn" <?php
1137 checked( $enable_hide_wp_links, 1 );
1138 ?>>
1139 <span class="slider round"></span>
1140 </label>
1141 </li>
1142 <?php
1143 }
1144
1145 ?>
1146 </ul>
1147 </div>
1148 </div>
1149
1150 <!-- <div class="user-notification-area pb-5">
1151 <h4>
1152 <?php
1153 // esc_html_e('All Notifications', 'adminify');
1154 ?>
1155 </h4>
1156 <ul class="m-0 p-0">
1157 <li>
1158 <a href="#">Dashboard: <span class="count has-text-centered is-pulled-right">2</span></a>
1159 </li>
1160 <li>
1161 <a href="#">Themes: <span class="count has-text-centered is-pulled-right">2</span></a>
1162 </li>
1163 <li>
1164 <a href="#">Plugins: <span class="count has-text-centered is-pulled-right">2</span></a>
1165 </li>
1166 <li>
1167 <a href="#">Settings: <span class="count has-text-centered is-pulled-right">2</span></a>
1168 </li>
1169 </ul>
1170 </div> -->
1171
1172 </div>
1173 </div>
1174 <?php
1175 }
1176
1177 ?>
1178 </div>
1179
1180 <?php
1181 $output_wp_admin_bar = ob_get_clean();
1182 echo Utils::wp_kses_custom( $output_wp_admin_bar ) ;
1183 }
1184
1185 public function jltwp_adminify_logo()
1186 {
1187 global $wp_admin_bar ;
1188 $adminurl = get_admin_url();
1189 $homeurl = $adminurl;
1190 // Light Logo
1191 $admin_bar_mode = AdminSettings::get_instance()->get();
1192 $menu_layout = (array) $admin_bar_mode['menu_layout_settings'];
1193 // Menu Layouts
1194 $menu_layout = ( !empty($admin_bar_mode['menu_layout_settings']) ? $admin_bar_mode['menu_layout_settings'] : '' );
1195 $menu_mode = ( !empty($menu_layout['menu_mode']) ? $menu_layout['menu_mode'] : 'classic' );
1196 $menu_layout = ( !empty($menu_layout['layout_type']) ? $menu_layout['layout_type'] : 'vertical' );
1197 $admin_bar_logo_type = ( !empty($admin_bar_mode['admin_bar_logo_type']) ? $admin_bar_mode['admin_bar_logo_type'] : 'image_logo' );
1198 $light_mode = ( !empty($admin_bar_mode['admin_bar_light_mode']) ? $admin_bar_mode['admin_bar_light_mode'] : '' );
1199
1200 if ( $admin_bar_logo_type == 'image_logo' ) {
1201 // Logo Image
1202
1203 if ( !empty($light_mode['admin_bar_light_logo']['url']) ) {
1204 $light_logo = $light_mode['admin_bar_light_logo']['url'];
1205 } else {
1206
1207 if ( $menu_layout == 'vertical' && $menu_mode == 'icon_menu' ) {
1208 $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
1209 } else {
1210 $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
1211 }
1212
1213 }
1214
1215 } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1216 // Text Logo
1217 if ( $admin_bar_mode['admin_bar_mode'] == 'light' ) {
1218 $text_logo = $light_mode['admin_bar_light_logo_text'];
1219 }
1220 }
1221
1222 // Logo Size
1223 $light_width = ( isset( $light_mode['light_logo_size']['width'] ) ? $light_mode['light_logo_size']['width'] : '150' );
1224 $light_height = ( isset( $light_mode['light_logo_size']['height'] ) ? $light_mode['light_logo_size']['height'] : '45' );
1225 // Dark Logo
1226 $dark_mode = ( !empty($admin_bar_mode['admin_bar_dark_mode']) ? $admin_bar_mode['admin_bar_dark_mode'] : '' );
1227
1228 if ( $admin_bar_logo_type == 'image_logo' ) {
1229 // Dark Logo Image
1230
1231 if ( isset( $dark_mode['admin_bar_dark_logo']['url'] ) && $dark_mode['admin_bar_dark_logo']['url'] ) {
1232 $dark_logo = $dark_mode['admin_bar_dark_logo']['url'];
1233 } else {
1234
1235 if ( $menu_layout == 'vertical' && $menu_mode === 'icon_menu' ) {
1236 $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1237 } else {
1238 $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1239 }
1240
1241 }
1242
1243 } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1244 // Text Logo
1245 if ( $admin_bar_mode['admin_bar_mode'] == 'dark' ) {
1246 $text_logo = $dark_mode['admin_bar_dark_logo_text'];
1247 }
1248 }
1249
1250 // Dark Logo Size
1251 $dark_width = ( isset( $dark_mode['dark_logo_size']['width'] ) ? $dark_mode['dark_logo_size']['width'] : '150' );
1252 $dark_height = ( isset( $dark_mode['dark_logo_size']['height'] ) ? $dark_mode['dark_logo_size']['height'] : '45' );
1253 ?>
1254
1255 <div class="navbar-brand">
1256 <a class="navbar-item p-0" href="<?php
1257 echo esc_url( $homeurl ) ;
1258 ?>">
1259 <?php
1260
1261 if ( $admin_bar_logo_type == 'image_logo' ) {
1262 ?>
1263 <img alt="<?php
1264 echo esc_attr( get_bloginfo( 'name' ) ) ;
1265 ?>" class="logo-light" src="<?php
1266 echo esc_url( $light_logo ) ;
1267 ?>" width="<?php
1268 echo esc_attr( $light_width ) ;
1269 ?>" height="<?php
1270 echo esc_attr( $light_height ) ;
1271 ?>">
1272 <img alt="<?php
1273 echo esc_attr( get_bloginfo( 'name' ) ) ;
1274 ?>" class="logo-dark" src="<?php
1275 echo esc_url( $dark_logo ) ;
1276 ?>" width="<?php
1277 echo esc_attr( $dark_width ) ;
1278 ?>" height="<?php
1279 echo esc_attr( $dark_height ) ;
1280 ?>">
1281 <?php
1282 } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1283 ?>
1284 <span class="wp-adminify-site-name">
1285 <?php
1286 echo esc_html( $text_logo ) ;
1287 ?>
1288 </span>
1289 <?php
1290 }
1291
1292 ?>
1293 </a>
1294
1295
1296 <div class="navbar-burger" data-target="wp-adminify-top-adminbar">
1297 <i class="dashicons dashicons-menu-alt"></i>
1298 </div>
1299
1300 </div>
1301
1302 <?php
1303 }
1304
1305 /* Remove from the administration bar */
1306 public function jltma_adminify_remove_admin_bar_menus()
1307 {
1308 global $wp_admin_bar ;
1309 $restricted_user = ( !empty($this->options['admin_bar_new_button_user_roles']) ? $this->options['admin_bar_new_button_user_roles'] : '' );
1310 if ( $restricted_user ) {
1311
1312 if ( Utils::restrict_for( $this->options['admin_bar_new_button_user_roles'] ) ) {
1313 $wp_admin_bar->remove_menu( 'new-content' );
1314 return;
1315 }
1316
1317 }
1318 $wp_admin_bar->remove_menu( 'wp-logo' );
1319 $wp_admin_bar->remove_menu( 'site-name' );
1320 $wp_admin_bar->remove_menu( 'updates' );
1321 $wp_admin_bar->remove_menu( 'menu-toggle' );
1322 }
1323
1324 }