From b7f1f4880ab56382ef6f1c8f570f470e4f8b34d3 Mon Sep 17 00:00:00 2001 From: tea-eagle Date: Thu, 27 Jul 2023 14:06:49 +1000 Subject: [PATCH 1/3] Added a new panel for templates uploaded to the page --- css/debug-bar.css | 2 +- css/debug-bar.dev.css | 24 +++++ debug-bar.php | 5 +- panels/class-debug-bar-template-parts.php | 121 ++++++++++++++++++++++ readme.txt | 8 +- 5 files changed, 156 insertions(+), 4 deletions(-) create mode 100644 panels/class-debug-bar-template-parts.php diff --git a/css/debug-bar.css b/css/debug-bar.css index 939ba46..779eca8 100644 --- a/css/debug-bar.css +++ b/css/debug-bar.css @@ -1 +1 @@ -#wpadminbar #wp-admin-bar-debug-bar{float:right}#wpadminbar #wp-admin-bar-debug-bar.active{background:#555;background:-moz-linear-gradient(bottom,#555,#3e3e3e);background:-webkit-gradient(linear,left bottom,left top,from(#555),to(#3e3e3e))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:focus{background-color:#ff8922;background-image:-moz-linear-gradient(bottom,#ee6f00,#ff8922);background-image:-webkit-gradient(linear,left bottom,left top,from(#ee6f00),to(#ff8922))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:hover,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:focus{background-color:#ee6f00;background-image:-moz-linear-gradient(bottom,#ff8922,#ee6f00);background-image:-webkit-gradient(linear,left bottom,left top,from(#ff8922),to(#ee6f00))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item{color:#fff;text-shadow:0 -1px 0 #884000}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:focus{background-color:#f44;background-image:-moz-linear-gradient(bottom,#d00,#f44);background-image:-webkit-gradient(linear,left bottom,left top,from(#d00),to(#f44))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:hover,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:focus{background-color:#d00;background-image:-moz-linear-gradient(bottom,#f44,#d00);background-image:-webkit-gradient(linear,left bottom,left top,from(#f44),to(#d00))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item{color:#fff;text-shadow:0 -1px 0 #700}#wpadminbar #wp-admin-bar-debug-bar ul{right:0}#querylist,#querylist pre{text-align:left;font-size:12px}#querylist{direction:ltr;display:none;position:fixed;height:33%;min-height:350px;font-family:"Helvetica Neue",sans-serif;left:0;right:0;bottom:0;background:#f1f1f1;z-index:99000;color:#000;line-height:150%!important}#querylist a{border:0;text-decoration:underline!important;color:#00f!important}.debug-bar-maximized #debug-bar-actions span.restore,.debug-bar-visible #querylist{display:block}.debug-bar-maximized #querylist{position:fixed;top:28px;height:auto}body.debug-bar-maximized.debug-bar-visible{overflow:hidden}#debug-bar-info{height:60px;width:100%;position:absolute;z-index:200;background:#f1f1f1;border-bottom:1px solid #fff;box-shadow:0 0 6px rgba(0,0,0,.4);background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:-moz-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:-o-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#dfdfdf));background-image:-webkit-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:linear-gradient(top,#f9f9f9,#dfdfdf)}#debug-bar-menu,#debug-menu-targets{overflow:auto;position:absolute;top:61px;bottom:0}#debug-bar-menu{left:0;width:250px;z-index:100;text-shadow:0 1px 1px rgba(0,0,0,.9);background:#333;-webkit-box-shadow:inset -3px 0 6px rgba(0,0,0,.4);-moz-box-shadow:inset -3px 0 6px rgba(0,0,0,.4);box-shadow:inset -3px 0 6px rgba(0,0,0,.4)}#debug-menu-targets{left:250px;right:0;z-index:150}#debug-status{float:left;padding-left:20px;color:#bbb;font-size:14px;line-height:60px}.debug-status{float:left;margin-right:40px}#debug-status .debug-status-title{color:#555;font-weight:500;line-height:18px;font-size:12px;margin-top:10px}#debug-status .debug-status-data{color:#999;font-weight:200;line-height:20px;font-size:18px}#debug-status #debug-status-warning{font-weight:700;color:red}#debug-status #debug-status-site{font-weight:700}#querylist pre{padding:10px}#querylist .left{float:left}#querylist .right{float:right}#querylist h1,#querylist h2,#querylist h3{font-weight:400}#debug-menu-links{overflow:hidden;list-style:none;margin:0;padding:0}#debug-menu-links li{float:left;margin-bottom:0!important}#debug-menu-links li a{box-sizing:content-box;padding:0 20px;width:210px;line-height:32px;outline:0;display:block;margin:0;color:#fff!important;font-weight:500!important;font-size:14px}#debug-menu-links li a.current{background:rgba(0,0,0,.2)}#querylist h2{float:left;min-width:150px;border:1px solid #eee;padding:5px 10px 15px;clear:none;text-align:center;color:#000;font-family:georgia,times,serif;font-size:28px;margin:15px 10px 15px 0!important}#querylist h2 span{font-size:12px;color:#888;text-transform:uppercase;white-space:nowrap;display:block;margin-bottom:5px}#querylist h2 span#debug-bar-js-error-count{font-size:inherit;color:inherit;text-transform:inherit;white-space:inherit;display:inherit;margin-bottom:inherit}#object-cache-stats h2{border:0;float:left;text-align:left;font-size:22px;margin-bottom:0}#object-cache-stats ul.debug-menu-links,#object-cache-stats-menu-targets{clear:both}.object-cache-stats-menu-target pre{white-space:pre-wrap;margin:1rem 0}#object-cache-stats ul.debug-menu-links li{float:left;margin:0 10px 10px 0;background:0 0;border:1px solid #eee;color:#4b5259;list-style:none}#object-cache-stats ul.debug-menu-links li:hover{border-color:#ddd}#object-cache-stats ul.debug-menu-links li a{background:0 0;color:#4b5259;overflow:hidden;display:block;padding:5px 9px;text-decoration:none}#querylist h3{margin-bottom:15px}#debug-bar-deprecated ol.debug-bar-deprecated-list,#debug-bar-js ol.debug-bar-js-list,#debug-bar-php ol.debug-bar-php-list,#querylist ol.wpd-queries{padding:0!important;margin:0!important;list-style:none;clear:left}#querylist ol.wpd-queries li{padding:10px;background:#f0f0f0;margin:0 0 10px}#querylist ol.wpd-queries li div.qdebug{background:#e8e8e8;margin:10px -10px -10px;padding:5px 150px 5px 5px;font-size:11px;position:relative;min-height:20px}#querylist ol.wpd-queries li div.qdebug span{position:absolute;right:10px;top:5px;white-space:nowrap}#debug-menu-links li a,#querylist a:hover{text-decoration:none!important}#querylist .debug-menu-target{margin:20px;display:none}#querylist ol{font:12px Monaco,"Courier New",Courier,Fixed!important;line-height:180%!important}#querylist table{table-layout:auto}#querylist td,#querylist th{text-transform:none}#querylist table,#querylist table td,#querylist table th{border:0;vertical-align:top}#debug-bar-php ol.debug-bar-php-list li{padding:10px;margin:0 0 10px}#debug-bar-php .debug-bar-php-warning{background-color:#ffebe8;border:1px solid #c00}#debug-bar-php .debug-bar-php-notice{background-color:#ffffe0;border:1px solid #e6db55}#debug-bar-deprecated ol.debug-bar-deprecated-list li,#debug-bar-request p{padding:10px;margin:0 0 10px;background:#f0f0f0}#debug-bar-wp-query table.debug-bar-wp-query-list{width:100%;border-collapse:collapse;cell-padding:1em;clear:both}#debug-bar-wp-query table.debug-bar-wp-query-list td{padding:.5em 5px;border-bottom:1px solid #ccc}#debug-bar-wp-query table.debug-bar-wp-query-list th{padding:.5em 5px;font-weight:700;border-bottom:1px solid #ccc}#debug-bar-wp-query table.debug-bar-wp-query-list tr:nth-child(2n+1){background-color:#e8e8e8}#debug-bar-wp-query table.debug-bar-wp-query-list tr td:first-of-type{font-size:140%;padding:.3em .5em}#debug-bar-request h3,#debug-bar-wp-query h3{float:none;clear:both;font-family:georgia,times,serif;font-size:22px;margin:15px 10px 15px 0!important}#debug-bar-actions{position:absolute;top:21px;right:20px;z-index:300}#debug-bar-actions span{-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;display:block;float:left;height:19px;width:19px;margin-left:5px;font-size:18px;line-height:14px;text-align:center;font-weight:700;color:#eee;background:#aaa;cursor:pointer}#debug-bar-actions span:hover{background:#888}#debug-bar-actions span.restore{line-height:15px}#debug-menu-links li a#debug-menu-link-Debug_Bar_JS,#wp-admin-bar-debug-bar-Debug_Bar_JS,.debug-bar-maximized #debug-bar-actions span.maximize,.debug-bar-partial #debug-bar-actions span.restore{display:none}.debug-bar-partial #debug-bar-actions span.maximize{display:block}#debug-bar-js ol.debug-bar-js-list li{padding:10px;margin:0 0 10px}#debug-bar-js .debug-bar-js-error{background-color:#ffebe8;border:1px solid #c00}#debug-bar-js .debug-bar-js-error span{color:#666;font-size:.8em;display:block}#debug-bar-js .debug-bar-js-error:hover span{color:#000} \ No newline at end of file +#wpadminbar #wp-admin-bar-debug-bar{float:right}#wpadminbar #wp-admin-bar-debug-bar.active{background:#555;background:-moz-linear-gradient(bottom,#555,#3e3e3e);background:-webkit-gradient(linear,left bottom,left top,from(#555),to(#3e3e3e))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:focus{background-color:#ff8922;background-image:-moz-linear-gradient(bottom,#ee6f00,#ff8922);background-image:-webkit-gradient(linear,left bottom,left top,from(#ee6f00),to(#ff8922))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:hover,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:focus{background-color:#ee6f00;background-image:-moz-linear-gradient(bottom,#ff8922,#ee6f00);background-image:-webkit-gradient(linear,left bottom,left top,from(#ff8922),to(#ee6f00))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item{color:#fff;text-shadow:0 -1px 0 #884000}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:focus{background-color:#f44;background-image:-moz-linear-gradient(bottom,#d00,#f44);background-image:-webkit-gradient(linear,left bottom,left top,from(#d00),to(#f44))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:hover,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:focus{background-color:#d00;background-image:-moz-linear-gradient(bottom,#f44,#d00);background-image:-webkit-gradient(linear,left bottom,left top,from(#f44),to(#d00))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item{color:#fff;text-shadow:0 -1px 0 #700}#wpadminbar #wp-admin-bar-debug-bar ul{right:0}#querylist,#querylist pre{text-align:left;font-size:12px}#querylist{direction:ltr;display:none;position:fixed;height:33%;min-height:350px;font-family:"Helvetica Neue",sans-serif;left:0;right:0;bottom:0;background:#f1f1f1;z-index:99000;color:#000;line-height:150%!important}#querylist a{border:0;text-decoration:underline!important;color:#00f!important}.debug-bar-maximized #debug-bar-actions span.restore,.debug-bar-visible #querylist{display:block}.debug-bar-maximized #querylist{position:fixed;top:28px;height:auto}body.debug-bar-maximized.debug-bar-visible{overflow:hidden}#debug-bar-info{height:60px;width:100%;position:absolute;z-index:200;background:#f1f1f1;border-bottom:1px solid #fff;box-shadow:0 0 6px rgba(0,0,0,.4);background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:-moz-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:-o-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#dfdfdf));background-image:-webkit-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:linear-gradient(top,#f9f9f9,#dfdfdf)}#debug-bar-menu,#debug-menu-targets{overflow:auto;position:absolute;top:61px;bottom:0}#debug-bar-menu{left:0;width:250px;z-index:100;text-shadow:0 1px 1px rgba(0,0,0,.9);background:#333;-webkit-box-shadow:inset -3px 0 6px rgba(0,0,0,.4);-moz-box-shadow:inset -3px 0 6px rgba(0,0,0,.4);box-shadow:inset -3px 0 6px rgba(0,0,0,.4)}#debug-menu-targets{left:250px;right:0;z-index:150}#debug-status{float:left;padding-left:20px;color:#bbb;font-size:14px;line-height:60px}.debug-status{float:left;margin-right:40px}#debug-status .debug-status-title{color:#555;font-weight:500;line-height:18px;font-size:12px;margin-top:10px}#debug-status .debug-status-data{color:#999;font-weight:200;line-height:20px;font-size:18px}#debug-status #debug-status-warning{font-weight:700;color:red}#debug-status #debug-status-site{font-weight:700}#querylist pre{padding:10px}#querylist .left{float:left}#querylist .right{float:right}#querylist h1,#querylist h2,#querylist h3{font-weight:400}#debug-menu-links{overflow:hidden;list-style:none;margin:0;padding:0}#debug-menu-links li{float:left;margin-bottom:0!important}#debug-menu-links li a{box-sizing:content-box;padding:0 20px;width:210px;line-height:32px;outline:0;display:block;margin:0;color:#fff!important;font-weight:500!important;font-size:14px}#debug-menu-links li a.current{background:rgba(0,0,0,.2)}#querylist h2{float:left;min-width:150px;border:1px solid #eee;padding:5px 10px 15px;clear:none;text-align:center;color:#000;font-family:georgia,times,serif;font-size:28px;margin:15px 10px 15px 0!important}#querylist h2 span{font-size:12px;color:#888;text-transform:uppercase;white-space:nowrap;display:block;margin-bottom:5px}#querylist h2 span#debug-bar-js-error-count{font-size:inherit;color:inherit;text-transform:inherit;white-space:inherit;display:inherit;margin-bottom:inherit}#object-cache-stats h2{border:0;float:left;text-align:left;font-size:22px;margin-bottom:0}#object-cache-stats ul.debug-menu-links,#object-cache-stats-menu-targets{clear:both}.object-cache-stats-menu-target pre{white-space:pre-wrap;margin:1rem 0}#object-cache-stats ul.debug-menu-links li{float:left;margin:0 10px 10px 0;background:0 0;border:1px solid #eee;color:#4b5259;list-style:none}#object-cache-stats ul.debug-menu-links li:hover{border-color:#ddd}#object-cache-stats ul.debug-menu-links li a{background:0 0;color:#4b5259;overflow:hidden;display:block;padding:5px 9px;text-decoration:none}#querylist h3{margin-bottom:15px}#debug-bar-deprecated ol.debug-bar-deprecated-list,#debug-bar-js ol.debug-bar-js-list,#debug-bar-php ol.debug-bar-php-list,#querylist ol.wpd-queries{padding:0!important;margin:0!important;list-style:none;clear:left}#querylist ol.wpd-queries li{padding:10px;background:#f0f0f0;margin:0 0 10px}#querylist ol.wpd-queries li div.qdebug{background:#e8e8e8;margin:10px -10px -10px;padding:5px 150px 5px 5px;font-size:11px;position:relative;min-height:20px}#querylist ol.wpd-queries li div.qdebug span{position:absolute;right:10px;top:5px;white-space:nowrap}#debug-menu-links li a,#querylist a:hover{text-decoration:none!important}#querylist .debug-menu-target{margin:20px;display:none}#querylist ol{font:12px Monaco,"Courier New",Courier,Fixed!important;line-height:180%!important}#querylist table{table-layout:auto}#querylist td,#querylist th{text-transform:none}#querylist table,#querylist table td,#querylist table th{border:0;vertical-align:top}#debug-bar-php ol.debug-bar-php-list li{padding:10px;margin:0 0 10px}#debug-bar-php .debug-bar-php-warning{background-color:#ffebe8;border:1px solid #c00}#debug-bar-php .debug-bar-php-notice{background-color:#ffffe0;border:1px solid #e6db55}#debug-bar-deprecated ol.debug-bar-deprecated-list li,#debug-bar-request p{padding:10px;margin:0 0 10px;background:#f0f0f0}#debug-bar-wp-query table.debug-bar-wp-query-list{width:100%;border-collapse:collapse;cell-padding:1em;clear:both}#debug-bar-wp-query table.debug-bar-wp-query-list td{padding:.5em 5px;border-bottom:1px solid #ccc}#debug-bar-wp-query table.debug-bar-wp-query-list th{padding:.5em 5px;font-weight:700;border-bottom:1px solid #ccc}#debug-bar-wp-query table.debug-bar-wp-query-list tr:nth-child(2n+1){background-color:#e8e8e8}#debug-bar-wp-query table.debug-bar-wp-query-list tr td:first-of-type{font-size:140%;padding:.3em .5em}#debug-bar-request h3,#debug-bar-wp-query h3{float:none;clear:both;font-family:georgia,times,serif;font-size:22px;margin:15px 10px 15px 0!important}#debug-bar-actions{position:absolute;top:21px;right:20px;z-index:300}#debug-bar-actions span{-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;display:block;float:left;height:19px;width:19px;margin-left:5px;font-size:18px;line-height:14px;text-align:center;font-weight:700;color:#eee;background:#aaa;cursor:pointer}#debug-bar-actions span:hover{background:#888}#debug-bar-actions span.restore{line-height:15px}#debug-menu-links li a#debug-menu-link-Debug_Bar_JS,#wp-admin-bar-debug-bar-Debug_Bar_JS,.debug-bar-maximized #debug-bar-actions span.maximize,.debug-bar-partial #debug-bar-actions span.restore{display:none}.debug-bar-partial #debug-bar-actions span.maximize{display:block}#debug-bar-js ol.debug-bar-js-list li{padding:10px;margin:0 0 10px}#debug-bar-js .debug-bar-js-error{background-color:#ffebe8;border:1px solid #c00}#debug-bar-js .debug-bar-js-error span{color:#666;font-size:.8em;display:block}#debug-bar-js .debug-bar-js-error:hover span{color:#000}.debug-bar-template-parts h3{float:none;clear:both;font-family:georgia,times,serif;font-size:22px;margin:15px 10px 15px 0}.debug-bar-template-parts__row{padding:5px}.debug-bar-template-parts__group{position:relative;background:#e8e8e8;margin:10px 0;margin-left:25px;padding:5px} \ No newline at end of file diff --git a/css/debug-bar.dev.css b/css/debug-bar.dev.css index 6638e79..9e3d8ec 100644 --- a/css/debug-bar.dev.css +++ b/css/debug-bar.dev.css @@ -527,3 +527,27 @@ body.debug-bar-maximized.debug-bar-visible { #debug-bar-js .debug-bar-js-error:hover span { color: #000; } + +/* ========================================================================= + * Template Parts styling + * ========================================================================= */ + +.debug-bar-template-parts h3 { + float: none; + clear: both; + font-family: georgia,times,serif; + font-size: 22px; + margin: 15px 10px 15px 0; +} + +.debug-bar-template-parts__row { + padding: 5px; +} + +.debug-bar-template-parts__group { + position: relative; + background: #e8e8e8; + margin: 10px 0; + margin-left: 25px; + padding: 5px; +} diff --git a/debug-bar.php b/debug-bar.php index d0ae327..a3a7061 100644 --- a/debug-bar.php +++ b/debug-bar.php @@ -4,7 +4,7 @@ Plugin URI: https://wordpress.org/plugins/debug-bar/ Description: Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information. Author: wordpressdotorg - Version: 1.1.4 + Version: 1.2.0 Author URI: https://wordpress.org/ Text Domain: debug-bar */ @@ -117,7 +117,7 @@ function init_ajax() { function requirements() { $path = plugin_dir_path( __FILE__ ); - $recs = array( 'panel', 'php', 'queries', 'request', 'wp-query', 'object-cache', 'deprecated', 'js' ); + $recs = array( 'panel', 'php', 'queries', 'request', 'wp-query', 'object-cache', 'deprecated', 'js', 'template-parts' ); foreach ( $recs as $rec ) { require_once "$path/panels/class-debug-bar-$rec.php"; @@ -165,6 +165,7 @@ function init_panels() { 'Debug_Bar_Request', 'Debug_Bar_Object_Cache', 'Debug_Bar_JS', + 'Debug_Bar_Template_Parts', ); foreach ( $classes as $class ) { diff --git a/panels/class-debug-bar-template-parts.php b/panels/class-debug-bar-template-parts.php new file mode 100644 index 0000000..58239a4 --- /dev/null +++ b/panels/class-debug-bar-template-parts.php @@ -0,0 +1,121 @@ +title( __( 'Template Parts', 'debug-bar' ) ); + + add_action( 'wp_before_load_template', array( $this, 'action_template_part' ), 10, 3 ); + } + + function prerender() { + $this->set_visible( defined( 'SAVE_TEMPLATE_PARTS' ) && SAVE_TEMPLATE_PARTS ); + } + + function render() { + global $template_parts; + + echo '
'; + + echo '

' . __( 'Templates:', 'debug-bar' ) . '

'; + + if ( $template_parts ) { + echo '
'; + foreach ( $template_parts as $hash => $template_part) { + echo '
'; + $this->list_row($template_part, 0, 232); + echo '
'; + } + echo '
'; + } + + echo '
'; + } + + function list_row($template_part, $depth, $color) { + $params = ''; + if ( ! empty( $template_part['params'] ) ) { + $params = implode( ',', $template_part['params'] ); + $params = "
" . __( 'Params:', 'debug-bar' ) . " «{$params}»
"; + } + + echo "
{$template_part['template']}{$params}
"; + + if ($template_part['child']) { + $color -= Debug_Bar_Template_Parts::COLOR_STEP; + $depth++; + + echo '
'; + foreach ($template_part['child'] as $key => $template_part_child) { + echo "
"; + $this->list_row($template_part_child, $depth, $color); + echo '
'; + } + echo '
'; + } + } + + function action_template_part( $_template_file, $load_once, $args ) { + if ( defined( 'SAVE_TEMPLATE_PARTS' ) && SAVE_TEMPLATE_PARTS ) { + + $template = '/' . str_replace( ABSPATH, '', $_template_file ); + + if ( ! isset( $GLOBALS['template_parts'] ) ) { + $GLOBALS['template_parts'] = array(); + } + + $params = ''; + if ( ! empty( $args ) ) { + $params = array_keys( $args ); + } + + $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); + $trace_func = ''; + foreach ( $trace as $key => $line ) { + if ( in_array( $line['function'], array( 'include', 'require', 'require_once' ) ) ) { + $trace_func = '/' . str_replace( ABSPATH, '', $line['args'][0] ); + break; + } + } + + $hash = md5($template); + $parent_hash = md5($trace_func); + + $setValue = $this->set_value( $GLOBALS['template_parts'], $template, $parent_hash, $params ); + + if ( ! $setValue ) { + $GLOBALS['template_parts'][$hash] = array( + 'template' => $template, + 'params' => $params, + 'child' => array() + ); + } + } + } + + function set_value( & $array, $template, $parent_hash, $params ) { + $hash = md5($template); + $status = false; + + foreach ( $array as $key => & $value ) { + if ( $key == $parent_hash ) { + $value['child'][$hash] = [ + 'template' => $template, + 'params' => $params, + 'child' => array(), + ]; + $status = true; + } + if ( $value['child'] ) { + $result = $this->set_value( $value['child'], $template, $parent_hash, $params ); + if ( $result ) { + $status = $result; + } + } + } + + return $status; + } +} diff --git a/readme.txt b/readme.txt index 29bec5e..34fc574 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,5 @@ === Debug Bar === -Contributors: wordpressdotorg, ryan, westi, koopersmith, duck_, mitchoyoshitaka, dd32, jrf, obenland, nacin, evansolomon, Otto42, aidvu, josephscott +Contributors: wordpressdotorg, ryan, westi, koopersmith, duck_, mitchoyoshitaka, dd32, jrf, obenland, nacin, evansolomon, Otto42, aidvu, josephscott, teaeagle Tags: debug Tested up to: 6.1 Stable tag: 1.1.4 @@ -17,10 +17,13 @@ When `WP_DEBUG` is enabled it also tracks PHP Warnings and Notices to make them When `SAVEQUERIES` is enabled the mysql queries are tracked and displayed. +When `SAVE_TEMPLATE_PARTS` is enabled, it saves the templates used. + To enable these options, add the following code to your `wp-config.php` file: ` define( 'WP_DEBUG', true ); define( 'SAVEQUERIES', true ); +define( 'SAVE_TEMPLATE_PARTS', true ); ` Add a PHP/MySQL console with the [Debug Bar Console plugin](https://wordpress.org/plugins/debug-bar-console/). @@ -29,6 +32,9 @@ There are numerous other add-ons available to get more insight into, for instanc == Upgrade Notice == += 1.2.0 = +Added a new panel for templates uploaded to the page. + = 1.1.4 = - Fix PHP8+ critical error if `php_uname` is disabled From 0b0e2545f799667f31628d7d9dd46945b70b1483 Mon Sep 17 00:00:00 2001 From: tea-eagle Date: Thu, 27 Jul 2023 15:22:19 +1000 Subject: [PATCH 2/3] Added support for template tree output in Windows --- debug-bar.php | 2 +- panels/class-debug-bar-template-parts.php | 5 ++++- readme.txt | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/debug-bar.php b/debug-bar.php index a3a7061..1cf2c4c 100644 --- a/debug-bar.php +++ b/debug-bar.php @@ -4,7 +4,7 @@ Plugin URI: https://wordpress.org/plugins/debug-bar/ Description: Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information. Author: wordpressdotorg - Version: 1.2.0 + Version: 1.2.1 Author URI: https://wordpress.org/ Text Domain: debug-bar */ diff --git a/panels/class-debug-bar-template-parts.php b/panels/class-debug-bar-template-parts.php index 58239a4..49c8655 100644 --- a/panels/class-debug-bar-template-parts.php +++ b/panels/class-debug-bar-template-parts.php @@ -60,6 +60,8 @@ function list_row($template_part, $depth, $color) { function action_template_part( $_template_file, $load_once, $args ) { if ( defined( 'SAVE_TEMPLATE_PARTS' ) && SAVE_TEMPLATE_PARTS ) { + $abs_path = substr( ABSPATH, 0, -1 ); + $template = '/' . str_replace( ABSPATH, '', $_template_file ); if ( ! isset( $GLOBALS['template_parts'] ) ) { @@ -75,7 +77,8 @@ function action_template_part( $_template_file, $load_once, $args ) { $trace_func = ''; foreach ( $trace as $key => $line ) { if ( in_array( $line['function'], array( 'include', 'require', 'require_once' ) ) ) { - $trace_func = '/' . str_replace( ABSPATH, '', $line['args'][0] ); + $trace_func = str_replace( $abs_path, '', $line['args'][0] ); + $trace_func = str_replace( '\\', '/', $trace_func ); break; } } diff --git a/readme.txt b/readme.txt index 34fc574..b223944 100644 --- a/readme.txt +++ b/readme.txt @@ -32,6 +32,9 @@ There are numerous other add-ons available to get more insight into, for instanc == Upgrade Notice == += 1.2.1 = +- Added support for template tree output in Windows. + = 1.2.0 = Added a new panel for templates uploaded to the page. From f3e06d6fa41e19d7c355bf70ebd2b6aedb917d85 Mon Sep 17 00:00:00 2001 From: John James Jacoby Date: Wed, 10 Dec 2025 13:33:32 -0600 Subject: [PATCH 3/3] Minify CSS & JS. --- css/debug-bar.css | 2 +- js/debug-bar-js.js | 2 +- js/debug-bar.js | 2 +- js/ui-dockable.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/css/debug-bar.css b/css/debug-bar.css index b75538d..4b5b670 100644 --- a/css/debug-bar.css +++ b/css/debug-bar.css @@ -1 +1 @@ -#wpadminbar #wp-admin-bar-debug-bar{float:right}#wpadminbar #wp-admin-bar-debug-bar.active{background:#555;background:-moz-linear-gradient(bottom,#555,#3e3e3e);background:-webkit-gradient(linear,left bottom,left top,from(#555),to(#3e3e3e))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:focus{background-color:#ff8922;background-image:-moz-linear-gradient(bottom,#ee6f00,#ff8922);background-image:-webkit-gradient(linear,left bottom,left top,from(#ee6f00),to(#ff8922))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:hover,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:focus{background-color:#ee6f00;background-image:-moz-linear-gradient(bottom,#ff8922,#ee6f00);background-image:-webkit-gradient(linear,left bottom,left top,from(#ff8922),to(#ee6f00))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item{color:#fff;text-shadow:0 -1px 0 #884000}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:focus{background-color:#f44;background-image:-moz-linear-gradient(bottom,#d00,#f44);background-image:-webkit-gradient(linear,left bottom,left top,from(#d00),to(#f44))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:hover,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:focus{background-color:#d00;background-image:-moz-linear-gradient(bottom,#f44,#d00);background-image:-webkit-gradient(linear,left bottom,left top,from(#f44),to(#d00))}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item{color:#fff;text-shadow:0 -1px 0 #700}#wpadminbar #wp-admin-bar-debug-bar ul{right:0}#querylist,#querylist pre{text-align:left;font-size:12px}#querylist{direction:ltr;display:none;position:fixed;height:33%;min-height:350px;font-family:"Helvetica Neue",sans-serif;left:0;right:0;bottom:0;background:#f1f1f1;z-index:99000;color:#000;line-height:150%!important}#querylist a{border:0;text-decoration:underline!important;color:#00f!important}.debug-bar-maximized #debug-bar-actions span.restore,.debug-bar-visible #querylist{display:block}.debug-bar-maximized #querylist{position:fixed;top:28px;height:auto}body.debug-bar-maximized.debug-bar-visible{overflow:hidden}#debug-bar-info{height:60px;width:100%;position:absolute;z-index:200;background:#f1f1f1;border-bottom:1px solid #fff;box-shadow:0 0 6px rgba(0,0,0,.4);background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:-moz-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:-o-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#dfdfdf));background-image:-webkit-linear-gradient(top,#f9f9f9,#dfdfdf);background-image:linear-gradient(top,#f9f9f9,#dfdfdf)}#debug-bar-menu,#debug-menu-targets{overflow:auto;position:absolute;top:61px;bottom:0}#debug-bar-menu{left:0;width:250px;z-index:100;text-shadow:0 1px 1px rgba(0,0,0,.9);background:#333;-webkit-box-shadow:inset -3px 0 6px rgba(0,0,0,.4);-moz-box-shadow:inset -3px 0 6px rgba(0,0,0,.4);box-shadow:inset -3px 0 6px rgba(0,0,0,.4)}#debug-menu-targets{left:250px;right:0;z-index:150}#debug-status{float:left;padding-left:20px;color:#bbb;font-size:14px;line-height:60px}.debug-status{float:left;margin-right:40px}#debug-status .debug-status-title{color:#555;font-weight:500;line-height:18px;font-size:12px;margin-top:10px}#debug-status .debug-status-data{color:#999;font-weight:200;line-height:20px;font-size:18px}#debug-status #debug-status-warning{font-weight:700;color:red}#debug-status #debug-status-site{font-weight:700}#querylist pre{padding:10px}#querylist .left{float:left}#querylist .right{float:right}#querylist h1,#querylist h2,#querylist h3{font-weight:400}#debug-menu-links{overflow:hidden;list-style:none;margin:0;padding:0}#debug-menu-links li{float:left;margin-bottom:0!important}#debug-menu-links li a{box-sizing:content-box;padding:0 20px;width:210px;line-height:32px;outline:0;display:block;margin:0;color:#fff!important;font-weight:500!important;font-size:14px}#debug-menu-links li a.current{background:rgba(0,0,0,.2)}#querylist h2{float:left;min-width:150px;border:1px solid #eee;padding:5px 10px 15px;clear:none;text-align:center;color:#000;font-family:georgia,times,serif;font-size:28px;margin:15px 10px 15px 0!important}#querylist h2 span{font-size:12px;color:#888;text-transform:uppercase;white-space:nowrap;display:block;margin-bottom:5px}#querylist h2 span#debug-bar-js-error-count{font-size:inherit;color:inherit;text-transform:inherit;white-space:inherit;display:inherit;margin-bottom:inherit}#object-cache-stats h2{border:0;float:left;text-align:left;font-size:22px;margin-bottom:0}#object-cache-stats ul.debug-menu-links,#object-cache-stats-menu-targets{clear:both}.object-cache-stats-menu-target pre{white-space:pre-wrap;margin:1rem 0}#object-cache-stats ul.debug-menu-links li{float:left;margin:0 10px 10px 0;background:0 0;border:1px solid #eee;color:#4b5259;list-style:none}#object-cache-stats ul.debug-menu-links li:hover{border-color:#ddd}#object-cache-stats ul.debug-menu-links li a{background:0 0;color:#4b5259;overflow:hidden;display:block;padding:5px 9px;text-decoration:none}#querylist h3{margin-bottom:15px}#debug-bar-deprecated ol.debug-bar-deprecated-list,#debug-bar-js ol.debug-bar-js-list,#debug-bar-php ol.debug-bar-php-list,#querylist ol.wpd-queries{padding:0!important;margin:0!important;list-style:none;clear:left}#querylist ol.wpd-queries li{padding:10px;background:#f0f0f0;margin:0 0 10px}#querylist ol.wpd-queries li div.qdebug{background:#e8e8e8;margin:10px -10px -10px;padding:5px 150px 5px 5px;font-size:11px;position:relative;min-height:20px}#querylist ol.wpd-queries li div.qdebug span{position:absolute;right:10px;top:5px;white-space:nowrap}#debug-menu-links li a,#querylist a:hover{text-decoration:none!important}#querylist .debug-menu-target{margin:20px;display:none}#querylist ol{font:12px Monaco,"Courier New",Courier,Fixed!important;line-height:180%!important}#querylist table{table-layout:auto}#querylist td,#querylist th{text-transform:none}#querylist table,#querylist table td,#querylist table th{border:0;vertical-align:top}#debug-bar-php ol.debug-bar-php-list li{padding:10px;margin:0 0 10px}#debug-bar-php .debug-bar-php-warning{background-color:#ffebe8;border:1px solid #c00}#debug-bar-php .debug-bar-php-notice{background-color:#ffffe0;border:1px solid #e6db55}#debug-bar-deprecated ol.debug-bar-deprecated-list li,#debug-bar-request p{padding:10px;margin:0 0 10px;background:#f0f0f0}#debug-bar-wp-query table.debug-bar-wp-query-list{width:100%;border-collapse:collapse;cell-padding:1em;clear:both}#debug-bar-wp-query table.debug-bar-wp-query-list td{padding:.5em 5px;border-bottom:1px solid #ccc}#debug-bar-wp-query table.debug-bar-wp-query-list th{padding:.5em 5px;font-weight:700;border-bottom:1px solid #ccc}#debug-bar-wp-query table.debug-bar-wp-query-list tr:nth-child(2n+1){background-color:#e8e8e8}#debug-bar-wp-query table.debug-bar-wp-query-list tr td:first-of-type{font-size:140%;padding:.3em .5em}#debug-bar-request h3,#debug-bar-wp-query h3{float:none;clear:both;font-family:georgia,times,serif;font-size:22px;margin:15px 10px 15px 0!important}#debug-bar-actions{position:absolute;top:21px;right:20px;z-index:300}#debug-bar-actions span{-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;display:block;float:left;height:19px;width:19px;margin-left:5px;font-size:18px;line-height:14px;text-align:center;font-weight:700;color:#eee;background:#aaa;cursor:pointer}#debug-bar-actions span:hover{background:#888}#debug-bar-actions span.restore{line-height:15px}#debug-menu-links li a#debug-menu-link-Debug_Bar_JS,#wp-admin-bar-debug-bar-Debug_Bar_JS,.debug-bar-maximized #debug-bar-actions span.maximize,.debug-bar-partial #debug-bar-actions span.restore{display:none}.debug-bar-partial #debug-bar-actions span.maximize{display:block}#debug-bar-js ol.debug-bar-js-list li{padding:10px;margin:0 0 10px}#debug-bar-js .debug-bar-js-error{background-color:#ffebe8;border:1px solid #c00}#debug-bar-js .debug-bar-js-error span{color:#666;font-size:.8em;display:block}#debug-bar-js .debug-bar-js-error:hover span{color:#000}.debug-bar-template-parts h3{float:none;clear:both;font-family:georgia,times,serif;font-size:22px;margin:15px 10px 15px 0}.debug-bar-template-parts__row{padding:5px}.debug-bar-template-parts__group{position:relative;background:#e8e8e8;margin:10px 0;margin-left:25px;padding:5px} +#wpadminbar #wp-admin-bar-debug-bar{float:right}#wpadminbar #wp-admin-bar-debug-bar.active{background:#555}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:focus{background-color:#ff8922}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:hover,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item:focus{background-color:#ee6f00}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary .ab-item{color:#f0f0f1}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:focus,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:hover,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary,.debug-bar-visible #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item:focus{background-color:#d00}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary .ab-item{color:#f0f0f1}#wpadminbar #wp-admin-bar-debug-bar ul{right:0}#querylist,#querylist pre{text-align:left;font-size:12px}#querylist{direction:ltr;display:none;position:fixed;height:33%;min-height:350px;font-family:"Helvetica Neue",sans-serif;left:0;right:0;bottom:0;background:#f1f1f1;z-index:99000;color:#000;line-height:150%!important}#querylist a{border:0;text-decoration:underline!important;color:#00f!important;cursor:pointer}.debug-bar-visible #querylist{display:block}.debug-bar-maximized #querylist{position:fixed;top:28px;height:auto}body.debug-bar-maximized.debug-bar-visible{overflow:hidden}#debug-bar-info{height:60px;width:100%;position:absolute;z-index:200;background:#f1f1f1;border-bottom:1px solid #fff}#debug-bar-menu,#debug-menu-targets{overflow:auto;position:absolute;top:61px;bottom:0}#debug-bar-menu{left:0;width:250px;z-index:100;background:#333}#debug-menu-targets{left:250px;right:0;z-index:150}#debug-status{float:left;padding-left:20px;color:#bbb;font-size:14px;line-height:60px}.debug-status{float:left;margin-right:40px}#debug-status .debug-status-title{color:#555;font-weight:500;line-height:18px;font-size:12px;margin-top:10px}#debug-status .debug-status-data{color:#999;font-weight:200;line-height:20px;font-size:18px}#debug-status #debug-status-warning{font-weight:700;color:#d00}#debug-status #debug-status-site{font-weight:700}#querylist pre{padding:10px}#querylist .left{float:left}#querylist .right{float:right}#querylist h1,#querylist h2,#querylist h3{font-weight:400}#debug-menu-links{overflow:hidden;list-style:none;margin:0;padding:0}#debug-menu-links li{float:left;margin-bottom:0!important}#debug-menu-links li a{box-sizing:content-box;padding:0 20px;width:210px;line-height:32px;outline:0;display:block;margin:0;color:#fff!important;font-weight:500!important;font-size:14px}#debug-menu-links li a.current{background:rgba(0,0,0,.2)}#querylist h2{float:left;min-width:150px;border:1px solid #eee;padding:5px 10px 15px;clear:none;text-align:center;color:#000;font-family:georgia,times,serif;font-size:28px;margin:15px 10px 15px 0!important}#querylist h2 span{font-size:12px;color:#888;text-transform:uppercase;white-space:nowrap;display:block;margin-bottom:5px}#querylist h2 span#debug-bar-js-error-count{font-size:inherit;color:inherit;text-transform:inherit;white-space:inherit;display:inherit;margin-bottom:inherit}#object-cache-stats h2{border:0;float:left;text-align:left;font-size:22px;margin-bottom:0}#object-cache-stats ul.debug-menu-links,#object-cache-stats-menu-targets{clear:both}.object-cache-stats-menu-target pre{white-space:pre-wrap;margin:1rem 0}#object-cache-stats ul.debug-menu-links li{float:left;margin:0 10px 10px 0;background:0 0;border:1px solid #eee;color:#4b5259;list-style:none}#object-cache-stats ul.debug-menu-links li:hover{border-color:#ddd}#object-cache-stats ul.debug-menu-links li a{background:0 0;color:#4b5259;overflow:hidden;display:block;padding:5px 9px;text-decoration:none}#querylist h3{margin-bottom:15px}#debug-bar-deprecated ol.debug-bar-deprecated-list,#debug-bar-js ol.debug-bar-js-list,#debug-bar-php ol.debug-bar-php-list,#querylist ol.wpd-queries{padding:0!important;margin:0!important;list-style:none;clear:left}#querylist ol.wpd-queries li{padding:10px;background:#f0f0f0;margin:0 0 10px}#querylist ol.wpd-queries li div.qdebug{background:#e8e8e8;margin:10px -10px -10px;padding:5px 150px 5px 5px;font-size:11px;position:relative;min-height:20px}#querylist ol.wpd-queries li div.qdebug span{position:absolute;right:10px;top:5px;white-space:nowrap}#debug-menu-links li a,#querylist a:hover{text-decoration:none!important}#querylist .debug-menu-target{margin:20px;display:none}#querylist ol{font:12px Monaco,"Courier New",Courier,Fixed!important;line-height:180%!important}#querylist table{table-layout:auto}#querylist td,#querylist th{text-transform:none}#querylist table,#querylist table td,#querylist table th{border:0;vertical-align:top}#debug-bar-php ol.debug-bar-php-list li{padding:10px;margin:0 0 10px}#debug-bar-php .debug-bar-php-warning{background-color:#ffebe8;border:1px solid #d00}#debug-bar-php .debug-bar-php-notice{background-color:#ffffe0;border:1px solid #e6db55}#debug-bar-deprecated ol.debug-bar-deprecated-list li,#debug-bar-request p{padding:10px;margin:0 0 10px;background:#f0f0f0}#debug-bar-wp-query table.debug-bar-wp-query-list{width:100%;border-collapse:collapse;cell-padding:1em;clear:both}#debug-bar-wp-query table.debug-bar-wp-query-list td{padding:.5em 5px;border-bottom:1px solid #ccc}#debug-bar-wp-query table.debug-bar-wp-query-list th{padding:.5em 5px;font-weight:700;border-bottom:1px solid #ccc}#debug-bar-wp-query table.debug-bar-wp-query-list tr:nth-child(2n+1){background-color:#e8e8e8}#debug-bar-wp-query table.debug-bar-wp-query-list tr td:first-of-type{font-size:140%;padding:.3em .5em}#debug-bar-request h3,#debug-bar-wp-query h3{float:none;clear:both;font-family:georgia,times,serif;font-size:22px;margin:15px 10px 15px 0!important}#debug-bar-actions{position:absolute;top:21px;right:20px;z-index:300}#debug-bar-actions span{-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;display:block;float:left;height:20px;width:20px;line-height:20px;margin-left:5px;font-size:18px;text-align:center;font-weight:700;color:#eee;background:#aaa;cursor:pointer}#debug-bar-actions span.maximize,#debug-bar-actions span.restore{background-color:#9d9}#debug-bar-actions span.close{background-color:#d99}#debug-bar-actions span:hover{background:#888}#debug-bar-actions span.maximize:hover,#debug-bar-actions span.restore:hover{background:#40bf40}#debug-bar-actions span.close:hover{background:#bf4040}.debug-bar-maximized #debug-bar-actions span.restore{display:block}#debug-menu-links li a#debug-menu-link-Debug_Bar_JS,#wp-admin-bar-debug-bar-Debug_Bar_JS,.debug-bar-maximized #debug-bar-actions span.maximize,.debug-bar-partial #debug-bar-actions span.restore{display:none}.debug-bar-partial #debug-bar-actions span.maximize{display:block}#debug-bar-js ol.debug-bar-js-list li{padding:10px;margin:0 0 10px}#debug-bar-js .debug-bar-js-error{background-color:#ffebe8;border:1px solid #d00}#debug-bar-js .debug-bar-js-error span{color:#666;font-size:.8em;display:block}#debug-bar-js .debug-bar-js-error:hover span{color:#000}.debug-bar-template-parts h3{float:none;clear:both;font-family:georgia,times,serif;font-size:22px;margin:15px 10px 15px 0}.debug-bar-template-parts__row{padding:5px}.debug-bar-template-parts__group{position:relative;background:#e8e8e8;margin:10px 0 10px 25px;padding:5px} \ No newline at end of file diff --git a/js/debug-bar-js.js b/js/debug-bar-js.js index 5d03998..1707cd1 100644 --- a/js/debug-bar-js.js +++ b/js/debug-bar-js.js @@ -1 +1 @@ -!function(){var e,i,t,r=0,n=[];window.onerror=function(e,i,r){document.getElementById("debug-bar-js-error-count")?t(e,i,r):n[n.length]=[e,i,r]},jQuery(function(){for(err in n)t(n[err][0],n[err][1],n[err][2])}),t=function(t,n,a){var s,o,u,d;if(r++,e||(e=document.getElementById("debug-bar-js-error-count")),i||(i=document.getElementById("debug-bar-js-errors")),e&&i){if(1==r){if(u=document.getElementById("wp-admin-bar-debug-bar"),!u)return;-1===u.className.indexOf("debug-bar-php-warning-summary")&&(u.className=u.className+" debug-bar-php-warning-summary"),["debug-menu-link-Debug_Bar_JS","wp-admin-bar-debug-bar-Debug_Bar_JS"].map(function(e){d=document.getElementById(e),d&&(d.style.display="block")})}e.textContent=r,s=document.createElement("li"),s.className="debug-bar-js-error",s.textContent=t,o=document.createElement("span"),o.textContent=n+" line "+a,s.appendChild(o),i.appendChild(s)}}}(); \ No newline at end of file +!function(){var e,n,r,t=0,a=[];window.onerror=function(e,n,t){document.getElementById("debug-bar-js-error-count")?r(e,n,t):a[a.length]=[e,n,t]},jQuery(function(){for(err in a)r(a[err][0],a[err][1],a[err][2])}),r=function(r,a,d){var u,m,o,b;if(t++,e||(e=document.getElementById("debug-bar-js-error-count")),n||(n=document.getElementById("debug-bar-js-errors")),e&&n){if(1==t){if(!(o=document.getElementById("wp-admin-bar-debug-bar")))return;-1===o.className.indexOf("debug-bar-php-warning-summary")&&(o.className=o.className+" debug-bar-php-warning-summary"),["debug-menu-link-Debug_Bar_JS","wp-admin-bar-debug-bar-Debug_Bar_JS"].map(function(e){(b=document.getElementById(e))&&(b.style.display="block")})}e.textContent=t,(u=document.createElement("li")).className="debug-bar-js-error",u.textContent=r,(m=document.createElement("span")).textContent=a+" line "+d,u.appendChild(m),n.appendChild(u)}}}(); \ No newline at end of file diff --git a/js/debug-bar.js b/js/debug-bar.js index 0ce3693..76a67c7 100644 --- a/js/debug-bar.js +++ b/js/debug-bar.js @@ -1 +1 @@ -var wpDebugBar;!function(e){var i;wpDebugBar=i={body:void 0,init:function(){i.body=e(document.body),i.toggle.init(),i.tabs(),i.actions.init()},isVisible:function(){return i.body.hasClass("debug-bar-visible")},toggle:{init:function(){e("#wp-admin-bar-debug-bar").click(function(t){if(t.preventDefault(),t.target.hash){var s=e(t.target.rel);if(i.isVisible()){if(s.hasClass("current"))return s.removeClass("current"),void i.toggle.visibility()}else i.toggle.visibility();e(".debug-menu-target").hide().trigger("debug-bar-hide"),e(".debug-menu-link").removeClass("current"),s.addClass("current"),e(t.target.hash).show().trigger("debug-bar-show")}else i.toggle.visibility()})},visibility:function(t){t=void 0===t?!i.isVisible():t,i.body.toggleClass("debug-bar-visible",t),e(this).toggleClass("active",t)}},tabs:function(){var i=e(".debug-menu-link"),t=e(".debug-menu-target");i.click(function(s){var r=e(this);s.preventDefault(),r.hasClass("current")||(t.hide().trigger("debug-bar-hide"),i.removeClass("current"),r.addClass("current"),e("#"+this.href.substr(this.href.indexOf("#")+1)).show().trigger("debug-bar-show"))})},actions:{init:function(){var t=e("#debug-bar-actions");e(document).keydown(function(e){var t=e.key||e.which||e.keyCode;27===t&&i.isVisible()&&(e.preventDefault(),i.actions.close())}),e(".maximize",t).click(i.actions.maximize),e(".restore",t).click(i.actions.restore),e(".close",t).click(i.actions.close)},maximize:function(){i.body.removeClass("debug-bar-partial"),i.body.addClass("debug-bar-maximized")},restore:function(){i.body.removeClass("debug-bar-maximized"),i.body.addClass("debug-bar-partial")},close:function(){i.toggle.visibility(!1)}}},e(wpDebugBar.init)}(jQuery); \ No newline at end of file +var wpDebugBar;!function(e){var i;wpDebugBar=i={body:void 0,init:function(){i.body=e(document.body),i.toggle.init(),i.tabs(),i.actions.init()},isVisible:function(){return i.body.hasClass("debug-bar-visible")},toggle:{init:function(){e("#wp-admin-bar-debug-bar").on("click",function(t){if(t.preventDefault(),t.target.hash){var s=e(t.target.rel);if(i.isVisible()){if(s.hasClass("current"))return s.removeClass("current"),void i.toggle.visibility()}else i.toggle.visibility();e(".debug-menu-target").hide().trigger("debug-bar-hide"),e(".debug-menu-link").removeClass("current"),s.addClass("current"),e(t.target.hash).show().trigger("debug-bar-show")}else i.toggle.visibility()})},visibility:function(t){t=void 0===t?!i.isVisible():t,i.body.toggleClass("debug-bar-visible",t),e(this).toggleClass("active",t)}},tabs:function(){var i=e(".debug-menu-link"),t=e(".debug-menu-target");i.on("click",function(s){var a=e(this);s.preventDefault(),a.hasClass("current")||(t.hide().trigger("debug-bar-hide"),i.removeClass("current"),a.addClass("current"),e("#"+this.href.substr(this.href.indexOf("#")+1)).show().trigger("debug-bar-show"))})},actions:{init:function(){var t=e("#debug-bar-actions");e(document).on("keydown",function(e){var t=e.key||e.which||e.keyCode;27!==t&&"Escape"!==t||!i.isVisible()||(e.preventDefault(),i.actions.close())}),e(".maximize",t).on("click",i.actions.maximize),e(".restore",t).on("click",i.actions.restore),e(".close",t).on("click",i.actions.close)},maximize:function(){i.body.removeClass("debug-bar-partial"),i.body.addClass("debug-bar-maximized")},restore:function(){i.body.removeClass("debug-bar-maximized"),i.body.addClass("debug-bar-partial")},close:function(){i.toggle.visibility(!1)}}},e(wpDebugBar.init)}(jQuery); \ No newline at end of file diff --git a/js/ui-dockable.js b/js/ui-dockable.js index 288e04d..fa6faa5 100644 --- a/js/ui-dockable.js +++ b/js/ui-dockable.js @@ -1 +1 @@ -(function(a){a.widget("db.dockable",a.ui.mouse,{options:{handle:false,axis:"y",resize:function(){},resized:function(){}},_create:function(){if(this.options.axis=="x"){this.page="pageX";this.dimension="width"}else{this.page="pageY";this.dimension="height"}if(!this.options.handle){return}this.handle=a(this.options.handle);this._mouseInit()},_handoff:function(){return{element:this.element,handle:this.handle,axis:this.options.axis}},_mouseStart:function(b){this._trigger("start",b,this._handoff());this.d0=this.element[this.dimension]()+b[this.page]},_mouseDrag:function(c){var b=this._trigger("resize",c,this._handoff());if(b===false){return}this.element[this.dimension](this.d0-c[this.page]);this._trigger("resized",c,this._handoff())},_mouseCapture:function(b){return !this.options.disabled&&b.target==this.handle[0]},_mouseStop:function(b){this._trigger("stop",b,this._handoff())}})})(jQuery); \ No newline at end of file +!function(i){i.widget("db.dockable",i.ui.mouse,{options:{handle:!1,axis:"y",resize:function(){},resized:function(){}},_create:function(){"x"==this.options.axis?(this.page="pageX",this.dimension="width"):(this.page="pageY",this.dimension="height"),this.options.handle&&(this.handle=i(this.options.handle),this._mouseInit())},_handoff:function(){return{element:this.element,handle:this.handle,axis:this.options.axis}},_mouseStart:function(i){this._trigger("start",i,this._handoff()),this.d0=this.element[this.dimension]()+i[this.page]},_mouseDrag:function(i){!1!==this._trigger("resize",i,this._handoff())&&(this.element[this.dimension](this.d0-i[this.page]),this._trigger("resized",i,this._handoff()))},_mouseCapture:function(i){return!this.options.disabled&&i.target==this.handle[0]},_mouseStop:function(i){this._trigger("stop",i,this._handoff())}})}(jQuery); \ No newline at end of file