Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.class.show_debug.es.php
  1. <?php
  2. /**
  3. * Project: ePrintsStats project
  4. * File: inc.class.show_debug.es.php
  5. * Description: Display debugging in a meaningful way.
  6. * $debug = new ShowDebug();
  7. * $debug->setDebug($GLOBALS["db_values"],__LINE__,__FILE__,'','','');
  8. * // Add this where the debug output should appear
  9. * print $debug->getDebug();
  10. *
  11. */
  12.  
  13. class ShowDebug {
  14. var $_debug = array();
  15.  
  16. function setDebug($output,$line,$file,$function,$class,$method)
  17. {
  18. ob_start();
  19. print "<div class=\"debug\">\n";
  20. print "<pre>";
  21. if (!empty($line)) { print "LINE: $line\n"; };
  22. if (!empty($file)) { print "FILE: $file\n"; };
  23. if (!empty($function)) { print "FUNCTION: $function\n"; };
  24. if (!empty($class)) { print "CLASS: $class\n"; };
  25. if (!empty($method)) { print "METHOD: $method\n"; };
  26. print_r($output);
  27. print "</ pre></div>";
  28. $ret_str = ob_get_contents();
  29. ob_end_clean();
  30. $this->_debug[] = $ret_str;
  31. }
  32. function getDebug()
  33. {
  34. $_outstring = '';
  35. foreach ($this->_debug as $k=>$v) {
  36. $_outstring .= $v;
  37. }
  38. return $_outstring;
  39. }
  40.  
  41. }
  42.  
  43. ?>