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

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

			<a class="krumo-name"><?php 
        echo $name;
        ?>
</a>
			(<em class="krumo-type">Object</em>) 
			<strong class="krumo-class"><?php 
        echo get_class($data);
        ?>
</strong>
	</div>

	<?php 
        if (count($data)) {
            krumo::_vars($data);
        }
        ?>
</li>
<?php 
    }
示例#2
0
    /**
     * Render a dump for an object
     *
     * @param mixed $data
     * @param string $name
     * @access private
     * @static
     */
    private static function _object(&$data, $name)
    {
        $childCount = count($data);
        $collapsed = krumo::_isCollapsed(self::$_level, count($data));
        $elementClasses = $childCount > 0 ? $collapsed ? ' krumo-expand' : ' krumo-expand krumo-opened' : '';
        ?>
<li class="krumo-child">
	<div class="krumo-element<?php 
        echo $elementClasses;
        ?>
"
		<?php 
        if ($childCount > 0) {
            ?>
 onClick="krumo.toggle(this);"<?php 
        }
        ?>
		onMouseOver="krumo.over(this);"
		onMouseOut="krumo.out(this);">

			<a class="krumo-name"><?php 
        echo $name;
        ?>
</a>
			(<em class="krumo-type">Object</em>) 
			<strong class="krumo-class"><?php 
        echo get_class($data);
        ?>
</strong>
	</div>

	<?php 
        if (count($data)) {
            krumo::_vars($data);
        }
        ?>
</li>
<?php 
    }
 /**
  * Render a dump for an object
  *
  * @param mixed $data
  * @param string $name
  * @access private
  * @static
  */
 private static function _object(&$data, $name)
 {
     $reflection = new ReflectionObject($data);
     $properties = $reflection->getProperties();
     $childCount = count($properties);
     $collapsed = krumo::_isCollapsed(self::$_level, $childCount);
     // Setup the CSS classes depending on how many children there are
     if ($childCount > 0 && $collapsed) {
         $elementClasses = ' krumo-expand';
     } elseif ($childCount > 0) {
         $elementClasses = ' krumo-expand krumo-opened';
     } else {
         $elementClasses = '';
     }
     print "<li class=\"krumo-child\"> <div class=\"krumo-element {$elementClasses}\"";
     if (count($data) > 0) {
         print 'onClick="krumo.toggle(this);"';
     }
     print 'onMouseOver="krumo.over(this);" onMouseOut="krumo.out(this);">';
     $empty_str = '';
     if ($childCount == 0) {
         $empty_str = ' (empty)';
     }
     print "<a class=\"krumo-name\">{$name}</a> (<em class=\"krumo-type\">Object</em>) ";
     print "<strong class=\"krumo-class\">" . get_class($data) . "</strong>{$empty_str}</div>";
     if ($properties) {
         krumo::_vars($data);
     }
     print "</li>";
 }
示例#4
0
    /**
     * Render a dump for an array
     *
     * @param mixed $data
     * @param string $name
     * @access private
     * @static
     */
    private static function _array(&$data, $name)
    {
        ?>
        <li class="krumo-child">

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

                <a class="krumo-name"><?php 
        echo $name;
        ?>
</a>
                (<em class="krumo-type">Array, <strong class="krumo-array-length"><?php 
        echo count($data) == 1 ? "1 element" : count($data) . " elements";
        ?>
</strong></em>)


                <?php 
        // callback ?
        //
        if (is_callable($data)) {
            $_ = array_values($data);
            ?>
                    <span class="krumo-callback"> |
					(<em class="krumo-type">Callback</em>)
					<strong class="krumo-string"><?php 
            echo htmlSpecialChars($_[0]);
            ?>
::<?php 
            echo htmlSpecialChars($_[1]);
            ?>
();</strong></span>
                    <?php 
        }
        ?>

            </div>

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