Skip to content

Commit

Permalink
Work in progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
dev4press committed Dec 30, 2022
1 parent 0ee43ba commit ff5b70f
Show file tree
Hide file tree
Showing 131 changed files with 2,401 additions and 1,299 deletions.
4 changes: 2 additions & 2 deletions core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function debugpress_rs( $value, bool $echo = true ) : string {

if ( $echo ) {
echo $result;
} else {
return $result;
}

return $result;
}
21 changes: 15 additions & 6 deletions core/main/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ public function table_row( $data ) {
echo '</tr>';
}

public function list_defines( $defines, $subtitle = '' ) {
$this->block_header();
public function list_defines( $defines, $subtitle = '', $block = true, $open = true ) {
if ( $block ) {
$this->block_header( $open );
}

if ( $subtitle != '' ) {
$this->sub_title( $subtitle );
Expand All @@ -140,11 +142,16 @@ public function list_defines( $defines, $subtitle = '' ) {
$this->table_row( array( $const, $val ) );
}
$this->table_foot();
$this->block_footer();

if ( $block ) {
$this->block_footer();
}
}

public function list_array( $data, $subtitle = '' ) {
$this->block_header();
public function list_array( $data, $subtitle = '', $block = true, $open = true ) {
if ( $block ) {
$this->block_header( $open );
}

if ( $subtitle != '' ) {
$this->sub_title( $subtitle );
Expand All @@ -160,7 +167,9 @@ public function list_array( $data, $subtitle = '' ) {
$this->table_foot();
}

$this->block_footer();
if ( $block ) {
$this->block_footer();
}
}

public function list_properties( $object, $properties = array(), $subtitle = '' ) {
Expand Down
12 changes: 6 additions & 6 deletions core/main/WP.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public function current_url( $use_wp = true ) : string {
}

public function current_url_request() : string {
$pathinfo = $_SERVER['PATH_INFO'] ?? '';
list( $pathinfo ) = explode( '?', $pathinfo );
$pathinfo = str_replace( '%', '%25', $pathinfo );
$path_info = $_SERVER['PATH_INFO'] ?? '';
list( $path_info ) = explode( '?', $path_info );
$path_info = str_replace( '%', '%25', $path_info );

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

$req_uri = str_replace( $pathinfo, '', $req_uri );
$req_uri = trim( $req_uri, '/' );
$req_uri = str_replace( $path_info, '', $req_uri );
$req_uri = ltrim( $req_uri, '/' );
$req_uri = preg_replace( $home_path_regex, '', $req_uri );
$req_uri = trim( $req_uri, '/' );
$req_uri = ltrim( $req_uri, '/' );

$url_request = $req_uri;

Expand Down
4 changes: 4 additions & 0 deletions core/main/Wrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
}

class Wrap {
public $name;
public $class;
public $style;

function __construct( $args = array() ) {
if ( is_array( $args ) && ! empty( $args ) ) {
$this->from_array( $args );
Expand Down
20 changes: 10 additions & 10 deletions core/panel/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@

class Admin extends Panel {
public function left() {
$this->title( __( "Page Information", "debugpress" ), true );
$this->block_header( true );
$this->title( __( "Page Information", "debugpress" ) );
$this->block_header();
$this->table_init_standard();
$this->table_head();
$this->table_row( array( "&#36;pagenow", isset( $GLOBALS['pagenow'] ) ? $GLOBALS['pagenow'] : '' ) );
$this->table_row( array( "&#36;typenow", isset( $GLOBALS['typenow'] ) ? $GLOBALS['typenow'] : '' ) );
$this->table_row( array( "&#36;taxnow", isset( $GLOBALS['taxnow'] ) ? $GLOBALS['taxnow'] : '' ) );
$this->table_row( array( "&#36;pagenow", $GLOBALS['pagenow'] ?? '' ) );
$this->table_row( array( "&#36;typenow", $GLOBALS['typenow'] ?? '' ) );
$this->table_row( array( "&#36;taxnow", $GLOBALS['taxnow'] ?? '' ) );
$this->table_row( array(
"&#36;hook_suffix",
isset( $GLOBALS['hook_suffix'] ) ? $GLOBALS['hook_suffix'] : ''
$GLOBALS['hook_suffix'] ?? ''
) );
$this->table_foot();
$this->block_footer();

$screen = get_current_screen();

if ( ! is_null( $screen ) ) {
$this->title( __( "Current Screen", "debugpress" ), true );
$this->block_header( true );
$this->title( __( "Current Screen", "debugpress" ) );
$this->block_header();
$this->table_init_standard();
$this->table_head();
$this->table_row( array( __( "Base", "debugpress" ), $screen->base ) );
Expand All @@ -43,8 +43,8 @@ public function left() {
}

public function right() {
$this->title( __( "Conditionals", "debugpress" ), true );
$this->block_header( true );
$this->title( __( "Conditionals", "debugpress" ) );
$this->block_header();
$this->table_init_standard();
$this->table_head();
$this->table_row( array(
Expand Down
26 changes: 13 additions & 13 deletions core/panel/Basics.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function left() {
echo '<div class="debugpress-debug-notice-block">';

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

$this->title( __( "Page Loading Stats", "debugpress" ), true );
$this->block_header( true );
$this->title( __( "Page Loading Stats", "debugpress" ) );
$this->block_header();
$this->table_init_standard();
$this->table_head();
$this->table_row( array(
Expand Down Expand Up @@ -76,8 +76,8 @@ public function left() {
$this->table_foot();
$this->block_footer();

$this->title( __( "Current PHP Limits", "debugpress" ), true );
$this->block_header( true );
$this->title( __( "Current PHP Limits", "debugpress" ) );
$this->block_header();
$this->table_init_standard();
$this->table_head();
$this->table_row( array( __( "PHP Memory Available", "debugpress" ), ini_get( 'memory_limit' ) . "B" ) );
Expand All @@ -88,13 +88,13 @@ public function left() {
$this->table_foot();
$this->block_footer();

$this->title( __( "Upload Directory", "debugpress" ), true );
$this->title( __( "Upload Directory", "debugpress" ) );
$this->list_array( wp_upload_dir() );
}

public function right() {
$this->title( Info::cms_name(), true );
$this->block_header( true );
$this->title( Info::cms_name() );
$this->block_header();
$this->table_init_standard();
$this->table_head();
$this->table_row( array( __( "Version", "debugpress" ), Info::cms_version() ) );
Expand All @@ -105,11 +105,11 @@ public function right() {
$this->table_foot();
$this->block_footer();

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

$this->title( __( "Load Snapshots", "debugpress" ), true );
$this->block_header( true );
$this->title( __( "Load Snapshots", "debugpress" ) );
$this->block_header();
$this->add_column( __( "Name", "debugpress" ), "", "", true );
$this->add_column( __( "Memory", "debugpress" ), "", "text-align: right;" );
$this->add_column( __( "Timer", "debugpress" ), "", "text-align: right;" );
Expand All @@ -129,11 +129,11 @@ public function right() {
$this->block_footer();
}

private function _env() {
private function _env() : array {
return debugpress_plugin()->environment();
}

private function _test() {
private function _test() : array {
$test = array();

if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {
Expand Down
20 changes: 10 additions & 10 deletions core/panel/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,36 +130,36 @@ class Constants extends Panel {
);

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

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

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

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

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

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

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

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

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

$this->title( __( "Back Compatibility", "debugpress" ), true );
$this->title( __( "Back Compatibility", "debugpress" ) );
$this->list_defines( $this->constants['bck'] );
}
}
14 changes: 7 additions & 7 deletions core/panel/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ class Content extends Panel {
public function left() {
global $wp_taxonomies, $wp_post_types, $wp_post_statuses, $_wp_additional_image_sizes;

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

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

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

$this->title( __( "Additional Image Sizes", "debugpress" ), true );
$this->title( __( "Additional Image Sizes", "debugpress" ) );
$this->list_array( $_wp_additional_image_sizes );
}

public function right() {
global $wp_rewrite;

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

if ( ! is_admin() ) {
if ( ! empty( $wp_rewrite->rules ) ) {
$this->list_array( $wp_rewrite->rules, '$' . 'wp_rewrite->rules' );
} else {
echo '<div class="debugpress-debug-notice-block">';
$this->title( '<i class="debugpress-icon debugpress-icon-exclamation"></i> ' . __( "Rewrite Rules problem", "debugpress" ), true, true );
$this->block_header( true );
$this->block_header();
_e( "Permalinks are disabled.", "debugpress" );
$this->block_footer();
echo '</div>';
}
} else {
$this->block_header( true );
$this->block_header();
_e( "Rewrite rules are not loaded on the WordPress admin side.", "debugpress" );
$this->block_footer();
}
Expand Down
12 changes: 6 additions & 6 deletions core/panel/DebugLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public function left() {
if ( empty( $path ) ) {
echo '<div class="debugpress-debug-notice-block">';
$this->title( '<i class="debugpress-icon debugpress-icon-exclamation"></i> ' . __( "Debug Log not available", "debugpress" ), true, true );
$this->block_header( true );
$this->block_header();
_e( "WordPress Debug Log is not currently enabled.", "debugpress" );
echo ' <a rel="noopener" href="https://debug.press/documentation/wordpress-setup/" target="_blank">' . __( "More Information", "debugpress" ) . '</a>';
$this->block_footer();
echo '</div>';

$this->_available = false;
} else {
$this->block_header( true );
$this->block_header();
$this->sub_title( __( "Debug Log Path", "debugpress" ) );
echo $path;

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

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

$this->title( __( "Actions", "debugpress" ), true, true );
$this->block_header( true );
$this->block_header();
echo '<button class="debugpress-button-action debugpress-action-debuglog-load">' . __( "Load the debug log", "debugpress" ) . '</button>';
$this->block_footer();
}
Expand All @@ -63,13 +63,13 @@ public function right() {
if ( $this->_available ) {
echo '<div id="debugpress-debuglog-content"><div>' . __( "Use the controls on the left to load the content of the debug log.", "debugpress" ) . '</div></div>';
} else {
$this->block_header( true );
$this->block_header();
_e( "Debug log is not available.", "debugpress" );
$this->block_footer();
}
}

public function load_from_debug_log() {
public function load_from_debug_log() : array {
$path = Info::debug_log_path();

if ( file_exists( $path ) && filesize( $path ) > 0 ) {
Expand Down
12 changes: 6 additions & 6 deletions core/panel/Enqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class Enqueue extends Panel {
public function left() {
global $wp_scripts;

$this->title( __( "Scripts in Header", "debugpress" ), true );
$this->block_header( true );
$this->title( __( "Scripts in Header", "debugpress" ) );
$this->block_header();
$this->table_init_standard();
$this->table_head();
foreach ( $wp_scripts->queue as $scr ) {
Expand All @@ -22,8 +22,8 @@ public function left() {
$this->table_foot();
$this->block_footer();

$this->title( __( "Scripts in Footer", "debugpress" ), true );
$this->block_header( true );
$this->title( __( "Scripts in Footer", "debugpress" ) );
$this->block_header();
$this->table_init_standard();
$this->table_head();
foreach ( $wp_scripts->in_footer as $scr ) {
Expand All @@ -36,8 +36,8 @@ public function left() {
public function right() {
global $wp_styles;

$this->title( __( "Styles in Header", "debugpress" ), true );
$this->block_header( true );
$this->title( __( "Styles in Header", "debugpress" ) );
$this->block_header();
$this->table_init_standard();
$this->table_head();
foreach ( $wp_styles->queue as $scr ) {
Expand Down
Loading

0 comments on commit ff5b70f

Please sign in to comment.