mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-05-04 13:57:55 +02:00
refactored demo folder
This commit is contained in:
parent
92bb734486
commit
7bd1a6f87f
@ -1,8 +1,39 @@
|
||||
<?php
|
||||
|
||||
include '../tests/bootstrap.php';
|
||||
include __DIR__ . '/../tests/bootstrap.php';
|
||||
|
||||
use DebugBar\StandardDebugBar;
|
||||
|
||||
$debugbar = new StandardDebugBar();
|
||||
$debugbarRenderer = $debugbar->getJavascriptRenderer()->setBaseUrl('../src/DebugBar/Resources');
|
||||
|
||||
function render_demo_page(Closure $callback = null)
|
||||
{
|
||||
global $debugbarRenderer;
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $debugbarRenderer->renderHead() ?>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.ajax').click(function() {
|
||||
var container = $(this).parent().html('...');
|
||||
$.get(this.href, function(data) {
|
||||
container.html(data);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>DebugBar Demo</h1>
|
||||
<p>DebugBar at the bottom of the page</p>
|
||||
<?php if ($callback) $callback(); ?>
|
||||
<?php
|
||||
echo $debugbarRenderer->render();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
include 'bootstrap.php';
|
||||
|
||||
$debugbar['messages']->addMessage('hello');
|
||||
|
||||
$debugbar['time']->startMeasure('op1', 'sleep 500');
|
||||
usleep(300);
|
||||
$debugbar['time']->startMeasure('op2', 'sleep 400');
|
||||
usleep(200);
|
||||
$debugbar['time']->stopMeasure('op1');
|
||||
usleep(200);
|
||||
$debugbar['time']->stopMeasure('op2');
|
||||
|
||||
$debugbar['messages']->addMessage('world', 'warning');
|
||||
$debugbar['messages']->addMessage(array('toto' => array('titi', 'tata')));
|
||||
$debugbar['messages']->addMessage('oups', 'error');
|
||||
|
||||
$debugbar['time']->startMeasure('render');
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $debugbarRenderer->renderHead() ?>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.ajax').click(function() {
|
||||
var container = $(this).parent().html('...');
|
||||
$.get(this.href, function(data) {
|
||||
container.html(data);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p>PhpDebugBar Demo</p>
|
||||
<p><a href="demo_ajax.php" class="ajax">load ajax content</a></p>
|
||||
<p><a href="demo_ajax_exception.php" class="ajax">load ajax content with exception</a></p>
|
||||
<?php
|
||||
usleep(100);
|
||||
echo $debugbarRenderer->render();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
33
demo/index.php
Normal file
33
demo/index.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
include 'bootstrap.php';
|
||||
|
||||
$debugbar['messages']->addMessage('hello');
|
||||
|
||||
$debugbar['time']->startMeasure('op1', 'sleep 500');
|
||||
usleep(300);
|
||||
$debugbar['time']->startMeasure('op2', 'sleep 400');
|
||||
usleep(200);
|
||||
$debugbar['time']->stopMeasure('op1');
|
||||
usleep(200);
|
||||
$debugbar['time']->stopMeasure('op2');
|
||||
|
||||
$debugbar['messages']->addMessage('world', 'warning');
|
||||
$debugbar['messages']->addMessage(array('toto' => array('titi', 'tata')));
|
||||
$debugbar['messages']->addMessage('oups', 'error');
|
||||
|
||||
$debugbar['time']->startMeasure('render');
|
||||
|
||||
render_demo_page(function() {
|
||||
?>
|
||||
<h2>AJAX</h2>
|
||||
<ul>
|
||||
<li><a href="ajax.php" class="ajax">load ajax content</a></li>
|
||||
<li><a href="ajax_exception.php" class="ajax">load ajax content with exception</a></li>
|
||||
</ul>
|
||||
<h2>PDO</h2>
|
||||
<ul>
|
||||
<li><a href="pdo.php">PDO demo</a></li>
|
||||
</ul>
|
||||
<?php
|
||||
});
|
@ -20,15 +20,4 @@ $foo = $stmt->fetch();
|
||||
|
||||
$pdo->exec('delete from titi');
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $debugbarRenderer->renderHead() ?>
|
||||
</head>
|
||||
<body>
|
||||
<p>PhpDebugBar PDO Demo</p>
|
||||
<?php
|
||||
echo $debugbarRenderer->render();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
render_demo_page();
|
Loading…
x
Reference in New Issue
Block a user