Exemple #1
0
 public function executeFilter(HttpRequestInterface $request, HttpResponseInterface $response)
 {
     // webdebug must be enabled in configuration
     if (isset($this->config['error']['webdebug']) and $this->config['error']['webdebug'] === 1) {
         return;
     }
     // DEBUG mode must be on
     if (defined('DEBUG') and DEBUG === true) {
         return;
     }
     /*
      * ================================================
      *  Initialize PHP_Debug Web-Debugging Console
      * ================================================
      */
     // Additional ini path for PHPDEBUG
     define('ADD_PHPDEBUG_ROOT', ROOT_LIBRARIES . 'phpdebug');
     set_include_path(ADD_PHPDEBUG_APPLICATION_PATH . PATH_SEPARATOR . get_include_path());
     // Load Library
     if (false === class_exists('PHP_Debug', false)) {
         include ROOT_LIBRARIES . 'phpdebug/PHP/Debug.php';
     }
     // Setup Options for the PHPDebug Object
     $options = ['render_type' => 'HTML', 'render_mode' => 'div', 'restrict_access' => false, 'allow_url_access' => true, 'url_key' => 'key', 'url_pass' => 'nounou', 'enable_watch' => true, 'replace_errorhandler' => true, 'lang' => 'EN', 'HTML_DIV_view_source_script_name' => APPLICATION_PATH . 'libraries/phpdebug/PHP_Debug_ShowSource.php', 'HTML_DIV_images_path' => WWW_ROOT . 'libraries/phpdebug/images', 'HTML_DIV_css_path' => WWW_ROOT . 'libraries/phpdebug/css', 'HTML_DIV_js_path' => WWW_ROOT . 'libraries/phpdebug/js', 'HTML_DIV_remove_templates_pattern' => true];
     // Initialiaze Object
     $debug = new PHP_Debug($options);
     // Set Title to Debug Console
     $debug->add('Koch Framework DEBUG INFO');
     /*
      *  Load JS / CSS for PHP Debug Console into the Output Buffer
      */
     $html = '<script type="text/javascript" src="' . $options['HTML_DIV_js_path'] . '/html_div.js"></script>';
     $html .= '<link rel="stylesheet" type="text/css"';
     $html .= ' media="screen" href="' . $options['HTML_DIV_css_path'] . '/html_div.css" />';
     unset($options);
     // combine the html output
     $debugbarHTML = $html . $debug->getOutput();
     // push output into event object
     $event = new DebugConsoleResponse_Event($debugbarHTML);
     // and output the debugging console at the end of the application runtime
     \Koch\Event\Dispatcher::instantiate()->addEventHandler('onApplicationShutdown', $event);
 }
<p>
    <a href="PHP_Debug_HTML_Div_test.php">&raquo; HTML_DIV Renderer</a><br/>
    <a href="PHP_Debug_HTML_Table_test.php">&raquo; HTML_Table Renderer</a><br/>
    <a href="PHP_Debug_test.php">&raquo; Test min</a><br/>
    <a href="PHP_Debug_Sources.php">&raquo; Show sources</a><br/>
    <a href="http://www.php-debug.com">&raquo; Back to PHP_Debug home</a><br/>
</p>

<?php 
// Tests variables  ============================================================
// One variable that will be watched by PHP_Debug
$watchedVariable = 1;
// One session variable to test the debugtype = PHP_DebuLine::TYPE_ENV (4)
$_SESSION['Kikoo'] = "One session variable defined";
// Debug Object creation =======================================================
$Dbg = new PHP_Debug($options);
// Test restrictAccess() function, only IP in param array will see the debug ===
//$Dbg->restrictAccess($allowedip);
// Test add() function =========================================================
// Standard
$renderer = 'HTML_Div';
$intro = 'This is the <b>' . $renderer . '_Renderer</b>, client IP is ' . $_SERVER['REMOTE_ADDR'];
$Dbg->add($intro);
// Standard, fix end and start time manually
$debug_line = $Dbg->add('Manual performance monitoring');
$debug_line->setStartTime();
for ($i = 0; $i < 20000; $i++) {
    $j = 0;
}
$debug_line->setEndTime();
// Application settings ========================================================
Exemple #3
0
 /**
  * Debug default output function, simply uses the static dump fonction
  * of this class 
  * 
  * @since V2.0.0 - 11 apr 2006
  * @see dump
  */
 public function __toString()
 {
     return '<pre>' . PHP_Debug::dumpVar($this, __CLASS__ . ' class instance', false, PHP_Debug::DUMP_STR) . '</pre>';
 }
 /**
  * Debug_Line default output function
  *
  * @since V2.0.0 - 11 apr 2006
  * @see PHP_Debug::dumpVar()
  */
 public function __toString()
 {
     return '<pre>' . PHP_Debug::dumpVar($this, __CLASS__, false, PHP_DEBUG_DUMP_ARR_STR) . '</pre>';
 }
<p>
    <a href="PHP_Debug_HTML_Div_test.php">&raquo; HTML_DIV Renderer</a><br/>
    <a href="PHP_Debug_HTML_Table_test.php">&raquo; HTML_Table Renderer</a><br/>
    <a href="PHP_Debug_test.php">&raquo; Test min</a><br/>
    <a href="PHP_Debug_Sources.php">&raquo; Show sources</a><br/>
</p>

<?php 
// Tests variables  ============================================================
// One variable that will be watched by PHP_Debug
$watchedVariable = 1;
// One session variable to test the debugtype = PHP_DebuLine::TYPE_ENV (4)
$_SESSION['Kikoo'] = 'One session variable defined';
// Debug Object creation =======================================================
$Dbg = new PHP_Debug($options);
// Test restrictAcess() function, only IP in param array will see the debug ====
//$Dbg->restrictAcess($allowedip);
// Test add() function =========================================================
// Standard
$Dbg->add("This is the <b>HTML_Table_Render</b>, client IP is " . $_SERVER['REMOTE_ADDR']);
// Standard, fix end and start time manually
$debug_line = $Dbg->add('Manual performance monitoring');
$debug_line->setStartTime();
for ($i = 0; $i < 20000; $i++) {
    $j = 0;
}
$debug_line->setEndTime();
// Test dump() function ========================================================
// dump a variable (integer)
$foo = 555;
 /**
  * HTML_Table_Config
  * 
  * @since V2.0.0 - 26 Apr 2006
  */
 public function __toString()
 {
     return '<pre>' . PHP_Debug::dumpVar($this->singleton()->getConfig(), __CLASS__, false, PHP_DEBUG_DUMP_ARR_STR) . '</pre>';
 }
Exemple #7
0
 /**
  * Show a super array
  * 
  * @param string $SuperArrayType Type of super en array to add
  * @since V2.0.0 - 07 Apr 2006
  */
 protected function showSuperArray($SuperArrayType)
 {
     // Lang
     $txtVariable = 'Var';
     $txtNoVariable = 'NO VARIABLE';
     $NoVariable = ' -- ' . $txtNoVariable . ' -- ';
     $SuperArray = null;
     $buffer = '';
     $ArrayTitle = PHP_Debug::$globalEnvConstantsCorresp[$SuperArrayType];
     $SuperArray = $GLOBALS[$ArrayTitle];
     $Title = $ArrayTitle . ' ' . $txtVariable;
     $SectionBasetitle = '<b>$Title (' . count($SuperArray) . ') :';
     if (count($SuperArray)) {
         $buffer .= $SectionBasetitle . '</b>';
         $buffer .= '<pre>' . PHP_Debug::dumpVar($SuperArray, $ArrayTitle, false, PHP_Debug::DUMP_STR) . '</pre>';
     } else {
         $buffer .= $SectionBasetitle . "{$NoVariable}</b>";
     }
     return $buffer;
 }
Exemple #8
0
 /**
  * Displays an array.
  * 
  * @param string $SuperArrayType Type of super en array to add
  * @since V2.0.0 - 07 Apr 2006
  */
 protected function showArray($array, $name)
 {
     // Lang
     $txtNoVariable = 'NO VARIABLE';
     $NoVariable = ' -- ' . $txtNoVariable . ' -- ';
     $buffer = '';
     $SectionBasetitle = '<b>' . $name . '(' . count($array) . ') :';
     if (count($array)) {
         $buffer .= $SectionBasetitle . '</b>';
         $buffer .= '<pre>' . PHP_Debug::dumpVar($array, $name, false, PHP_Debug::DUMP_STR) . '</pre>';
     } else {
         $buffer .= $SectionBasetitle . $NoVariable . '</b>';
     }
     return $buffer;
 }
Exemple #9
0
 */
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">     
  <head>  
    <title>PEAR::PHP_Debug, Hello World !</title>
<?php 
// Options array for Debug object
$options = array('HTML_DIV_images_path' => 'images', 'HTML_DIV_css_path' => 'css', 'HTML_DIV_js_path' => 'js');
/**
 * Include Debug Class
 */
include_once 'PHP/Debug.php';
// Debug object
$Dbg = new PHP_Debug($options);
?>
    <script type="text/javascript" src="<?php 
echo $options['HTML_DIV_js_path'];
?>
/html_div.js"></script>
    <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $options['HTML_DIV_css_path'];
?>
/html_div.css" />
  </head>
  <body>
  <div>
    <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a>
  </div>
<?php 
Exemple #10
0
    ob_start();
}
// FirePHP.
if ($tools['firephp']) {
    // See http://www.firephp.org/HQ/Learn.htm for more details.
    require_once 'FirePHPCore/FirePHP.class.php';
    ob_start();
}
// PHP_Debug.
if ($tools['phpdebug']) {
    // Set paths, configuration.
    $php_debug_options = array('HTML_DIV_images_path' => 'PHP_Debug/images', 'HTML_DIV_css_path' => 'PHP_Debug/css', 'HTML_DIV_js_path' => 'PHP_Debug/js', 'HTML_DIV_view_source_script_path' => 'PHP_Debug', 'replace_errorhandler' => TRUE);
    set_include_path(get_include_path() . PATH_SEPARATOR . 'PHP_Debug');
    require_once 'PHP_Debug/PHP/Debug.php';
    global $PHP_Debug;
    $PHP_Debug = new PHP_Debug($php_debug_options);
}
?>
<!doctype html>
  <!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"><![endif]-->
  <!--[if IE 7]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
  <!--[if IE 8]><html class="no-js lt-ie9" lang="en"><![endif]-->
  <!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Debugging PHP Advanced Techniques</title>
    <meta name="description" content="Debug your PHP code efficiently a variety of client and server-side tools.">
    <meta name="author" content="Jon Peck">
    <meta name="viewport" content="width=device-width">
    <?php