Skip to content

Commit

Permalink
Update Debug Bar Console plugin from 0.3 to 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpoke-bot committed Oct 28, 2024
1 parent f68050a commit a6ede33
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ function render() {
</div>
</div>
<div id="debug-bar-console-output">
<strong><?php _e('Output'); ?></strong>
<ul class="debug-bar-console-tabs">
<li class="debug-bar-console-tab debug-bar-console-tab-active" data-output-mode="formatted"><?php _e('Formatted'); ?></li>
<li class="debug-bar-console-tab" data-output-mode="raw"><?php _e('Raw'); ?></li>
</ul>
<div class="debug-bar-console-panel">
<iframe></iframe>
</div>
Expand Down
23 changes: 15 additions & 8 deletions wp-content/plugins/debug-bar-console/debug-bar-console.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<?php
/**
* Plugin Name: Debug Bar Console
* Plugin URI: http://wordpress.org/extend/plugins/debug-bar-console/
* Description: Adds a PHP/SQL console panel to the Debug Bar plugin. Requires the Debug Bar plugin.
* Author: Drew Jaynes
* Author URI: https://werdswords.com
* Version: 0.3.1
* License: GPLv2
*/

/*
Plugin Name: Debug Bar Console
Plugin URI: http://wordpress.org/extend/plugins/debug-bar-console/
Description: Adds a PHP/SQL console to the debug bar. Requires the debug bar plugin.
Author: koopersmith
Version: 0.3
Author URI: http://darylkoop.com/
* Copyright (c) 2024, Drew Jaynes
* Copyright (c) 2011-2024, Daryl Koopersmith
* http://opensource.org/licenses/gpl-2.0.php GNU Public License
*/

add_filter('debug_bar_panels', 'debug_bar_console_panel');
Expand All @@ -23,7 +30,7 @@ function debug_bar_console_scripts() {
wp_enqueue_style( 'debug-bar-codemirror', plugins_url( "codemirror/lib/codemirror.css", __FILE__ ), array(), '2.22' );
wp_enqueue_script( 'debug-bar-codemirror', plugins_url( "codemirror/debug-bar-codemirror.js", __FILE__ ), array(), '2.22' );

wp_enqueue_style( 'debug-bar-console', plugins_url( "css/debug-bar-console$suffix.css", __FILE__ ), array( 'debug-bar', 'debug-bar-codemirror' ), '20120317' );
wp_enqueue_script( 'debug-bar-console', plugins_url( "js/debug-bar-console$suffix.js", __FILE__ ), array( 'debug-bar', 'debug-bar-codemirror' ), '20120317' );
wp_enqueue_style( 'debug-bar-console', plugins_url( "css/debug-bar-console$suffix.css", __FILE__ ), array( 'debug-bar', 'debug-bar-codemirror' ), '20240827' );
wp_enqueue_script( 'debug-bar-console', plugins_url( "js/debug-bar-console$suffix.js", __FILE__ ), array( 'debug-bar', 'debug-bar-codemirror' ), '20240827' );
}

55 changes: 43 additions & 12 deletions wp-content/plugins/debug-bar-console/js/debug-bar-console.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var el = {},
iframe = {},
run, mode, nonce;
run, mode, output, nonce;

run = function() {
var input = mode.inputs[ mode.mode ];
Expand All @@ -19,12 +19,34 @@ run = function() {
mode: mode.mode,
data: input.val(),
nonce: nonce
}, function( data ) {
iframe.body.html( data );
});
}, output.render );
return false;
};

output = {
data: '',
mode: 'formatted',
render: function( data ) {
var html;

if ( arguments.length )
output.data = data;
else
data = output.data;

if ( output.mode === 'formatted' ) {
iframe.body.text( data );
html = iframe.body.html();
html = html.replace( / /g, '&nbsp;' ).replace(/[\r\n]+/g, '<br />');
iframe.body.html( html );
} else {
iframe.body.html( data );
}
},
refresh: function() {
return output.render();
}
};

mode = {
mode: 'php',
Expand Down Expand Up @@ -59,13 +81,8 @@ mode = {
indentUnit: 4,
indentWithTabs: true,
enterMode: 'keep',
onKeyEvent: function(i, e) {
// Hook into shift-enter
if ( e.keyCode == 13 && e.shiftKey ) {
e.stop();
run();
return true;
}
extraKeys: {
'Shift-Enter': run
}
}
},
Expand Down Expand Up @@ -96,6 +113,7 @@ $(document).ready( function(){
$.extend( el, {
form: $('#debug-bar-console'),
submit: $('#debug-bar-console-submit a'),
input: $('#debug-bar-console-wrap'),
output: $('#debug-bar-console-output')
});
el.wrap = el.form.parent();
Expand All @@ -122,7 +140,7 @@ $(document).ready( function(){
});

// Bind tab switching
$('.debug-bar-console-tab').each( function() {
$( '.debug-bar-console-tab', el.input ).each( function() {
var t = $(this),
slug = t.find('input').val(),
input;
Expand All @@ -138,6 +156,19 @@ $(document).ready( function(){
}).click( function() {
mode.change( $(this).data( 'console-tab' ) );
});

// Output tab switching
$( '.debug-bar-console-tab', el.output ).click( function() {
var t = $(this);

output.mode = t.data('outputMode');
output.refresh();

// Update tabs
t.siblings().removeClass('debug-bar-console-tab-active');
t.addClass('debug-bar-console-tab-active');

});
});

})(jQuery);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 19 additions & 23 deletions wp-content/plugins/debug-bar-console/readme.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
=== Debug Bar Console ===
Contributors: koopersmith
Tags: debug, developer, console
Tested up to: 3.4
Stable tag: 0.3
Contributors: drewapicture, koopersmith
Tags: debugging, developer, console
Tested up to: 6.7
Stable tag: 0.3.1
Requires at least: 3.1
License: GPLv2

Adds a PHP/MySQL console to the debug bar. Requires the debug bar plugin.
Adds a PHP/SQL console to the Debug Bar. Requires the Debug Bar plugin.

== Description ==

Adds a PHP/MySQL console to the debug bar. Requires the [Debug Bar plugin](http://wordpress.org/extend/plugins/debug-bar/) (v0.5 or later).
Adds a PHP/SQL console to the debug bar. Requires the [Debug Bar plugin](http://wordpress.org/extend/plugins/debug-bar/) (v0.5 or later).

== Upgrade Notice ==

= 0.3 =
Added syntax highlighting using the CodeMirror text editor.
Explicit PHP/SQL modes.
UI changes to reflect updated debug bar UI.

= 0.2 =
Improvements to MySQL detection and display.
Bug fixes.

= 0.1 =
Initial Release
= 0.3.1 =
* Adopted by DrewAPicture

== Changelog ==

= 0.3.1 =
* Adopted by DrewAPicture
* Tested up to WordPress 6.7

= 0.3 =
Added syntax highlighting using the CodeMirror text editor.
Explicit PHP/SQL modes.
UI changes to reflect updated debug bar UI.
* Added syntax highlighting using the CodeMirror text editor.
* Explicit PHP/SQL modes.
* UI changes to reflect updated debug bar UI.

= 0.2 =
Improvements to MySQL detection and display.
Bug fixes.
* Improvements to MySQL detection and display.
* Bug fixes.

= 0.1 =
Initial Release
* Initial Release

== Installation ==

Expand Down

0 comments on commit a6ede33

Please sign in to comment.