Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Stewart Ritchie authored and Stewart Ritchie committed Feb 27, 2019
0 parents commit 3caa4f6
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
13 changes: 13 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "pbc/debug-tools",
"description": "WordPress Debugging Tools for PBC projects",
"type": "wordpress-muplugin",
"license": "GPL2",
"authors": [
{
"name": "Stewart Ritchie",
"email": "[email protected]"
}
],
"require": {}
}
90 changes: 90 additions & 0 deletions pbc-debug-tools.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php
/**
* Plugin Name
*
* @package Powered By Coffee Debug Tools
* @author Stewart Ritchie
* @copyright 2019 Powered By Coffee
* @license GPL-2.0+
*
* @wordpress-plugin
* Plugin Name: Powered By Coffee Debug Tools
* Plugin URI: https://poweredbycoffee.co.uk
* Description: Description of the plugin.
* Version: 1.0.0
* Author: stewarty
* Author URI: https://poweredbycoffee.co.uk
* Text Domain: pbc-debug-tools
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/


function pbc_backtrace(){

$trace = debug_backtrace();

//echo "<pre>";
//var_dump($trace);

echo "<table>";

foreach($trace as $key => $line){

if($line['function'] == "pbc_backtrace"){
continue;
}

if(($line['function'] == "do_action") && (($line['class'] == "WP_Hook") )){
continue;
}

echo "<tr style='background-color:#f5f5f5;'>";
echo "<td>";
echo $line['function'];
if($line['function'] == "do_action"){
echo " [" . $line['args'][0] . "]";
}
echo "</td>";

echo "<td>";
echo (isset($line['class']) ? $line['class'] : "" );
echo "</td>";

echo "<td>";
echo (isset($line['type']) ? $line['type'] : "" );
echo "</td>";

echo "<td>";
echo (isset($line['file']) ? $line['file'] : "" );
echo "</td>";
echo "</tr>";
}

echo "</table>";

}


function pbc_dump($trace){
echo "<pre>";
var_dump($trace);
echo "</pre>";
die();
}

function pbc_log($log){
write_log($log);
}


if ( ! function_exists('write_log')) {
function write_log ( $log ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
}
}

0 comments on commit 3caa4f6

Please sign in to comment.