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

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