Skip to content
This repository was archived by the owner on Jun 6, 2021. It is now read-only.

Commit 4745aff

Browse files
committed
Two new panels added
WpCurrentScreenPanel & WpRolesPanel
1 parent 16b91d6 commit 4745aff

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ When it's activated, it automatically shows Tracy bar and displays within global
2727
6.4 `WpTracy\\WpQueryPanel`
2828
6.5 `WpTracy\\WpQueriedObjectPanel`
2929
6.6 `WpTracy\\WpDbPanel`
30+
6.7 `WpTracy\\WpRolesPanel`
3031
6.8 `WpTracy\\WpRewritePanel`
32+
6.9 `WpTracy\\WpCurrentScreenPanel`
3133

3234
![WP Tracy](https://hlavacm.github.io/images/wp-tracy.png "Tracy bar auto-display after plugin activation")
3335
![WP Tracy exception](https://hlavacm.github.io/images/wp-tracy-exception.png "Tracy exception dialog when is occured")

src/index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ function wp_tracy_init_action()
1515
"WpTracy\\WpQueryPanel",
1616
"WpTracy\\WpQueriedObjectPanel",
1717
"WpTracy\\WpDbPanel",
18+
"WpTracy\\WpRolesPanel",
1819
"WpTracy\\WpRewritePanel",
20+
"WpTracy\\WpCurrentScreenPanel",
1921
]; // in the correct order
2022

2123
$defaultSettings = [
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace WpTracy;
4+
5+
/**
6+
* Custom panel based on global $current_screen variable
7+
*
8+
* @author Martin Hlaváč
9+
*/
10+
class WpCurrentScreenPanel extends WpPanelBase
11+
{
12+
public function getTab()
13+
{
14+
global $current_screen;
15+
if (!empty($current_screen)) {
16+
return parent::getSimpleTab(__("Current Screen"));
17+
}
18+
return null;
19+
}
20+
21+
public function getPanel()
22+
{
23+
/** @var $current_screen \WP_Screen */
24+
global $current_screen;
25+
$output = parent::getObjectPanel($current_screen);
26+
return $output;
27+
}
28+
}

src/panels/wprolespanel.class.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace WpTracy;
4+
5+
/**
6+
* Custom panel based on global $wp_roles variable
7+
*
8+
* @author Martin Hlaváč
9+
*/
10+
class WpRolesPanel extends WpPanelBase
11+
{
12+
public function getTab()
13+
{
14+
return parent::getSimpleTab(__("Roles"));
15+
}
16+
17+
public function getPanel()
18+
{
19+
/* @var $wp_roles \WP_Roles */
20+
global $wp_roles;
21+
$output = parent::getObjectPanel($wp_roles);
22+
return $output;
23+
}
24+
}

0 commit comments

Comments
 (0)