Esempio n. 1
0
    /**
     * Render a dump for the properties of an array or objeect
     *
     * @param mixed &$data
     * @access private
     * @static
     */
    function _vars(&$data)
    {
        $_is_object = is_object($data);
        // test for references in order to
        // prevent endless recursion loops
        //
        $_recursion_marker = krumo::_marker();
        $_r = $_is_object ? @$data->{$_recursion_marker} : @$data[$_recursion_marker];
        $_r = (int) $_r;
        // recursion detected
        //
        if ($_r > 0) {
            return krumo::_recursion();
        }
        // stain it
        //
        krumo::_hive($data);
        // render it
        //
        ?>
<div class="krumo-nest" style="display:none;">
	<ul class="krumo-node">
	<?php 
        // keys ?
        //
        $keys = $_is_object ? array_keys(get_object_vars($data)) : array_keys($data);
        // itterate
        //
        foreach ($keys as $k) {
            // skip marker
            //
            if ($k === $_recursion_marker) {
                continue;
            }
            // get real value
            //
            if ($_is_object) {
                $v =& $data->{$k};
            } else {
                $v =& $data[$k];
            }
            // PHP 4.x.x array reference bug...
            //
            if (is_array($data) && version_compare(PHP_VERSION, "5", "<")) {
                $GLOBALS[krumo::_marker()][] =& $v;
            }
            krumo::_dump($v, $k);
        }
        ?>
	</ul>
</div>
<?php 
    }
Esempio n. 2
0
	/**
	* Render a dump for the properties of an array or objeect
	*
	* @param mixed &$data
	* @access private
	* @static
	*/
	Private Static Function _vars(&$data) {

		$_is_object = is_object($data);
		
		// test for references in order to
		// prevent endless recursion loops
		//
		$_recursion_marker = krumo::_marker();
		$_r = ($_is_object)
			? @$data->$_recursion_marker
			: @$data[$_recursion_marker] ;
		$_r = (integer) $_r;

		// recursion detected
		//
		if ($_r > 0) {
			return krumo::_recursion();
			}

		// stain it
		//
		krumo::_hive($data);

		// render it
		//
		?>
<div class="krumo-nest" style="display:none;">
	<ul class="krumo-node">
	<?php

	// keys ?
	//
	$keys = ($_is_object)
		? array_keys(get_object_vars($data))
		: array_keys($data);
	
	// itterate 
	//
	foreach($keys as $k) {

		// skip marker
		//
		if ($k === $_recursion_marker) {
			continue;
			}
		
		// get real value
		//
		if ($_is_object) {
			$v =& $data->$k;
			} else {
			$v =& $data[$k];
			}

		krumo::_dump($v,$k);
		} ?>
	</ul>
</div>
<?php
		}
 /**
  * Render a dump for the properties of an array or objeect
  *
  * @param mixed &$data
  * @access private
  * @static
  */
 private static function _vars(&$data)
 {
     $_is_object = is_object($data);
     // test for references in order to
     // prevent endless recursion loops
     $_recursion_marker = krumo::_marker();
     if ($_is_object) {
         if (($hash = spl_object_hash($data)) && isset(self::$objectRecursionProtection[$hash])) {
             $_r = self::$objectRecursionProtection[$hash];
         } else {
             $_r = NULL;
         }
     } else {
         $_r = isset($data[$_recursion_marker]) ? $data[$_recursion_marker] : null;
     }
     // recursion detected
     if ($_r > 0) {
         return krumo::_recursion();
     }
     // stain it
     krumo::_hive($data);
     // render it
     $collapsed = krumo::_isCollapsed(self::$_level, count($data) - 1);
     if ($collapsed) {
         $collapse_style = 'style="display: none;"';
     } else {
         $collapse_style = '';
     }
     print "<div class=\"krumo-nest\" {$collapse_style}>";
     print "<ul class=\"krumo-node\">";
     // we're descending one level deeper
     self::$_level++;
     // Object?? - use Reflection
     if ($_is_object) {
         $reflection = new ReflectionObject($data);
         $properties = $reflection->getProperties();
         foreach ($properties as $property) {
             $prefix = null;
             $setAccessible = false;
             if ($property->isPrivate()) {
                 $setAccessible = true;
                 $prefix = 'private ';
             } else {
                 if ($property->isProtected()) {
                     $setAccessible = true;
                     $prefix = 'protected ';
                 } else {
                     if ($property->isPublic()) {
                         $prefix = 'public ';
                     }
                 }
             }
             $name = $property->getName();
             if ($setAccessible) {
                 $property->setAccessible(true);
             }
             $value = $property->getValue($data);
             krumo::_dump($value, $prefix . " '{$name}'");
             if ($setAccessible) {
                 $property->setAccessible(false);
             }
         }
     } else {
         // keys
         $keys = array_keys($data);
         // iterate
         foreach ($keys as $k) {
             // skip marker
             if ($k === $_recursion_marker) {
                 continue;
             }
             // get real value
             $v =& $data[$k];
             krumo::_dump($v, $k);
         }
     }
     print "</ul>\n</div>";
     self::$_level--;
 }
Esempio n. 4
0
    /**
     * Render a dump for the properties of an array or objeect
     *
     * @param mixed &$data
     * @access private
     * @static
     */
    private static function _vars(&$data)
    {
        $_is_object = is_object($data);
        if ($_is_object && get_class($data) == 'Closure' && is_callable($data)) {
            return;
        }
        // test for references in order to
        // prevent endless recursion loops
        //
        $_recursion_marker = krumo::_marker();
        $_r = $_is_object ? @$data->{$_recursion_marker} : @$data[$_recursion_marker];
        $_r = (int) $_r;
        // recursion detected
        //
        if ($_r > 0) {
            return krumo::_recursion();
        }
        // stain it
        //
        krumo::_hive($data);
        // render it
        //
        ?>
<div class="krumo-nest" style="display:none;">
	<ul class="krumo-node">
	<?php 
        // keys ?
        //
        if (is_object($data) && is_a($data, 'ArrayObject')) {
            $data = $data->getArrayCopy();
            $_is_object = false;
        }
        $keys = $_is_object ? array_keys(get_object_vars($data)) : array_keys($data);
        // itterate
        //
        foreach ($keys as $k) {
            // skip marker
            //
            if ($k === $_recursion_marker) {
                continue;
            }
            // get real value
            //
            if ($_is_object) {
                $v =& $data->{$k};
            } else {
                $v =& $data[$k];
            }
            krumo::_dump($v, $k);
        }
        ?>
	</ul>
</div>
<?php 
    }
Esempio n. 5
0
    /**
     * Render a dump for the properties of an array or objeect
     *
     * @param mixed &$data
     * @access private
     * @static
     */
    private static function _vars(&$data)
    {
        $_is_object = is_object($data);
        // test for references in order to
        // prevent endless recursion loops
        //
        $_recursion_marker = krumo::_marker();
        $_r = $_is_object ? @$data->{$_recursion_marker} : @$data[$_recursion_marker];
        $_r = (int) $_r;
        // recursion detected
        //
        if ($_r > 0) {
            return krumo::_recursion();
        }
        // stain it
        //
        krumo::_hive($data);
        // render it
        //
        $collapsed = krumo::_isCollapsed(self::$_level, count($data) - 1);
        ?>
<div class="krumo-nest"<?php 
        if ($collapsed) {
            ?>
 style="display:none;"<?php 
        }
        ?>
>
	<ul class="krumo-node">
		<?php 
        // keys ?
        //
        $keys = $_is_object ? array_keys(get_object_vars($data)) : array_keys($data);
        // we're decending one level deeper
        self::$_level++;
        // itterate
        //
        foreach ($keys as $k) {
            // skip marker
            //
            if ($k === $_recursion_marker) {
                continue;
            }
            // get real value
            //
            if ($_is_object) {
                $v =& $data->{$k};
            } else {
                $v =& $data[$k];
            }
            krumo::_dump($v, $k);
        }
        ?>
	</ul>
</div>
<?php 
        // back up one level
        self::$_level--;
    }
Esempio n. 6
0
    /**
     * Render a dump for the properties of an array or objeect
     *
     * @param mixed &$data
     * @access private
     * @static
     */
    private static function _vars(&$data)
    {
        $_is_object = is_object($data);
        // test for references in order to
        // prevent endless recursion loops
        //
        $_recursion_marker = krumo::_marker();
        if ($_is_object) {
            if (property_exists(__CLASS__, $_recursion_marker)) {
                $_r = @$data->{$_recursion_marker};
            } else {
                $_r = 0;
            }
        } else {
            if (isset($data[$_recursion_marker])) {
                $_r = @$data[$_recursion_marker];
            } else {
                $_r = 0;
            }
        }
        $_r = (int) $_r;
        // recursion detected
        //
        if ($_r > 0) {
            return krumo::_recursion();
        }
        // stain it
        //
        krumo::_hive($data);
        // render it
        //
        ?>
<div class="krumo-nest" style="display:none;">
	<ul class="krumo-node">
	<?php 
        // keys ?
        //
        $keys = $_is_object ? array_keys(get_object_vars($data)) : array_keys($data);
        // itterate
        //
        foreach ($keys as $k) {
            // skip marker
            //
            if ($k === $_recursion_marker) {
                continue;
            }
            // get real value
            //
            if ($_is_object) {
                $v =& $data->{$k};
            } else {
                $v =& $data[$k];
            }
            krumo::_dump($v, $k);
        }
        ?>
	</ul>
</div>
<?php 
    }