<?php
@package @author @since @filesource
@version $Id: PHP_Debug_HTML_Div_test.php,v 1.3 2008/08/31 19:32:50 c0il Exp $
error_reporting(E_ALL);
$options = array(
'render_type' => 'HTML',
'render_mode' => 'Div',
'restrict_access' => false,
'allow_url_access' => true,
'url_key' => 'key',
'url_pass' => 'nounou',
'enable_watch' => false,
'replace_errorhandler' => true,
'lang' => 'FR',
'HTML_DIV_view_source_script_name' => 'PHP_Debug_ShowSource.php',
'HTML_DIV_remove_templates_pattern' => true,
'HTML_DIV_templates_pattern' => array('/var/www-protected/php-debug.com' => '/var/www/php-debug'),
'HTML_DIV_images_path' => 'images',
'HTML_DIV_css_path' => 'css',
'HTML_DIV_js_path' => 'js',
);
$allowedip = array(
'127.0.0.1'
);
require_once 'PHP/Debug.php';
define('ADD_PEAR_ROOT', '/home/phpdebug/www/libs/PEAR');
set_include_path(ADD_PEAR_ROOT . PATH_SEPARATOR. get_include_path());
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" lang="en">
<head>
<title>Pear::PHP_Debug</title>
<script type="text/javascript" src="'. $options['HTML_DIV_js_path'] .'/html_div.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="'. $options['HTML_DIV_css_path'] .'/html_div.css" />
';
?>
</head>
<body>
<h1>PEAR::PHP_Debug -------------------------></h1>
<p>
<a href="PHP_Debug_HTML_Div_test.php">» HTML_DIV Renderer</a><br/>
<a href="PHP_Debug_HTML_Table_test.php">» HTML_Table Renderer</a><br/>
<a href="PHP_Debug_test.php">» Test min</a><br/>
<a href="PHP_Debug_Sources.php">» Show sources</a><br/>
</p>
<?php
$watchedVariable = 1;
$_SESSION['Kikoo'] = "One session variable defined";
$Dbg = new PHP_Debug($options);
$renderer = 'HTML_Div';
$intro = 'This is the <b>'. $renderer.'_Renderer</b>, client IP is '.
$_SERVER['REMOTE_ADDR'];
$Dbg->add($intro);
$debug_line = $Dbg->add('Manual performance monitoring');
$debug_line->setStartTime();
for ($i = 0; $i < 20000; $i++) {
$j = 0;
}
$debug_line->setEndTime();
$Dbg->addSetting($renderer, 'app_renderer_mode');
$Dbg->addSettings($options, 'app_settings');
$foo = 555;
$Dbg->dump($foo, 'Foo');
$foo2 = 37.2;
$Dbg->dump($foo2, 'Foo2');
$Dbg->dump($options, 'Options');
$testObject = new PHP_DebugLine('info info info inside DebugLine object');
$testObject = $Dbg->dump($testObject);
$action = 'view_test_action';
$Dbg->setAction($action);
function a()
{
global $Dbg, $watchedVariable;
$Dbg->addDebug('call from a() fonction');
$Dbg->stopTimer();
$watchedVariable = 501;
b();
}
function b()
{
global $Dbg, $watchedVariable;
$Dbg->add('call from b() fonction');
$watchedVariable = 502;
}
a();
$Dbg->addDebugFirst('call after b() and a() but adding in 1st');
$watchedVariable = 555;
$watchedVariable = 'converting from INT to STR';
$debug_line2 = $Dbg->add('PERF TEST : 10000 iteration');
$y = 0;
for ($index = 0; $index < 10000; $index++) {
$y = $y + $index;
}
$Dbg->stopTimer();
$Dbg->dump($debug_line2);
$Dbg->queryRel('Connecting to DATABASE [<b>phpdebug</b>] dns: root:user@mysql');
$Dbg->stopTimer();
$Dbg->query('SELECT * FROM PHP_DEBUG_USERS');
$y = 0;
for ($index = 0; $index < 10000; $index++) {
$y = $y + $index;
}
$Dbg->stopTimer();
echo $notset;
fopen('not existing!', 'r');
trigger_error('This is a custom application error !!', E_USER_ERROR);
$Dbg->error('Bad status of var x in application PHP_Debug');
$Dbg->display();
?>
</body>
</html> |