PluginProbe
WP Console – WordPress PHP Console powered by PsySH / 2.4.0
WP Console – WordPress PHP Console powered by PsySH v2.4.0
trunk 2.4.0 2.4.1 2.5.0 2.5.1 2.6.0
wp-console / includes / AdminBar.php

AdminBar.php in WP Console – WordPress PHP Console powered by PsySH 2.4.0, at includes/AdminBar.php

51 lines 990 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPConsole;
4
5 class AdminBar {
6
7 /**
8 * Class constructor
9 *
10 * @since 2.0.0
11 *
12 * @return void
13 */
14 public function __construct() {
15 if ( ! current_user_can( 'manage_options' ) ) {
16 return;
17 }
18
19 add_action( 'wp_before_admin_bar_render', [ $this, 'add_admin_bar_quick_link' ] );
20 add_action( 'wp_after_admin_bar_render', [ $this, 'add_footer' ] );
21 }
22
23 /**
24 * Add admin bar quick link
25 *
26 * @since 1.0.0
27 *
28 * @return void
29 */
30 public function add_admin_bar_quick_link() {
31 global $wp_admin_bar;
32
33 $wp_admin_bar->add_menu( array(
34 'id' => 'wp-console',
35 'parent' => 'top-secondary',
36 'title' => __( 'Console', 'wp-console' ),
37 ) );
38 }
39
40 /**
41 * Add footer
42 *
43 * @since 1.0.0
44 *
45 * @return void
46 */
47 public function add_footer() {
48 echo '<div id="wp-console"></div>';
49 }
50 }
51