Skip to content

Commit ff5b70f

Browse files
committed
Work in progress.
1 parent 0ee43ba commit ff5b70f

File tree

131 files changed

+2401
-1299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+2401
-1299
lines changed

core/functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function debugpress_rs( $value, bool $echo = true ) : string {
138138

139139
if ( $echo ) {
140140
echo $result;
141-
} else {
142-
return $result;
143141
}
142+
143+
return $result;
144144
}

core/main/Panel.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ public function table_row( $data ) {
125125
echo '</tr>';
126126
}
127127

128-
public function list_defines( $defines, $subtitle = '' ) {
129-
$this->block_header();
128+
public function list_defines( $defines, $subtitle = '', $block = true, $open = true ) {
129+
if ( $block ) {
130+
$this->block_header( $open );
131+
}
130132

131133
if ( $subtitle != '' ) {
132134
$this->sub_title( $subtitle );
@@ -140,11 +142,16 @@ public function list_defines( $defines, $subtitle = '' ) {
140142
$this->table_row( array( $const, $val ) );
141143
}
142144
$this->table_foot();
143-
$this->block_footer();
145+
146+
if ( $block ) {
147+
$this->block_footer();
148+
}
144149
}
145150

146-
public function list_array( $data, $subtitle = '' ) {
147-
$this->block_header();
151+
public function list_array( $data, $subtitle = '', $block = true, $open = true ) {
152+
if ( $block ) {
153+
$this->block_header( $open );
154+
}
148155

149156
if ( $subtitle != '' ) {
150157
$this->sub_title( $subtitle );
@@ -160,7 +167,9 @@ public function list_array( $data, $subtitle = '' ) {
160167
$this->table_foot();
161168
}
162169

163-
$this->block_footer();
170+
if ( $block ) {
171+
$this->block_footer();
172+
}
164173
}
165174

166175
public function list_properties( $object, $properties = array(), $subtitle = '' ) {

core/main/WP.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public function current_url( $use_wp = true ) : string {
3838
}
3939

4040
public function current_url_request() : string {
41-
$pathinfo = $_SERVER['PATH_INFO'] ?? '';
42-
list( $pathinfo ) = explode( '?', $pathinfo );
43-
$pathinfo = str_replace( '%', '%25', $pathinfo );
41+
$path_info = $_SERVER['PATH_INFO'] ?? '';
42+
list( $path_info ) = explode( '?', $path_info );
43+
$path_info = str_replace( '%', '%25', $path_info );
4444

4545
$request = explode( '?', $_SERVER['REQUEST_URI'] );
4646
$req_uri = $request[0];
@@ -49,10 +49,10 @@ public function current_url_request() : string {
4949
$home_path = $home_path ? trim( $home_path, '/' ) : '';
5050
$home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );
5151

52-
$req_uri = str_replace( $pathinfo, '', $req_uri );
53-
$req_uri = trim( $req_uri, '/' );
52+
$req_uri = str_replace( $path_info, '', $req_uri );
53+
$req_uri = ltrim( $req_uri, '/' );
5454
$req_uri = preg_replace( $home_path_regex, '', $req_uri );
55-
$req_uri = trim( $req_uri, '/' );
55+
$req_uri = ltrim( $req_uri, '/' );
5656

5757
$url_request = $req_uri;
5858

core/main/Wrap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
}
88

99
class Wrap {
10+
public $name;
11+
public $class;
12+
public $style;
13+
1014
function __construct( $args = array() ) {
1115
if ( is_array( $args ) && ! empty( $args ) ) {
1216
$this->from_array( $args );

core/panel/Admin.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@
1010

1111
class Admin extends Panel {
1212
public function left() {
13-
$this->title( __( "Page Information", "debugpress" ), true );
14-
$this->block_header( true );
13+
$this->title( __( "Page Information", "debugpress" ) );
14+
$this->block_header();
1515
$this->table_init_standard();
1616
$this->table_head();
17-
$this->table_row( array( "&#36;pagenow", isset( $GLOBALS['pagenow'] ) ? $GLOBALS['pagenow'] : '' ) );
18-
$this->table_row( array( "&#36;typenow", isset( $GLOBALS['typenow'] ) ? $GLOBALS['typenow'] : '' ) );
19-
$this->table_row( array( "&#36;taxnow", isset( $GLOBALS['taxnow'] ) ? $GLOBALS['taxnow'] : '' ) );
17+
$this->table_row( array( "&#36;pagenow", $GLOBALS['pagenow'] ?? '' ) );
18+
$this->table_row( array( "&#36;typenow", $GLOBALS['typenow'] ?? '' ) );
19+
$this->table_row( array( "&#36;taxnow", $GLOBALS['taxnow'] ?? '' ) );
2020
$this->table_row( array(
2121
"&#36;hook_suffix",
22-
isset( $GLOBALS['hook_suffix'] ) ? $GLOBALS['hook_suffix'] : ''
22+
$GLOBALS['hook_suffix'] ?? ''
2323
) );
2424
$this->table_foot();
2525
$this->block_footer();
2626

2727
$screen = get_current_screen();
2828

2929
if ( ! is_null( $screen ) ) {
30-
$this->title( __( "Current Screen", "debugpress" ), true );
31-
$this->block_header( true );
30+
$this->title( __( "Current Screen", "debugpress" ) );
31+
$this->block_header();
3232
$this->table_init_standard();
3333
$this->table_head();
3434
$this->table_row( array( __( "Base", "debugpress" ), $screen->base ) );
@@ -43,8 +43,8 @@ public function left() {
4343
}
4444

4545
public function right() {
46-
$this->title( __( "Conditionals", "debugpress" ), true );
47-
$this->block_header( true );
46+
$this->title( __( "Conditionals", "debugpress" ) );
47+
$this->block_header();
4848
$this->table_init_standard();
4949
$this->table_head();
5050
$this->table_row( array(

core/panel/Basics.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function left() {
2727
echo '<div class="debugpress-debug-notice-block">';
2828

2929
$this->title( '<i class="debugpress-icon debugpress-icon-exclamation"></i> ' . __( "Debug mode problems", "debugpress" ), true, true );
30-
$this->block_header( true );
30+
$this->block_header();
3131
foreach ( $test as $t ) {
3232
$this->sub_title( $t[0] );
3333
echo $t[1];
@@ -38,8 +38,8 @@ public function left() {
3838
echo '</div>';
3939
}
4040

41-
$this->title( __( "Page Loading Stats", "debugpress" ), true );
42-
$this->block_header( true );
41+
$this->title( __( "Page Loading Stats", "debugpress" ) );
42+
$this->block_header();
4343
$this->table_init_standard();
4444
$this->table_head();
4545
$this->table_row( array(
@@ -76,8 +76,8 @@ public function left() {
7676
$this->table_foot();
7777
$this->block_footer();
7878

79-
$this->title( __( "Current PHP Limits", "debugpress" ), true );
80-
$this->block_header( true );
79+
$this->title( __( "Current PHP Limits", "debugpress" ) );
80+
$this->block_header();
8181
$this->table_init_standard();
8282
$this->table_head();
8383
$this->table_row( array( __( "PHP Memory Available", "debugpress" ), ini_get( 'memory_limit' ) . "B" ) );
@@ -88,13 +88,13 @@ public function left() {
8888
$this->table_foot();
8989
$this->block_footer();
9090

91-
$this->title( __( "Upload Directory", "debugpress" ), true );
91+
$this->title( __( "Upload Directory", "debugpress" ) );
9292
$this->list_array( wp_upload_dir() );
9393
}
9494

9595
public function right() {
96-
$this->title( Info::cms_name(), true );
97-
$this->block_header( true );
96+
$this->title( Info::cms_name() );
97+
$this->block_header();
9898
$this->table_init_standard();
9999
$this->table_head();
100100
$this->table_row( array( __( "Version", "debugpress" ), Info::cms_version() ) );
@@ -105,11 +105,11 @@ public function right() {
105105
$this->table_foot();
106106
$this->block_footer();
107107

108-
$this->title( __( "Page Scope", "debugpress" ), true );
108+
$this->title( __( "Page Scope", "debugpress" ) );
109109
$this->list_array( debugpress_scope()->scope() );
110110

111-
$this->title( __( "Load Snapshots", "debugpress" ), true );
112-
$this->block_header( true );
111+
$this->title( __( "Load Snapshots", "debugpress" ) );
112+
$this->block_header();
113113
$this->add_column( __( "Name", "debugpress" ), "", "", true );
114114
$this->add_column( __( "Memory", "debugpress" ), "", "text-align: right;" );
115115
$this->add_column( __( "Timer", "debugpress" ), "", "text-align: right;" );
@@ -129,11 +129,11 @@ public function right() {
129129
$this->block_footer();
130130
}
131131

132-
private function _env() {
132+
private function _env() : array {
133133
return debugpress_plugin()->environment();
134134
}
135135

136-
private function _test() {
136+
private function _test() : array {
137137
$test = array();
138138

139139
if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {

core/panel/Constants.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,36 +130,36 @@ class Constants extends Panel {
130130
);
131131

132132
public function left() {
133-
$this->title( __( "Path, directories", "debugpress" ), true );
133+
$this->title( __( "Path, directories", "debugpress" ) );
134134
$this->list_defines( $this->constants['paths'] );
135135

136-
$this->title( __( "Debug", "debugpress" ), true );
136+
$this->title( __( "Debug", "debugpress" ) );
137137
$this->list_defines( $this->constants['dbg'] );
138138

139-
$this->title( __( "System", "debugpress" ), true );
139+
$this->title( __( "System", "debugpress" ) );
140140
$this->list_defines( $this->constants['sys'] );
141141

142-
$this->title( __( "Theme", "debugpress" ), true );
142+
$this->title( __( "Theme", "debugpress" ) );
143143
$this->list_defines( $this->constants['thm'] );
144144

145-
$this->title( __( "Database", "debugpress" ), true );
145+
$this->title( __( "Database", "debugpress" ) );
146146
$this->list_defines( $this->constants['db'] );
147147

148-
$this->title( __( "Request", "debugpress" ), true );
148+
$this->title( __( "Request", "debugpress" ) );
149149
$this->list_defines( $this->constants['req'] );
150150
}
151151

152152
public function right() {
153-
$this->title( __( "Global", "debugpress" ), true );
153+
$this->title( __( "Global", "debugpress" ) );
154154
$this->list_defines( $this->constants['glbl'] );
155155

156-
$this->title( __( "Multisite", "debugpress" ), true );
156+
$this->title( __( "Multisite", "debugpress" ) );
157157
$this->list_defines( $this->constants['ms'] );
158158

159-
$this->title( __( "Security", "debugpress" ), true );
159+
$this->title( __( "Security", "debugpress" ) );
160160
$this->list_defines( $this->constants['sec'] );
161161

162-
$this->title( __( "Back Compatibility", "debugpress" ), true );
162+
$this->title( __( "Back Compatibility", "debugpress" ) );
163163
$this->list_defines( $this->constants['bck'] );
164164
}
165165
}

core/panel/Content.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,37 @@ class Content extends Panel {
1212
public function left() {
1313
global $wp_taxonomies, $wp_post_types, $wp_post_statuses, $_wp_additional_image_sizes;
1414

15-
$this->title( __( "Registered Post Types", "debugpress" ), true );
15+
$this->title( __( "Registered Post Types", "debugpress" ) );
1616
$this->list_array( $wp_post_types );
1717

18-
$this->title( __( "Registered Taxonomies", "debugpress" ), true );
18+
$this->title( __( "Registered Taxonomies", "debugpress" ) );
1919
$this->list_array( $wp_taxonomies );
2020

21-
$this->title( __( "Registered Post Statuses", "debugpress" ), true );
21+
$this->title( __( "Registered Post Statuses", "debugpress" ) );
2222
$this->list_array( $wp_post_statuses );
2323

24-
$this->title( __( "Additional Image Sizes", "debugpress" ), true );
24+
$this->title( __( "Additional Image Sizes", "debugpress" ) );
2525
$this->list_array( $_wp_additional_image_sizes );
2626
}
2727

2828
public function right() {
2929
global $wp_rewrite;
3030

31-
$this->title( __( "Rewrite Rules", "debugpress" ), true );
31+
$this->title( __( "Rewrite Rules", "debugpress" ) );
3232

3333
if ( ! is_admin() ) {
3434
if ( ! empty( $wp_rewrite->rules ) ) {
3535
$this->list_array( $wp_rewrite->rules, '$' . 'wp_rewrite->rules' );
3636
} else {
3737
echo '<div class="debugpress-debug-notice-block">';
3838
$this->title( '<i class="debugpress-icon debugpress-icon-exclamation"></i> ' . __( "Rewrite Rules problem", "debugpress" ), true, true );
39-
$this->block_header( true );
39+
$this->block_header();
4040
_e( "Permalinks are disabled.", "debugpress" );
4141
$this->block_footer();
4242
echo '</div>';
4343
}
4444
} else {
45-
$this->block_header( true );
45+
$this->block_header();
4646
_e( "Rewrite rules are not loaded on the WordPress admin side.", "debugpress" );
4747
$this->block_footer();
4848
}

core/panel/DebugLog.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ public function left() {
2525
if ( empty( $path ) ) {
2626
echo '<div class="debugpress-debug-notice-block">';
2727
$this->title( '<i class="debugpress-icon debugpress-icon-exclamation"></i> ' . __( "Debug Log not available", "debugpress" ), true, true );
28-
$this->block_header( true );
28+
$this->block_header();
2929
_e( "WordPress Debug Log is not currently enabled.", "debugpress" );
3030
echo ' <a rel="noopener" href="https://debug.press/documentation/wordpress-setup/" target="_blank">' . __( "More Information", "debugpress" ) . '</a>';
3131
$this->block_footer();
3232
echo '</div>';
3333

3434
$this->_available = false;
3535
} else {
36-
$this->block_header( true );
36+
$this->block_header();
3737
$this->sub_title( __( "Debug Log Path", "debugpress" ) );
3838
echo $path;
3939

@@ -45,13 +45,13 @@ public function left() {
4545
$this->block_footer();
4646

4747
$this->title( __( "Settings", "debugpress" ), true, true );
48-
$this->block_header( true );
48+
$this->block_header();
4949
$this->sub_title( __( "Log lines to load", "debugpress" ) );
5050
echo $this->_limit === 0 ? __( "Complete debug log", "debugpress" ) : $this->_limit;
5151
$this->block_footer();
5252

5353
$this->title( __( "Actions", "debugpress" ), true, true );
54-
$this->block_header( true );
54+
$this->block_header();
5555
echo '<button class="debugpress-button-action debugpress-action-debuglog-load">' . __( "Load the debug log", "debugpress" ) . '</button>';
5656
$this->block_footer();
5757
}
@@ -63,13 +63,13 @@ public function right() {
6363
if ( $this->_available ) {
6464
echo '<div id="debugpress-debuglog-content"><div>' . __( "Use the controls on the left to load the content of the debug log.", "debugpress" ) . '</div></div>';
6565
} else {
66-
$this->block_header( true );
66+
$this->block_header();
6767
_e( "Debug log is not available.", "debugpress" );
6868
$this->block_footer();
6969
}
7070
}
7171

72-
public function load_from_debug_log() {
72+
public function load_from_debug_log() : array {
7373
$path = Info::debug_log_path();
7474

7575
if ( file_exists( $path ) && filesize( $path ) > 0 ) {

core/panel/Enqueue.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class Enqueue extends Panel {
1212
public function left() {
1313
global $wp_scripts;
1414

15-
$this->title( __( "Scripts in Header", "debugpress" ), true );
16-
$this->block_header( true );
15+
$this->title( __( "Scripts in Header", "debugpress" ) );
16+
$this->block_header();
1717
$this->table_init_standard();
1818
$this->table_head();
1919
foreach ( $wp_scripts->queue as $scr ) {
@@ -22,8 +22,8 @@ public function left() {
2222
$this->table_foot();
2323
$this->block_footer();
2424

25-
$this->title( __( "Scripts in Footer", "debugpress" ), true );
26-
$this->block_header( true );
25+
$this->title( __( "Scripts in Footer", "debugpress" ) );
26+
$this->block_header();
2727
$this->table_init_standard();
2828
$this->table_head();
2929
foreach ( $wp_scripts->in_footer as $scr ) {
@@ -36,8 +36,8 @@ public function left() {
3636
public function right() {
3737
global $wp_styles;
3838

39-
$this->title( __( "Styles in Header", "debugpress" ), true );
40-
$this->block_header( true );
39+
$this->title( __( "Styles in Header", "debugpress" ) );
40+
$this->block_header();
4141
$this->table_init_standard();
4242
$this->table_head();
4343
foreach ( $wp_styles->queue as $scr ) {

0 commit comments

Comments
 (0)