Skip to content

Instantly share code, notes, and snippets.



Last active Mar 30, 2016
What would you like to do?
Un debug bar partial para KumbiaPHP
class _
static function r($x='')
if ( is_bool($x) )
if ($x === TRUE) $x = 'TRUE';
else if ($x === FALSE) $x = 'FALSE';
return '<pre>' . print_r($x, 1) . '</pre>';
static function e($x='') { echo self::r($x); }
static function d($x='') { die( self::r($x) ); }

Funciona y se puede montar sin el fw materialize, pero actualmete como yo lo uso, muestro como quedaría el template:

        <?php Css::add('materialize'); ?>
        <?php Css::add('material-icons'); ?>
        <?php Css::add('bar'); ?>
        <?php echo Css::inc(); ?>
        <?php View::partial('bar'); ?>
        <?php echo Js::inc(); ?>
.bar .buttons
z-index: 2000;
.bar .toggle
background: white;
color: black;
height: 100%;
left: 0;
opacity: 0.95;
overflow: auto;
padding: 25px;
position: fixed;
top: 0;
width: 100%;
z-index: 1100;
$('body').on('click', '.toggle-to', function()
var to = $(this).data('to');
$('body').on('click', '.hide-toggle', function()
$('.bar .toggle').addClass('hide');;
<?php Css::add('bar'); ?>
<?php Js::add('bar'); ?>
<div class="bar">
<div class="buttons fixed-action-btn horizontal click-to-toggle" style="bottom: 25px; right: 25px;">
<a class="btn-floating btn-large light-green accent-4 hide-toggle tooltipped" data-delay="500" data-position="top" data-tooltip="DEBUG">
<i class="large material-icons">bug_report</i>
<li><a class="btn-floating red darken-1 toggle-to tooltipped" data-delay="500" data-position="top" data-tooltip="INFO" data-to=".info"><i class="material-icons">visibility</i></a></li>
<li><a class="btn-floating blue darken-1 toggle-to tooltipped" data-delay="500" data-position="top" data-tooltip="VARS" data-to=".vars"><i class="material-icons">visibility</i></a></li>
<li><a class="btn-floating green darken-1 toggle-to tooltipped" data-delay="500" data-position="top" data-tooltip="FILES" data-to=".files"><i class="material-icons">visibility</i></a></li>
<li><a class="btn-floating yellow darken-1 toggle-to tooltipped" data-delay="500" data-position="top" data-tooltip="CONFIG" data-to=".config"><i class="material-icons">visibility</i></a></li>
<li><a class="btn-floating orange darken-1 toggle-to tooltipped" data-delay="500" data-position="top" data-tooltip="CONTROLLER" data-to=".controller"><i class="material-icons">visibility</i></a></li>
<div class="info hide toggle">
<p>KumbiaPHP version: <?=kumbia_version(); ?></p>
<p>PHP version: <?=PHP_VERSION?></p>
<p>HTTP RESPONSE CODE: <?=http_response_code(); ?></p>
<p>Time: <?=round((microtime(1)-START_TIME)*1000,4); ?> ms</p>
<p>Memory usage: <?=number_format(memory_get_usage()/1048576,2); ?> Mb</p>
<p>Max. Memory PHP: <?=ini_get('memory_limit'); ?> Mb</p>
<div class="vars hide toggle">
<?php _::e($_GET); ?>
<?php _::e($_POST); ?>
<?php _::e($_SESSION); ?>
<div class="files hide toggle">
<?php _::e(get_included_files()); ?>
<div class="config hide toggle">
<?php _::e( Config::getAll() ); ?>
<div class="controller hide toggle">
<?php _::e( View::getVar() ); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment