first commit

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-08 12:19:53 -04:00
commit 7c8c8b1c76
4586 changed files with 2050693 additions and 0 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,492 @@
/* =========================================================================
* Admin bar styling
* ========================================================================= */
#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;
}
/**
* Debug bar styling
*/
#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;
text-align: left;
font-size: 12px;
}
/* reset debug bar links */
#querylist a {
border: 0;
}
.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, 0.4 );
background-color: #f1f1f1; /* Fallback */
background-image: -ms-linear-gradient(top, #f9f9f9, #dfdfdf); /* IE10 */
background-image: -moz-linear-gradient(top, #f9f9f9, #dfdfdf); /* Firefox */
background-image: -o-linear-gradient(top, #f9f9f9, #dfdfdf); /* Opera */
background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#dfdfdf)); /* old Webkit */
background-image: -webkit-linear-gradient(top, #f9f9f9, #dfdfdf); /* new Webkit */
background-image: linear-gradient(top, #f9f9f9, #dfdfdf); /* proposed W3C Markup */
}
#debug-bar-menu {
position: absolute;
top: 61px;
left: 0;
width: 250px;
bottom: 0;
z-index: 100;
overflow: auto;
text-shadow: 0 1px 1px rgba( 0, 0, 0, 0.9 );
background: #333;
-webkit-box-shadow: inset -3px 0 6px rgba( 0, 0, 0, 0.4 );
-moz-box-shadow: inset -3px 0 6px rgba( 0, 0, 0, 0.4 );
box-shadow: inset -3px 0 6px rgba( 0, 0, 0, 0.4 );
}
#debug-menu-targets {
overflow: auto;
position: absolute;
top: 61px;
left: 250px;
right: 0;
bottom: 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: bold;
color: red;
}
#debug-status #debug-status-site {
font-weight: bold;
}
#querylist pre {
font-size: 12px;
padding: 10px;
}
#querylist .left {
float: left;
}
#querylist .right {
float: right;
}
#querylist h1, #querylist h2, #querylist h3 {
font-weight: normal;
}
#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: none;
display: block;
margin: 0;
color: #fff !important;
text-decoration: none !important;
font-weight: 500 !important;
font-size: 14px;
}
#debug-menu-links li a.current {
background: rgba( 0, 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: none;
float: none;
text-align: left;
font-size: 22px;
margin-bottom: 0;
}
#querylist h3 {
margin-bottom: 15px;
}
#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 0;
}
#querylist ol.wpd-queries li div.qdebug {
background: #e8e8e8;
margin: 10px -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;
}
#querylist a {
text-decoration: underline !important;
color: blue !important;
}
#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 th,
#querylist table td {
border: 0px none;
vertical-align: top;
}
#debug-bar-php ol.debug-bar-php-list {
padding: 0 !important;
margin: 0 !important;
list-style: none;
clear: left;
}
#debug-bar-php ol.debug-bar-php-list li {
padding: 10px;
margin: 0 0 10px 0;
}
#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 {
padding: 0 !important;
margin: 0 !important;
list-style: none;
clear: left;
}
#debug-bar-deprecated ol.debug-bar-deprecated-list li {
padding: 10px;
margin: 0 0 10px 0;
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: 0.5em 5px;
border-bottom: 1px solid #ccc;
}
#debug-bar-wp-query table.debug-bar-wp-query-list th {
padding: 0.5em 5px;
font-weight: bold;
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: 0.3em 0.5em;
}
#debug-bar-wp-query h3, #debug-bar-request h3 {
float: none;
clear: both;
font-family: georgia, times, serif;
font-size: 22px;
margin: 15px 10px 15px 0 !important;
}
#debug-bar-request p {
padding: 10px;
margin: 0 0 10px 0;
background: #f0f0f0;
}
/* =========================================================================
* Actions: Maximize / restore
* ========================================================================= */
#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: bold;
color: #eee;
background: #aaa;
cursor: pointer;
}
#debug-bar-actions span:hover {
background: #888;
}
#debug-bar-actions span.restore {
line-height: 15px;
}
.debug-bar-maximized #debug-bar-actions span.restore {
display: block;
}
.debug-bar-maximized #debug-bar-actions span.maximize {
display: none;
}
.debug-bar-partial #debug-bar-actions span.restore {
display: none;
}
.debug-bar-partial #debug-bar-actions span.maximize {
display: block;
}
/* =========================================================================
* JS Error item styling
* ========================================================================= */
#debug-menu-links li a#debug-menu-link-Debug_Bar_JS,
#wp-admin-bar-debug-bar-Debug_Bar_JS {
display: none;
}
#debug-bar-js ol.debug-bar-js-list {
padding: 0 !important;
margin: 0 !important;
list-style: none;
clear: left;
}
#debug-bar-js ol.debug-bar-js-list li {
padding: 10px;
margin: 0 0 10px 0;
}
#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: 0.8em;
display: block;
}
#debug-bar-js .debug-bar-js-error:hover span {
color: #000;
}
+326
View File
@@ -0,0 +1,326 @@
<?php
/*
Plugin Name: Debug Bar
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.0
Author URI: https://wordpress.org/
Text Domain: debug-bar
*/
/***
* Debug Functions
*
* When logged in as a super admin, these functions will run to provide
* debugging information when specific super admin menu items are selected.
*
* They are not used when a regular user is logged in.
*/
class Debug_Bar {
public $panels = array();
function __construct() {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
add_action( 'admin_init', array( $this, 'init_ajax' ) );
}
add_action( 'admin_bar_init', array( $this, 'init' ) );
}
function Debug_Bar() {
_deprecated_constructor( __METHOD__, '0.8.3', __CLASS__ );
self::__construct();
}
function init() {
if ( ! $this->enable_debug_bar() ) {
return;
}
load_plugin_textdomain( 'debug-bar' );
add_action( 'wp_before_admin_bar_render', array( $this, 'wp_before_admin_bar_render' ), 1000000 );
add_action( 'admin_footer', array( $this, 'render' ), 1000 );
add_action( 'wp_footer', array( $this, 'render' ), 1000 );
add_action( 'wp_head', array( $this, 'ensure_ajaxurl' ), 1 );
add_filter( 'body_class', array( $this, 'body_class' ) );
add_filter( 'admin_body_class', array( $this, 'body_class' ) );
$this->requirements();
$this->enqueue();
$this->init_panels();
}
/**
* Are we on the wp-login.php page?
*
* We can get here while logged in and break the page as the admin bar
* is not shown and other things the js relies on are not available.
*
* @return bool
*/
function is_wp_login() {
return 'wp-login.php' == basename( $_SERVER['SCRIPT_NAME'] );
}
/**
* Should the debug bar functionality be enabled?
*
* @since 0.9
*
* @param bool $ajax Whether this is an ajax call or not. Defaults to false.
* @return bool
*/
function enable_debug_bar( $ajax = false ) {
$enable = false;
if ( $ajax && is_super_admin() ) {
$enable = true;
} elseif ( ! $ajax && ( is_super_admin() && is_admin_bar_showing() && ! $this->is_wp_login() ) ) {
$enable = true;
}
/**
* Allows for overruling of whether the debug bar functionality will be enabled.
*
* @since 0.9
*
* @param bool $enable Whether the debug bar will be enabled or not.
*/
return apply_filters( 'debug_bar_enable', $enable );
}
function init_ajax() {
if ( ! $this->enable_debug_bar( true ) ) {
return;
}
$this->requirements();
$this->init_panels();
}
function requirements() {
$path = plugin_dir_path( __FILE__ );
$recs = array( 'panel', 'php', 'queries', 'request', 'wp-query', 'object-cache', 'deprecated', 'js' );
foreach ( $recs as $rec ) {
require_once "$path/panels/class-debug-bar-$rec.php";
}
}
function enqueue() {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.dev' : '';
wp_enqueue_style( 'debug-bar', plugins_url( "css/debug-bar$suffix.css", __FILE__ ), array(), '20170515' );
wp_enqueue_script( 'debug-bar', plugins_url( "js/debug-bar$suffix.js", __FILE__ ), array( 'jquery' ), '20170515', true );
do_action( 'debug_bar_enqueue_scripts' );
}
function init_panels() {
$classes = array(
'Debug_Bar_PHP',
'Debug_Bar_Queries',
'Debug_Bar_WP_Query',
'Debug_Bar_Deprecated',
'Debug_Bar_Request',
'Debug_Bar_Object_Cache',
'Debug_Bar_JS',
);
foreach ( $classes as $class ) {
$this->panels[] = new $class;
}
$this->panels = apply_filters( 'debug_bar_panels', $this->panels );
}
function ensure_ajaxurl() { ?>
<script type="text/javascript">
//<![CDATA[
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
//]]>
</script>
<?php
}
// memory_get_peak_usage is PHP >= 5.2.0 only
function safe_memory_get_peak_usage() {
return function_exists( 'memory_get_peak_usage' ) ? memory_get_peak_usage() : memory_get_usage();
}
function wp_before_admin_bar_render() {
global $wp_admin_bar;
$classes = apply_filters( 'debug_bar_classes', array() );
$classes = implode( " ", $classes );
/* Add the main siteadmin menu item */
$wp_admin_bar->add_menu( array(
'id' => 'debug-bar',
'parent' => 'top-secondary',
'title' => apply_filters( 'debug_bar_title', __( 'Debug', 'debug-bar' ) ),
'meta' => array( 'class' => $classes ),
) );
foreach ( $this->panels as $panel_key => $panel ) {
$panel->prerender();
if ( ! $panel->is_visible() ) {
continue;
}
$panel_class = get_class( $panel );
$wp_admin_bar->add_menu( array(
'parent' => 'debug-bar',
'id' => "debug-bar-$panel_class",
'title' => $panel->title(),
'href' => '#debug-menu-target-' . esc_attr( $panel_class ),
'meta' => array(
'rel' => '#debug-menu-link-' . esc_attr( $panel_class ),
),
) );
}
}
function body_class( $classes ) {
if ( is_array( $classes ) ) {
$classes[] = 'debug-bar-maximized';
} else {
$classes .= ' debug-bar-maximized ';
}
if ( isset( $_GET['debug-bar'] ) ) {
if ( is_array( $classes ) ) {
$classes[] = 'debug-bar-visible';
} else {
$classes .= ' debug-bar-visible ';
}
}
return $classes;
}
function render() {
global $wpdb;
if ( empty( $this->panels ) ) {
return;
}
foreach ( $this->panels as $panel_key => $panel ) {
$panel->prerender();
if ( ! $panel->is_visible() ) {
unset( $this->panels[ $panel_key ] );
}
}
?>
<div id='querylist'>
<div id="debug-bar-actions">
<span class="maximize">+</span>
<span class="restore">&ndash;</span>
<span class="close">&times;</span>
</div>
<div id='debug-bar-info'>
<div id="debug-status">
<?php //@todo: Add a links to information about WP_DEBUG, PHP version, MySQL version, and Peak Memory.
$statuses = array();
$statuses[] = array(
'site',
php_uname( 'n' ),
/* translators: %d is the site id number in a multi-site setting. */
sprintf( __( '#%d', 'debug-bar' ), get_current_blog_id() ),
);
$statuses[] = array(
'php',
__( 'PHP', 'debug-bar' ),
phpversion(),
);
$db_title = empty( $wpdb->is_mysql ) ? __( 'DB', 'debug-bar' ) : __( 'MySQL', 'debug-bar' );
$statuses[] = array(
'db',
$db_title,
$wpdb->db_version(),
);
$statuses[] = array(
'memory',
__( 'Memory Usage', 'debug-bar' ),
/* translators: %s is a formatted number representing the memory usage. */
sprintf( __( '%s bytes', 'debug-bar' ), number_format_i18n( $this->safe_memory_get_peak_usage() ) ),
);
if ( ! WP_DEBUG ) {
$statuses[] = array(
'warning',
__( 'Please Enable', 'debug-bar' ),
'WP_DEBUG',
);
}
$statuses = apply_filters( 'debug_bar_statuses', $statuses );
foreach ( $statuses as $status ):
list( $slug, $title, $data ) = $status;
?>
<div id='debug-status-<?php echo esc_attr( $slug ); ?>' class='debug-status'>
<div class='debug-status-title'><?php echo $title; ?></div>
<?php if ( ! empty( $data ) ): ?>
<div class='debug-status-data'><?php echo $data; ?></div>
<?php endif; ?>
</div><?php
endforeach;
?>
</div>
</div>
<div id='debug-bar-menu'>
<ul id="debug-menu-links">
<?php
$current = ' current';
foreach ( $this->panels as $panel ) :
$class = get_class( $panel );
?>
<li><a
id="debug-menu-link-<?php echo esc_attr( $class ); ?>"
class="debug-menu-link<?php echo $current; ?>"
href="#debug-menu-target-<?php echo esc_attr( $class ); ?>">
<?php
// Not escaping html here, so panels can use html in the title.
echo $panel->title();
?>
</a></li>
<?php
$current = '';
endforeach; ?>
</ul>
</div>
<div id="debug-menu-targets"><?php
$current = ' style="display: block"';
foreach ( $this->panels as $panel ) :
$class = get_class( $panel ); ?>
<div id="debug-menu-target-<?php echo $class; ?>" class="debug-menu-target" <?php echo $current; ?>>
<?php $panel->render(); ?>
</div>
<?php
$current = '';
endforeach;
?>
</div>
<?php do_action( 'debug_bar' ); ?>
</div>
<?php
}
}
$GLOBALS['debug_bar'] = new Debug_Bar();
@@ -0,0 +1,67 @@
( function() {
var count, list, dbjsError,
rawCount = 0,
errors = [];
window.onerror = function ( errorMsg, url, lineNumber ) {
if ( ! document.getElementById( 'debug-bar-js-error-count' ) ) {
errors[ errors.length ] = [ errorMsg, url, lineNumber ];
} else {
dbjsError( errorMsg, url, lineNumber );
}
};
jQuery( function () {
for ( err in errors ) {
dbjsError( errors[ err ][0], errors[ err ][1], errors[ err ][2] );
}
} );
dbjsError = function dbjsError( errorMsg, url, lineNumber ) {
var errorLine, place, button, tab;
rawCount++;
if ( ! count ) {
count = document.getElementById( 'debug-bar-js-error-count' );
}
if ( ! list ) {
list = document.getElementById( 'debug-bar-js-errors' );
}
if ( ! count || ! list ) {
return; // threw way too early... @todo cache these?
}
if ( 1 == rawCount ) {
button = document.getElementById( 'wp-admin-bar-debug-bar' );
if ( ! button ) {
return; // how did this happen?
}
if ( -1 === button.className.indexOf( 'debug-bar-php-warning-summary' ) ) {
button.className = button.className + ' debug-bar-php-warning-summary';
}
[ 'debug-menu-link-Debug_Bar_JS', 'wp-admin-bar-debug-bar-Debug_Bar_JS' ].map( function( id ) {
tab = document.getElementById( id );
if ( tab ) {
tab.style.display = 'block';
}
} );
}
count.textContent = rawCount;
errorLine = document.createElement( 'li' );
errorLine.className = 'debug-bar-js-error';
errorLine.textContent = errorMsg;
place = document.createElement( 'span' );
place.textContent = url + ' line ' + lineNumber;
errorLine.appendChild( place );
list.appendChild( errorLine );
};
} )();
@@ -0,0 +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)}}}();
@@ -0,0 +1,123 @@
var wpDebugBar;
( function( $ ) {
var api;
wpDebugBar = api = {
// The element that we will pad to prevent the debug bar
// from overlapping the bottom of the page.
body: undefined,
init: function init() {
// If we're not in the admin, pad the body.
api.body = $( document.body );
api.toggle.init();
api.tabs();
api.actions.init();
},
isVisible: function isVisible() {
return api.body.hasClass( 'debug-bar-visible' );
},
toggle: {
init: function init() {
$( '#wp-admin-bar-debug-bar' ).click( function onClickAdminBarMenu( event ) {
event.preventDefault();
// Click on submenu item.
if ( event.target.hash ) {
var $menuLink = $( event.target.rel );
// Open/close debug bar.
if ( ! api.isVisible() ) {
api.toggle.visibility();
} else if ( $menuLink.hasClass( 'current' ) ) {
$menuLink.removeClass( 'current' );
api.toggle.visibility();
return;
}
// Deselect other tabs and hide other panels.
$( '.debug-menu-target' ).hide().trigger( 'debug-bar-hide' );
$( '.debug-menu-link' ).removeClass( 'current' );
$menuLink.addClass( 'current' );
$( event.target.hash ).show().trigger( 'debug-bar-show' );
} else {
api.toggle.visibility();
}
} );
},
visibility: function visibility( show ) {
show = typeof show == 'undefined' ? ! api.isVisible() : show;
// Show/hide the debug bar.
api.body.toggleClass( 'debug-bar-visible', show );
// Press/unpress the button.
$( this ).toggleClass( 'active', show );
}
},
tabs: function tabs() {
var debugMenuLinks = $( '.debug-menu-link' ),
debugMenuTargets = $( '.debug-menu-target' );
debugMenuLinks.click( function onClickLink( event ) {
var $this = $( this );
event.preventDefault();
if ( $this.hasClass( 'current' ) ) {
return;
}
// Deselect other tabs and hide other panels.
debugMenuTargets.hide().trigger( 'debug-bar-hide' );
debugMenuLinks.removeClass( 'current' );
// Select the current tab and show the current panel.
$this.addClass( 'current' );
// The hashed component of the href is the id that we want to display.
$( '#' + this.href.substr( this.href.indexOf( '#' ) + 1 ) ).show().trigger( 'debug-bar-show' );
} );
},
actions: {
init: function init() {
var actions = $( '#debug-bar-actions' );
// Close the panel with the esc key if it's open.
$( document ).keydown( function maybeClosePanel( event ) {
var key = event.key || event.which || event.keyCode;
if ( 27 /* esc */ === key && api.isVisible() ) {
event.preventDefault();
api.actions.close();
}
} );
$( '.maximize', actions ).click( api.actions.maximize );
$( '.restore', actions ).click( api.actions.restore );
$( '.close', actions ).click( api.actions.close );
},
maximize: function maximize() {
api.body.removeClass( 'debug-bar-partial' );
api.body.addClass( 'debug-bar-maximized' );
},
restore: function restore() {
api.body.removeClass( 'debug-bar-maximized' );
api.body.addClass( 'debug-bar-partial' );
},
close: function close() {
api.toggle.visibility( false );
}
}
};
$( wpDebugBar.init );
} )( jQuery );
@@ -0,0 +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);
@@ -0,0 +1,56 @@
/**
* Dockable.
**/
(function($){
$.widget("db.dockable", $.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 = $( this.options.handle );
this._mouseInit();
},
_handoff: function() {
return {
element: this.element,
handle: this.handle,
axis: this.options.axis
};
},
_mouseStart: function(event) {
this._trigger( "start", event, this._handoff() );
this.d0 = this.element[this.dimension]() + event[this.page];
},
_mouseDrag: function(event) {
var resize = this._trigger( "resize", event, this._handoff() );
// If the resize event returns false, we don't resize.
if ( resize === false )
return;
this.element[this.dimension]( this.d0 - event[this.page] );
this._trigger( "resized", event, this._handoff() );
},
_mouseCapture: function(event) {
return !this.options.disabled && event.target == this.handle[0];
},
_mouseStop: function(event) {
this._trigger( "stop", event, this._handoff() );
}
});
})(jQuery);
@@ -0,0 +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);
@@ -0,0 +1,139 @@
<?php
// Alot of this code is massaged from Andrew Nacin's log-deprecated-notices plugin
class Debug_Bar_Deprecated extends Debug_Bar_Panel {
private $deprecated_functions = array();
private $deprecated_files = array();
private $deprecated_arguments = array();
function init() {
$this->title( __( 'Deprecated', 'debug-bar' ) );
add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ), 10, 3 );
add_action( 'deprecated_file_included', array( $this, 'deprecated_file_included' ), 10, 4 );
add_action( 'deprecated_argument_run', array( $this, 'deprecated_argument_run' ), 10, 3 );
// Silence E_NOTICE for deprecated usage.
foreach ( array( 'function', 'file', 'argument' ) as $item ) {
add_filter( "deprecated_{$item}_trigger_error", '__return_false' );
}
}
function prerender() {
$this->set_visible(
count( $this->deprecated_functions )
|| count( $this->deprecated_files )
|| count( $this->deprecated_arguments )
);
}
function render() {
echo "<div id='debug-bar-deprecated'>";
echo '<h2><span>', __( 'Total Functions:', 'debug-bar' ), '</span>', number_format_i18n( count( $this->deprecated_functions ) ), "</h2>\n";
echo '<h2><span>', __( 'Total Arguments:', 'debug-bar' ), '</span>', number_format_i18n( count( $this->deprecated_arguments ) ), "</h2>\n";
echo '<h2><span>', __( 'Total Files:', 'debug-bar' ), '</span>', number_format_i18n( count( $this->deprecated_files ) ), "</h2>\n";
if ( count( $this->deprecated_functions ) ) {
echo '<ol class="debug-bar-deprecated-list">';
foreach ( $this->deprecated_functions as $location => $message_stack ) {
list( $message, $stack ) = $message_stack;
echo "<li class='debug-bar-deprecated-function'>";
echo str_replace( ABSPATH, '', $location ) . ' - ' . strip_tags( $message );
echo "<br/>";
echo $stack;
echo "</li>";
}
echo '</ol>';
}
if ( count( $this->deprecated_files ) ) {
echo '<ol class="debug-bar-deprecated-list">';
foreach ( $this->deprecated_files as $location => $message_stack ) {
list( $message, $stack ) = $message_stack;
echo "<li class='debug-bar-deprecated-file'>";
echo str_replace( ABSPATH, '', $location ) . ' - ' . strip_tags( $message );
echo "<br/>";
echo $stack;
echo "</li>";
}
echo '</ol>';
}
if ( count( $this->deprecated_arguments ) ) {
echo '<ol class="debug-bar-deprecated-list">';
foreach ( $this->deprecated_arguments as $location => $message_stack ) {
list( $message, $stack ) = $message_stack;
echo "<li class='debug-bar-deprecated-argument'>";
echo str_replace( ABSPATH, '', $location ) . ' - ' . strip_tags( $message );
echo "<br/>";
echo $stack;
echo "</li>";
}
echo '</ol>';
}
echo "</div>";
}
function deprecated_function_run( $function, $replacement, $version ) {
$backtrace = debug_backtrace( false );
$bt = 4;
// Check if we're a hook callback.
if ( ! isset( $backtrace[4]['file'] ) && 'call_user_func_array' == $backtrace[5]['function'] ) {
$bt = 6;
}
$location = $backtrace[ $bt ]['file'] . ':' . $backtrace[ $bt ]['line'];
if ( ! is_null( $replacement ) ) {
/* translators: %1$s is a function or file name, %2$s a version number, %3$s an alternative function or file to use. */
$message = sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', 'debug-bar' ), $function, $version, $replacement );
} else {
/* translators: %1$s is a function or file name, %2$s a version number. */
$message = sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', 'debug-bar' ), $function, $version );
}
$this->deprecated_functions[ $location ] = array( $message, wp_debug_backtrace_summary( null, $bt ) );
}
function deprecated_file_included( $old_file, $replacement, $version, $message ) {
$backtrace = debug_backtrace( false );
$file = $backtrace[4]['file'];
$file_abs = str_replace( ABSPATH, '', $file );
$location = $file . ':' . $backtrace[4]['line'];
$message = empty( $message ) ? '' : ' ' . $message;
if ( ! is_null( $replacement ) ) {
/* translators: %1$s is a function or file name, %2$s a version number, %3$s an alternative function or file to use. */
$message = sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', 'debug-bar' ), $file_abs, $version, $replacement ) . $message;
} else {
/* translators: %1$s is a function or file name, %2$s a version number. */
$message = sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', 'debug-bar' ), $file_abs, $version ) . $message;
}
$this->deprecated_files[ $location ] = array( $message, wp_debug_backtrace_summary( null, 4 ) );
}
function deprecated_argument_run( $function, $message, $version ) {
$backtrace = debug_backtrace( false );
if ( 'define()' === $function ) {
$this->deprecated_arguments[] = array( $message, '' );
return;
}
$bt = 4;
if ( ! isset( $backtrace[4]['file'] ) && 'call_user_func_array' == $backtrace[5]['function'] ) {
$bt = 6;
}
$location = $backtrace[ $bt ]['file'] . ':' . $backtrace[ $bt ]['line'];
if ( ! is_null( $message ) ) {
$message = sprintf( __( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s' ), $function, $version, $message );
} else {
$message = sprintf( __( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.' ), $function, $version );
}
$this->deprecated_arguments[ $location ] = array( $message, wp_debug_backtrace_summary( null, $bt ) );
}
}
@@ -0,0 +1,23 @@
<?php
class Debug_Bar_JS extends Debug_Bar_Panel {
public $real_error_handler = array();
function init() {
$this->title( __( 'JavaScript', 'debug-bar' ) );
/*
* attach here instead of debug_bar_enqueue_scripts
* because we want to be as early as possible!
*/
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.dev' : '';
wp_enqueue_script( 'debug-bar-js', plugins_url( "js/debug-bar-js$suffix.js", dirname( __FILE__ ) ), array( 'jquery' ), '20111216' );
}
function render() {
echo '<div id="debug-bar-js">';
echo '<h2><span>' . __( 'Total Errors:', 'debug-bar' ) . "</span><span id='debug-bar-js-error-count'>0</span></h2>\n";
echo '<ol class="debug-bar-js-list" id="debug-bar-js-errors"></ol>' . "\n";
echo '</div>';
}
}
@@ -0,0 +1,25 @@
<?php
class Debug_Bar_Object_Cache extends Debug_Bar_Panel {
function init() {
$this->title( __( 'Object Cache', 'debug-bar' ) );
}
function prerender() {
global $wp_object_cache;
$this->set_visible( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'stats' ) );
}
function render() {
global $wp_object_cache;
ob_start();
echo "<div id='object-cache-stats'>";
$wp_object_cache->stats();
echo "</div>";
$out = ob_get_contents();
ob_end_clean();
echo $out;
}
}
@@ -0,0 +1,61 @@
<?php
class Debug_Bar_Panel {
public $_title = '';
public $_visible = true;
function __construct( $title = '' ) {
$this->title( $title );
if ( $this->init() === false ) {
$this->set_visible( false );
return;
}
add_filter( 'debug_bar_classes', array( $this, 'debug_bar_classes' ) );
}
function Debug_Bar_Panel( $title = '' ) {
_deprecated_constructor( __METHOD__, '0.8.3', __CLASS__ );
self::__construct( $title );
}
/**
* Initializes the panel.
*/
function init() {}
function prerender() {}
/**
* Renders the panel.
*/
function render() {}
function is_visible() {
return $this->_visible;
}
function set_visible( $visible ) {
$this->_visible = $visible;
}
/**
* Get/set title.
*
* @param null $title
* @return string|void
*/
function title( $title = null ) {
if ( ! isset( $title ) ) {
return $this->_title;
}
$this->_title = $title;
}
function debug_bar_classes( $classes ) {
return $classes;
}
}
@@ -0,0 +1,111 @@
<?php
class Debug_Bar_PHP extends Debug_Bar_Panel {
public $warnings = array();
public $notices = array();
public $real_error_handler = array();
function init() {
if ( ! WP_DEBUG ) {
return false;
}
$this->title( __( 'Notices / Warnings', 'debug-bar' ) );
$this->real_error_handler = set_error_handler( array( &$this, 'error_handler' ) );
}
function is_visible() {
return count( $this->notices ) || count( $this->warnings );
}
function debug_bar_classes( $classes ) {
if ( count( $this->warnings ) ) {
$classes[] = 'debug-bar-php-warning-summary';
} elseif ( count( $this->notices ) ) {
$classes[] = 'debug-bar-php-notice-summary';
}
return $classes;
}
function error_handler( $type, $message, $file, $line ) {
$_key = md5( $file . ':' . $line . ':' . $message );
if ( ! defined( 'E_DEPRECATED' ) ) {
define( 'E_DEPRECATED', 8192 );
}
if ( ! defined( 'E_USER_DEPRECATED' ) ) {
define( 'E_USER_DEPRECATED', 16384 );
}
switch ( $type ) {
case E_WARNING:
case E_USER_WARNING:
$this->warnings[ $_key ] = array(
$file . ':' . $line,
$message,
wp_debug_backtrace_summary( __CLASS__ ),
);
break;
case E_NOTICE:
case E_USER_NOTICE:
$this->notices[ $_key ] = array(
$file . ':' . $line,
$message,
wp_debug_backtrace_summary( __CLASS__ ),
);
break;
case E_STRICT:
// TODO
break;
case E_DEPRECATED:
case E_USER_DEPRECATED:
// TODO
break;
case 0:
// TODO
break;
}
if ( null != $this->real_error_handler ) {
return call_user_func( $this->real_error_handler, $type, $message, $file, $line );
} else {
return false;
}
}
function render() {
echo "<div id='debug-bar-php'>";
echo '<h2><span>', __( 'Total Warnings:', 'debug-bar' ), '</span>', number_format_i18n( count( $this->warnings ) ), "</h2>\n";
echo '<h2><span>', __( 'Total Notices:', 'debug-bar' ), '</span>', number_format_i18n( count( $this->notices ) ), "</h2>\n";
if ( count( $this->warnings ) ) {
echo '<ol class="debug-bar-php-list">';
foreach ( $this->warnings as $location_message_stack ) {
list( $location, $message, $stack ) = $location_message_stack;
echo '<li class="debug-bar-php-warning">', __( 'WARNING:', 'debug-bar' ), ' ';
echo str_replace( ABSPATH, '', $location ) . ' - ' . strip_tags( $message );
echo '<br/>';
echo $stack;
echo '</li>';
}
echo '</ol>';
}
if ( count( $this->notices ) ) {
echo '<ol class="debug-bar-php-list">';
foreach ( $this->notices as $location_message_stack ) {
list( $location, $message, $stack ) = $location_message_stack;
echo '<li class="debug-bar-php-notice">', __( 'NOTICE:', 'debug-bar' ), ' ';
echo str_replace( ABSPATH, '', $location ) . ' - ' . strip_tags( $message );
echo '<br/>';
echo $stack;
echo '</li>';
}
echo '</ol>';
}
echo "</div>";
}
}
@@ -0,0 +1,92 @@
<?php
class Debug_Bar_Queries extends Debug_Bar_Panel {
function init() {
$this->title( __( 'Queries', 'debug-bar' ) );
}
function prerender() {
$this->set_visible( defined( 'SAVEQUERIES' ) && SAVEQUERIES || ! empty( $GLOBALS['EZSQL_ERROR'] ) );
}
function debug_bar_classes( $classes ) {
if ( ! empty( $GLOBALS['EZSQL_ERROR'] ) ) {
$classes[] = 'debug-bar-php-warning-summary';
}
return $classes;
}
function render() {
global $wpdb, $EZSQL_ERROR;
$out = '';
$total_time = 0;
if ( ! empty( $wpdb->queries ) ) {
$show_many = isset( $_GET['debug_queries'] );
if ( $wpdb->num_queries > 500 && ! $show_many ) {
/* translators: %s = a url. */
$out .= "<p>" . sprintf( __( 'There are too many queries to show easily! <a href="%s">Show them anyway</a>', 'debug-bar' ), esc_url( add_query_arg( 'debug_queries', 'true' ) ) ) . "</p>";
}
$out .= '<ol class="wpd-queries">';
$counter = 0;
foreach ( $wpdb->queries as $q ) {
list( $query, $elapsed, $debug ) = $q;
$total_time += $elapsed;
if ( ++$counter > 500 && ! $show_many ) {
continue;
}
$debug = explode( ', ', $debug );
$debug = array_diff( $debug, array( 'require_once', 'require', 'include_once', 'include' ) );
$debug = implode( ', ', $debug );
$debug = str_replace( array( 'do_action, call_user_func_array' ), array( 'do_action' ), $debug );
$debug = esc_html( $debug );
$query = nl2br( esc_html( $query ) );
/* translators: %s = duration in milliseconds. */
$time = esc_html( sprintf( __( '%s ms', 'debug-bar' ), number_format_i18n( ( $elapsed * 1000 ), 1 ) ) );
$out .= "<li>$query<br/><div class='qdebug'>$debug <span>#$counter ($time)</span></div></li>\n";
}
$out .= '</ol>';
} else if ( 0 === $wpdb->num_queries ) {
$out .= "<p><strong>" . __( 'There are no queries on this page.', 'debug-bar' ) . "</strong></p>";
} else {
$out .= "<p><strong>" . __( 'SAVEQUERIES must be defined to show the query log.', 'debug-bar' ) . "</strong></p>";
}
if ( ! empty( $EZSQL_ERROR ) ) {
$out .= '<h3>' . __( 'Database Errors', 'debug-bar' ) . '</h3>';
$out .= '<ol class="wpd-queries">';
foreach ( $EZSQL_ERROR as $error ) {
$query = nl2br( esc_html( $error['query'] ) );
$message = esc_html( $error['error_str'] );
$out .= "<li>$query<br/><div class='qdebug'>$message</div></li>\n";
}
$out .= '</ol>';
}
$heading = '';
if ( $wpdb->num_queries ) {
$heading .= '<h2><span>' . __( 'Total Queries:', 'debug-bar' ) . '</span>' . number_format_i18n( $wpdb->num_queries ) . "</h2>\n";
}
if ( $total_time ) {
$heading .= '<h2><span>' . __( 'Total query time:', 'debug-bar' ) . '</span>';
/* translators: %s = duration in milliseconds. */
$heading .= sprintf( __( '%s ms', 'debug-bar' ), number_format_i18n( ( $total_time * 1000 ), 1 ) ) . "</h2>\n";
}
if ( ! empty( $EZSQL_ERROR ) ) {
$heading .= '<h2><span>' . __( 'Total DB Errors:', 'debug-bar' ) . '</span>' . number_format_i18n( count( $EZSQL_ERROR ) ) . "</h2>\n";
}
echo $heading . $out;
}
}
@@ -0,0 +1,55 @@
<?php
class Debug_Bar_Request extends Debug_Bar_Panel {
function init() {
$this->title( __('Request', 'debug-bar') );
}
function prerender() {
$this->set_visible( ! is_admin() );
}
function render() {
global $wp;
echo "<div id='debug-bar-request'>";
if ( empty( $wp->request ) ) {
$request = __( 'None', 'debug-bar' );
} else {
$request = $wp->request;
}
echo '<h3>', __( 'Request:', 'debug-bar' ), '</h3>';
echo '<p>' . esc_html( $request ) . '</p>';
if ( empty( $wp->query_string ) ) {
$query_string = __( 'None', 'debug-bar' );
} else {
$query_string = $wp->query_string;
}
echo '<h3>', __( 'Query String:', 'debug-bar' ), '</h3>';
echo '<p>' . esc_html( $query_string ) . '</p>';
if ( empty( $wp->matched_rule ) ) {
$matched_rule = __( 'None', 'debug-bar' );
} else {
$matched_rule = $wp->matched_rule;
}
echo '<h3>', __( 'Matched Rewrite Rule:', 'debug-bar' ), '</h3>';
echo '<p>' . esc_html( $matched_rule ) . '</p>';
if ( empty( $wp->matched_query ) ) {
$matched_query = __( 'None', 'debug-bar' );
} else {
$matched_query = $wp->matched_query;
}
echo '<h3>', __( 'Matched Rewrite Query:', 'debug-bar' ), '</h3>';
echo '<p>' . esc_html( $matched_query ) . '</p>';
echo '</div>';
}
}
@@ -0,0 +1,113 @@
<?php
class Debug_Bar_WP_Query extends Debug_Bar_Panel {
function init() {
$this->title( __( 'WP Query', 'debug-bar' ) );
}
function prerender() {
$this->set_visible( defined( 'SAVEQUERIES' ) && SAVEQUERIES );
}
function render() {
global $template, $wp_query;
$queried_object = get_queried_object();
if ( $queried_object && isset( $queried_object->post_type ) ) {
$post_type_object = get_post_type_object( $queried_object->post_type );
}
echo "<div id='debug-bar-wp-query'>";
echo '<h2><span>', __( 'Queried Object ID:', 'debug-bar' ), '</span>', get_queried_object_id(), "</h2>\n";
// Determine the query type. Follows the template loader order.
$type = '';
if ( is_404() ) {
$type = __( '404', 'debug-bar' );
} elseif ( is_search() ) {
$type = __( 'Search', 'debug-bar' );
} elseif ( is_tax() ) {
$type = __( 'Taxonomy', 'debug-bar' );
} elseif ( is_front_page() ) {
$type = __( 'Front Page', 'debug-bar' );
} elseif ( is_home() ) {
$type = __( 'Home', 'debug-bar' );
} elseif ( is_attachment() ) {
$type = __( 'Attachment', 'debug-bar' );
} elseif ( is_single() ) {
$type = __( 'Single', 'debug-bar' );
} elseif ( is_page() ) {
$type = __( 'Page', 'debug-bar' );
} elseif ( is_category() ) {
$type = __( 'Category', 'debug-bar' );
} elseif ( is_tag() ) {
$type = __( 'Tag', 'debug-bar' );
} elseif ( is_author() ) {
$type = __( 'Author', 'debug-bar' );
} elseif ( is_date() ) {
$type = __( 'Date', 'debug-bar' );
} elseif ( is_archive() ) {
$type = __( 'Archive', 'debug-bar' );
} elseif ( is_paged() ) {
$type = __( 'Paged', 'debug-bar' );
}
if ( ! empty( $type ) ) {
echo '<h2><span>', __( 'Query Type:', 'debug-bar' ), '</span>', $type, "</h2>\n";
}
if ( ! empty( $template ) ) {
echo '<h2><span>', __( 'Query Template:', 'debug-bar' ), '</span>', basename( $template ), "</h2>\n";
}
$show_on_front = get_option( 'show_on_front' );
$page_on_front = get_option( 'page_on_front' );
$page_for_posts = get_option( 'page_for_posts' );
echo '<h2><span>', __( 'Show on Front:', 'debug-bar' ), '</span>', $show_on_front, "</h2>\n";
if ( 'page' == $show_on_front ) {
echo '<h2><span>', __( 'Page for Posts:', 'debug-bar' ), '</span>', $page_for_posts, "</h2>\n";
echo '<h2><span>', __( 'Page on Front:', 'debug-bar' ), '</span>', $page_on_front, "</h2>\n";
}
if ( isset( $post_type_object ) ) {
echo '<h2><span>', __( 'Post Type:', 'debug-bar' ), '</span>', $post_type_object->labels->singular_name, "</h2>\n";
}
echo '<div class="clear"></div>';
if ( empty( $wp_query->query ) ) {
$query = __( 'None', 'debug-bar' );
} else {
$query = http_build_query( $wp_query->query );
}
echo '<h3>', __( 'Query Arguments:', 'debug-bar' ), '</h3>';
echo '<p>' . esc_html( $query ) . '</p>';
if ( ! empty( $wp_query->request ) ) {
echo '<h3>', __( 'Query SQL:', 'debug-bar' ), '</h3>';
echo '<p>' . esc_html( $wp_query->request ) . '</p>';
}
if ( ! is_null( $queried_object ) ) {
echo '<h3>', __( 'Queried Object:', 'debug-bar' ), '</h3>';
echo '<table class="debug-bar-wp-query-list"><tbody>';
$this->_recursive_print_kv( $queried_object );
echo '</tbody></table>';
}
echo '</div>';
}
protected function _recursive_print_kv( $kv_array ) {
foreach ( $kv_array as $key => $value ) {
if ( is_object( $value ) || is_array( $value ) ) {
echo '<tr><th>', $key, '</th> <td>&rArr;</td> <td>';
$this->_recursive_print_kv( $value );
echo '</td></tr>';
} else {
echo '<tr><th>', $key, '</th> <td>&rArr;</td> <td>', $value, '</td></tr>';
}
}
}
}
+165
View File
@@ -0,0 +1,165 @@
=== Debug Bar ===
Contributors: wordpressdotorg, ryan, westi, koopersmith, duck_, mitchoyoshitaka, dd32, jrf, obenland
Tags: debug
Tested up to: 4.9.8
Stable tag: 1.0
Requires at least: 3.4
Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
== Description ==
Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
A must for developers!
When `WP_DEBUG` is enabled it also tracks PHP Warnings and Notices to make them easier to find.
When `SAVEQUERIES` is enabled the mysql queries are tracked and displayed.
To enable these options, add the following code to your `wp-config.php` file:
`
define( 'WP_DEBUG', true );
define( 'SAVEQUERIES', true );
`
Add a PHP/MySQL console with the [Debug Bar Console plugin](https://wordpress.org/plugins/debug-bar-console/).
There are numerous other add-ons available to get more insight into, for instance, the registered Post Types, Shortcodes, WP Cron, Language file loading, Actions and Filters and so on. Just [search the plugin directory for 'Debug Bar'](https://wordpress.org/plugins/search/debug+bar/).
== Upgrade Notice ==
= 1.0 =
Improved compatibility with the WordPress.com toolbar in Jetpack
= 0.9 =
Added panel navigation to toolbar.
Improved localization support.
Security fixes.
= 0.8.4 =
Updated to avoid incompatibilities with some extensions.
= 0.8.3 =
Updated to avoid PHP7 Deprecated notices.
= 0.8.2 =
Updated to handle a new deprecated message in WordPress 4.0.
= 0.8.1 =
Minor security fix.
= 0.8 =
WordPress 3.3 compatibility
UI refresh
Removed jQuery UI requirement
Full screen by default
New debug-bar query parameter to show on page load
Removed display cookies
JavaScript error tracking (disabled by default)
= 0.7 =
Made compatible with PHP < 5.2.0
CSS Tweaks
Load JavaScript in Footer
Fixed display issues for WP_Query debug on CPT archives pages
SQL/DB error tracking
= 0.6 =
Added maximize/restore button
Added cookie to keep track of debug bar state
Added post type information to WP_Query tab
Bug fix where bottom of page was obscured in the admin
= 0.5 =
New UI
Backend rewritten with a class for each panel
Many miscellaneous improvements
= 0.4.1 =
Compatibility updates for trunk
= 0.4 =
Added DB Version information
Updated PHP Warning and Notice tracking so that multiple different errors on the same line are tracked
Compatibility updates for trunk
= 0.3 =
Added WordPress Query infomation
Added Request parsing information
= 0.2 =
Added PHP Notice / Warning tracking when WP_DEBUG enabled
Added deprecated function usage tracking
= 0.1 =
Initial Release
== Changelog ==
= 0.9 =
Added panel navigation to toolbar.
Improved localization support.
Security fixes.
= 0.8.4 =
Updated to avoid incompatibilities with some extensions.
= 0.8.3 =
Updated to avoid PHP7 Deprecated notices.
= 0.8.2 =
Updated to handle a new deprecated message in WordPress 4.0.
= 0.8.1 =
Minor security fix.
= 0.8 =
WordPress 3.3 compatibility
UI refresh
Removed jQuery UI requirement
Full screen by default
New debug-bar query parameter to show on page load
Removed display cookies
JavaScript error tracking (disabled by default)
= 0.7 =
Made compatible with PHP < 5.2.0
CSS Tweaks
Load JavaScript in Footer
Fixed display issues for WP_Query debug on CPT archives pages
SQL/DB error tracking
= 0.6 =
Added maximize/restore button
Added cookie to keep track of debug bar state
Added post type information to WP_Query tab
Bug fix where bottom of page was obscured in the admin
= 0.5 =
New UI
Backend rewritten with a class for each panel
Many miscellaneous improvements
= 0.4.1 =
Compatibility updates for trunk
= 0.4 =
Added DB Version information
Updated PHP Warning and Notice tracking so that multiple different errors on the same line are tracked
Compatibility updates for trunk
= 0.3 =
Added WordPress Query infomation
Added Request parsing information
= 0.2 =
Added PHP Notice / Warning tracking when WP_DEBUG enabled
Added deprecated function usage tracking
= 0.1 =
Initial Release
== Installation ==
Use automatic installer.