Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- register_tick_function(function(){
- if (isset($GLOBALS["developer_debug"]) && $GLOBALS["developer_debug"] == 'active'){
- $backtrace = debug_backtrace();
- $line = $backtrace[0]['line'] - 1;
- $file = $backtrace[0]['file'];
- if ($file == __FILE__) return;
- static $fp, $cur, $buf;
- if (!isset($fp[$file])) {
- $fp[$file] = fopen($file, 'r');
- $cur[$file] = 0;
- }
- if (isset($buf[$file][$line])) {
- $code = $buf[$file][$line];
- } else {
- do {
- $code = fgets($fp[$file]);
- $buf[$file][$cur[$file]] = $code;
- } while (++$cur[$file] <= $line);
- }
- $line++;
- if (defined('ERR_LOG')){ $error_log = ERR_LOG; } else {
- $error_log = "../logs/error_log";
- }
- error_log("n==========================================================n", 3, $error_log);
- error_log("n $file : $line :: $code n", 3, $error_log);
- error_log("n Variables: n" . print_r(get_defined_vars(), true) . "n", 3, $error_log);
- $GLOBALS["_TROUBLESHOOTING"][] = "<code>n $file : $line ::: ". htmlentities($code, ENT_QUOTES) . " n</code>";
- }
- }, ["_SERVER" => $_SERVER, "_COOKIE"=>$_COOKIE, "_REQUEST"=>$_REQUEST, "_SESSION"=>$_SESSION, "_GLOBALS"=>$GLOBALS]);
- // To use...
- // declare(ticks=1);
- // include_once('debug.php');
- $(document).ready(function() {
- var dev_top_button = document.createElement("Button");
- dev_top_button.innerHTML = "Top Dev Data";
- dev_top_button.style = "top:0;right:75%;position:absolute;z-index: 9999"
- document.body.appendChild(dev_top_button);
- var dev_bottom_button = document.createElement("Button");
- dev_bottom_button.innerHTML = "Bottom Dev Data";
- dev_bottom_button.style = "top:0;right:50%;position:absolute;z-index: 9999"
- document.body.appendChild(dev_bottom_button);
- $(dev_top_button).click(function(){
- $("#debug_top").toggle();
- });
- $(dev_bottom_button).click(function(){
- $("#debug_bottom").toggle();
- });
- });
- echo "<div class='debug_outer' id='debug_top'><h3>Developer Information</h3><div class='debug_inner'><pre>";
- if (isset($GLOBALS['_TROUBLESHOOTING']) && is_array($GLOBALS['_TROUBLESHOOTING']) && ! empty($GLOBALS['_TROUBLESHOOTING'])) {
- $troubleshooting_return_array = $GLOBALS['_TROUBLESHOOTING'];
- } else {
- $troubleshooting_return_array = ['Empty'];
- }
- echo print_r(["_COOKIE" => $_COOKIE, "_REQUEST" => $_REQUEST, "_SESSION" => $_SESSION, "_TROUBLESHOOTING" => $troubleshooting_return_array, "_SERVER" => $_SERVER, "_GLOBALS" => $GLOBALS], true);
- echo '</pre></div></div>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement