Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scottchiefbaker/krumo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.6.1
Choose a base ref
...
head repository: scottchiefbaker/krumo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 15 commits
  • 5 files changed
  • 5 contributors

Commits on Mar 12, 2021

  1. Copy the full SHA
    07940f9 View commit details

Commits on Apr 19, 2022

  1. Copy the full SHA
    a5c6679 View commit details
  2. remove javascript warning when clicking on leaf element (mmucklo#61)

    * remove javascript warning when clicking on leaf element
    
    when clicking on leaf element, there is a javacript warning
      Uncaught TypeError: n is null
    
    * update minifying url
    
    javascript-minifier.com redirect to https://www.toptal.com/developers/javascript-minifier/
    and war that API endpoint has changed
    
    * move variable declaration
    
    * forgot the minified version
    
    Co-authored-by: Shadow Walker <shad@abaddon.sephiroth>
    shadowwa and Shadow Walker authored Apr 19, 2022
    Copy the full SHA
    b0b237d View commit details

Commits on Jun 1, 2022

  1. Fix an error with newer PHP versions erroring on date() calls

    This solves: Uncaught TypeError: date(): Argument mmucklo#2 ($timestamp) must be of type ?int, string given in ...
    
    You can recreate this error with the following code:
    
    ```
    $x = [ 'query_time' => '123456789 ms', 'query_time2' => 123456789 ];
    k($x);
    ```
    scottchiefbaker committed Jun 1, 2022
    Copy the full SHA
    d2060a4 View commit details

Commits on Jun 10, 2022

  1. Fix an error with newer PHP versions erroring on date() calls (mmuckl…

    …o#63)
    
    This solves: Uncaught TypeError: date(): Argument mmucklo#2 ($timestamp) must be of type ?int, string given in ...
    
    You can recreate this error with the following code:
    
    ```
    $x = [ 'query_time' => '123456789 ms', 'query_time2' => 123456789 ];
    k($x);
    ```
    scottchiefbaker authored Jun 10, 2022
    Copy the full SHA
    705561b View commit details

Commits on Aug 1, 2022

  1. Fix deprecation message appearing in CLI context with PHP 8.1 (mmuckl…

    …o#65)
    
    * fixed deprecation appearing in CLI context with PHP 8.1
    
    * increased minimum PHP version to 7.0
    driehle authored Aug 1, 2022
    Copy the full SHA
    a513a50 View commit details
  2. Fix deprecated message appearing in web context with PHP 8.1 (mmucklo#64

    )
    
    * fix deprecated message appearing in web context with PHP 8.1
    
    * use to PHP7-syntax
    driehle authored Aug 1, 2022
    Copy the full SHA
    c2972cc View commit details
  3. Copy the full SHA
    1dfc2be View commit details
  4. Copy the full SHA
    d3c0831 View commit details
  5. Copy the full SHA
    ed8e980 View commit details

Commits on Aug 7, 2022

  1. Copy the full SHA
    29a6fad View commit details

Commits on Jul 18, 2023

  1. Copy the full SHA
    0052ffd View commit details

Commits on Nov 8, 2023

  1. Copy the full SHA
    343e7c7 View commit details

Commits on Apr 15, 2024

  1. Copy the full SHA
    2745a72 View commit details

Commits on Aug 14, 2024

  1. Bump version number

    scottchiefbaker committed Aug 14, 2024
    Copy the full SHA
    c8c4c70 View commit details
Showing with 32 additions and 13 deletions.
  1. +9 −0 README.md
  2. +15 −10 class.krumo.php
  3. +1 −1 composer.json
  4. +6 −1 js/krumo.js
  5. +1 −1 js/krumo.min.js
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -56,6 +56,15 @@ $krumo = new Krumo;
$krumo->dump($arr);
```

Options:
--------
These options can be passed as the *second* argument to Krumo to alter behavior:

* `KRUMO_RETURN` - return the Krumo output instead of printing it
* `KRUMO_EXPAND_ALL` - start Krumo with all nodes expanded
* `KRUMO_SORT` - sort arrays before displaying (note: overrides config)
* `KRUMO_NO_SORT` - do **not** sort arrays before displaying (note: overrides config)

Configuration:
--------------

25 changes: 15 additions & 10 deletions class.krumo.php
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@
*/
class Krumo
{
const VERSION = '0.6.1';
const VERSION = '0.7.1';

/**
* Return Krumo version
@@ -499,8 +499,12 @@ public static function dump($data, $second = '')
$_ = debug_backtrace();
while ($d = array_pop($_)) {
$callback = static::$lineNumberTestCallback;
$function = strToLower($d['function']);
if (in_array($function, array("krumo","k","kd")) || (strToLower(@$d['class']) == 'krumo') || (is_callable($callback) && call_user_func($callback, $d))) {

$class = strtolower($d['class'] ?? '');
$function = strtolower($d['function'] ?? '');
$is_krumo_func = in_array($function, array('krumo','k','kd'));

if ($is_krumo_func || $class == 'krumo' || (is_callable($callback) && call_user_func($callback, $d))) {
break;
}
}
@@ -1421,10 +1425,11 @@ private static function plural($number, $word)
}
}

private static function is_datetime($name, $value)
{
private static function is_datetime($name, $value) {
$value = intval($value);

// If the name contains date or time, and the value looks like a unixtime
if (preg_match("/date|time/i", $name) && ($value > 10000000 && $value < 4000000000)) {
if (preg_match("/date|time/i", $name) && (is_numeric($value) && $value > 10000000 && $value < 4000000000)) {
$ret = date("r", $value);

return $ret;
@@ -1501,7 +1506,7 @@ private static function _string($data, $name)

// Check for and highlight any leading or trailing spaces/tabs
if (preg_match("/^([ \t]+)|([ \t]+)$/", $data)) {
$has_leading = preg_match("/^([ \t]s+)/", $data);
$has_leading = preg_match("/^([ \t]+)/", $data);
$has_trailing = preg_match("/([ \t]+)$/", $data);

if ($has_leading && $has_trailing) {
@@ -1515,8 +1520,8 @@ private static function _string($data, $name)
}

$icon = static::get_icon("information", $title);
$_ = preg_replace_callback( "/^([ \t]+)/", "static::convert_whitespace", $_);
$_ = preg_replace_callback( "/([ \t]+)$/", "static::convert_whitespace", $_);
$_ = preg_replace_callback( "/^([ \t]+)/", "Krumo::convert_whitespace", $_);
$_ = preg_replace_callback( "/([ \t]+)$/", "Krumo::convert_whitespace", $_);
}

// Convert all the \r or \n to visible paragraph markers
@@ -1607,7 +1612,7 @@ private static function cli_dump() {
}

foreach ($args as $i) {
$out = var_export($i);
$out = var_export($i) ?? '';
print trim($out);

if (sizeof($args) >= 1) {
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
}
],
"require": {
"php": ">=5.2.17"
"php": ">=7.0"
},
"require-dev": {
"fabpot/php-cs-fixer": "dev-master",
7 changes: 6 additions & 1 deletion js/krumo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Command to generate minified JS:
// curl -X POST -s --data-urlencode 'input@krumo.js' https://javascript-minifier.com/raw
// curl -X POST -s --data-urlencode 'input@js/krumo.js' https://www.toptal.com/developers/javascript-minifier/api/raw > js/krumo.min.js

/**
* JavaScript routines for Krumo
@@ -55,6 +55,11 @@ krumo.unclass = function(el, className) {
krumo.toggle = function(event) {
var elem = event.target.closest(".krumo-expand");
var ctrl = event.ctrlKey;

if (elem === null) {
event.stopPropagation();
return;
}
var is_expanded = !elem.classList.contains("krumo-opened");

// Adding a control to you click does an expand/collapse all
2 changes: 1 addition & 1 deletion js/krumo.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.