GithubHelp home page GithubHelp logo

kktsvetkov / krumo Goto Github PK

View Code? Open in Web Editor NEW
79.0 7.0 14.0 185 KB

Krumo: Structured information display solution for PHP

Home Page: http://krumo.kaloyan.info

License: GNU Lesser General Public License v2.1

PHP 59.84% CSS 40.16%
php debug print-r var-dump var-export php5 debugging krumo php7

krumo's Introduction

Hey, I am Kaloyan (but everyone seems to call me KT)

I am the author of Krumo, Wano, Asido and few other open-source projects which titles that end with an "o".

Kaloyan's github stats


Here are few of the things I posted on my site lately:

krumo's People

Contributors

coeur avatar kktsvetkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

krumo's Issues

Expand All / Collapse All

This has been a requested featured from the start: the ability to expand and collapse all the nodes in a Krumo report.

Instead of printing output, return it to a variable

I struggled with the idea of adding this feature when initially working on Krumo, and I decided not to include it:

I am not sure why would you need such thing... What's the benefit of doing this ? The "krumo dump" is a bunch of HTML code, so I don't see what help it would it be if ti is saved to a var - it is meant to be seen, to visualize the data you ra dumping.

Over the years I've seen more than enough places where this feature was requested, and usually this is the advice I would give:

Anyway, try output buffering - start it before calling Krumo and close it afterwards - and you will have the "krumo dump" in the buffer. Please note that the first dump also prints the references to the CSS skin, and it printes the JS code used to expand/collapse the dump nodes.

Adding such a feature is really easy with output buffering, and I am going to add it as part of the krumo class -- to make it easy for all people that need that to do it out-of-the-box instead of doing the output-buffering themselves.

Print the dumps at the end of the page

It's been a valid complain that if Krumo is called in the middle of some opened HTML tag, that will break the output of both that tag and Krumo itself. This is from SourceForge.net comments:

For example when you are generating an image and need to evaluate something, you can't simply output it to the screen.

https://sourceforge.net/p/krumo/discussion/686810/thread/74217e3b/

One solution (that I already use in Wano) is to use register_shutdown_function() to dump the krumo output at the end of the output.

PHP 7.2 - count(): Parameter must be an array or an object that implements Countable

I'm getting this error on a new install of PHP 7.2. I'm getting it in phpmyadmin as well just fyi:

Warning: count(): Parameter must be an array or an object that implements Countable in var/www/html/iconcierge/shared/krumo/class.krumo.php on line 1132
Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/iconcierge/shared/krumo/class.krumo.php on line 1133
Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/iconcierge/shared/krumo/class.krumo.php on line 1146

it is coming from this block of code:

/**
* Render a dump for an object
*
* @param mixed $data
* @param string $name
*/
private static function _object(&$data, $name)
{
	?>
	<li class="krumo-child">

		<div <?php if (count($data) > 0) {?> onClick="krumo.toggle(this);"<?php } ?>
			class="krumo-element<?php echo count($data) > 0 ? ' krumo-expand' : '';?>" >

				<a class="krumo-name"><?php echo $name;?></a>
				(<em class="krumo-type">Object</em>)
				<strong class="krumo-class"><?php echo get_class($data);?></strong>
            <?php
                if( get_class( $data ) == 'Image' ){
                    echo '<img class=img-thumbnail src="' . $data->urlSecure . '" />';
                }
            ?>
            
		</div>

		<?php if (count($data))
		{
			self::_vars($data);
            
        
		} ?>
	</li>
	<?php
}

Namely the two calls to count($data).

Casting $data to an array causes more bugs. Ideas?

Only prints public methods and variables

This is exactly what I was looking for but was disappointed that it only prints public members of an object.. print_r and var_dump print the whole object. For instanced a dump of the Order object

krumo($this);
echo "<pre>";
print_r($this);	

Results in an empty set in krumo, but it's far from empty.

image

Drop krumo.ini

The krumo.ini configuration is a remnant from the PHP4 days. It was created as a configuration solution that will operate the selection of the CSS skin and the URL used for the images in the stylesheets.

As of ed1a544 the external images for the stylesheets have been converted into "data-URI" statements. This made the %url% stylesheet hack useless, as well as the "[css] url=..." section of krumo.ini

Now what is left in krumo.ini is only the "[skin] selected=..." which points to what the selected skin is. This can be easily set by a static class property, e.g. krumo::$skin = 'blue';, and with that having krumo.ini is pointless.

Dropping krumo.ini will reduce the configuration hassle and the footprint of the library.

Message: count(): Parameter must be an array or an object that implements Countable

`<?php
defined('BASEPATH') or exit('No direct script access allowed');

class Login extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('login_m');
$this->load->library('template_login');
}

public function index()
{
    $this->template_login->display('admin/login_v');
}

public function validasi()
{
    $this->form_validation->set_rules('username', 'Username', 'trim|required');
    $this->form_validation->set_rules('password', 'Password', 'trim|required');

    if ($this->form_validation->run() == false) {
        $this->template_login->display('admin/login_v');
    } else {
        $username  = stripHTMLtags(trim($this->input->post('username', 'true')));
        $password  = stripHTMLtags(trim($this->input->post('password', 'true')));
        $temp_user = $this->login_m->get_user($username)->row();
        $num_user  = count($temp_user);
        if ($num_user == 0) {
            $this->session->set_flashdata('notification', '<b>Username Anda Tidak Terdaftar.</b>');
            redirect(site_url('login'));
        } elseif ($num_user > 0) {
            $temp_account = $this->login_m->check_user_account($username, sha1($password))->row();
            $num_account  = count($temp_account);
            if ($num_account > 0) {
                $array_item = array(
                    'username'        => trim($temp_account->user_username),
                    'pass'            => $temp_account->user_password,
                    'nama'            => strtoupper(trim($temp_account->user_name)),
                    'avatar'          => $temp_account->user_avatar,
                    'level'           => $temp_account->user_level,
                    'logged_in_resto' => true,
                );

                $this->session->set_userdata($array_item);

                if ($this->session->userdata('level') == 'Admin') {
                    redirect(site_url('admin/home'));
                } elseif($this->session->userdata('level') == 'Kasir') {
                    redirect(site_url('operator/home'));
                }
                elseif($this->session->userdata('level') == 'Pelanggan') {
                    redirect(site_url('front/'));
                }
            } else {
                $this->session->set_flashdata('notification', '<b>Username atau Password Anda Salah.</b>');
                redirect(site_url('login'));
            }
        }
    }
}

public function logout()
{
    $this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . 'GMT');
    $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
    $this->output->set_header('Pragma: no-chace');
    $this->session->sess_destroy();
    redirect(base_url());
}

}

/* Location: ./application/controller/Login.php */
`

count(): Parameter must be an array or an object that implements Countable

I'm getting the following error in PHP 7.2:

Warning: count(): Parameter must be an array or an object that implements Countable in krumo::_object() (line 1156 of backdrop/modules/contrib/devel/lib/krumo/class.krumo.php).

The problem is this bit of code, as it assumes $data is either an array or Countable:

<div class="krumo-element<?php echo count($data) > 0 ? ' krumo-expand' : '';?>">

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.