public function dump(&$thevariable, $thehtmlflag = null)
 {
     if ($thehtmlflag === null) {
         if (empty($this)) {
             $thehtmlflag = !empty($_SERVER['DOCUMENT_ROOT']);
         } else {
             if (is_subclass_of($this, "sdd")) {
                 $thehtmlflag = $this->m_htmlflag;
             } else {
                 $thehtmlflag = !empty($_SERVER['DOCUMENT_ROOT']);
             }
         }
     }
     switch (gettype($thevariable)) {
         case 'array':
             return SDD::dArray($thevariable, $thehtmlflag);
         case 'object':
             return SDD::dObject($thevariable, $thehtmlflag);
         default:
             return SDD::scalar($thevariable, $thehtmlflag);
     }
 }
 /**
  * @desc Debugging output interface.
  * @access public
  * @param mixed $theValue The "thing" to be pretty printed.
  * @param boolean $theHTMLFlag True if the output will be seen in a browser, false otherwise.
  */
 public function print_d(&$thevalue, $thehtmlflag = true)
 {
     print SDD::dump($thevalue, $thehtmlflag);
 }
 /**
  * @desc Debugging output interface.
  * @access public
  * @param mixed $theValue The "thing" to be pretty printed.
  * @param boolean $theHTMLFlag True if the output will be seen in a browser, false otherwise.
  */
 function print_d(&$theValue, $theHTMLFlag = true)
 {
     print SDD::dump($theValue, $theHTMLFlag);
 }
 /**
  * Dump the contents of an object.
  *
  * Provide a structured display of an object and all the
  * classes from which it was derived.  The contents of
  * the object is displayed from most derived to the base
  * class, in order.
  *
  * @param object $theObject the object to be dumped.
  * @param boolean $theHTMLFlag true if HTML is to be generated.
  * @return string the display form of the object.
  */
 function dObject(&$theObject, $theHTMLFlag)
 {
     $theObjectVars = get_object_vars($theObject);
     //
     // Get the inheritance tree starting with the object and going
     // through all the parent classes from there.
     //
     $theClass = get_class($theObject);
     $theClasses[] = $theClass;
     while ($theClass = get_parent_class($theClass)) {
         $theClasses[] = $theClass;
     }
     //
     // Get all the class variables for each class in the inheritance
     // tree.  There will be some duplication, but we'll sort that out
     // in the output process.
     //
     foreach ($theClasses as $theClass) {
         $theClassVars[$theClass] = get_class_vars($theClass);
     }
     //
     // Put the inheritance tree from base class to most derived order
     // (this is how we get rid of duplication of the variable names)
     // Go through the object variables starting with the base class,
     // capture the output and delete the variable from the object
     // variables.
     //
     $theClasses = array_reverse($theClasses);
     $theOutput = array();
     foreach ($theClasses as $theClass) {
         $theOutput[$theClass] = array();
         foreach ($theClassVars[$theClass] as $theVariable => $value) {
             if (array_key_exists($theVariable, $theObjectVars)) {
                 if (is_array($theObjectVars[$theVariable])) {
                     $theOutput[$theClass][] = $theVariable . " = " . SDD::dArray($theObjectVars[$theVariable], $theHTMLFlag);
                 } else {
                     if (is_object($theObjectVars[$theVariable])) {
                         $theOutput[$theClass][] = $theVariable . " = " . SDD::dObject($theObjectVars[$theVariable], $theHTMLFlag);
                     } else {
                         $theOutput[$theClass][] = $theVariable . " = " . ($theHTMLFlag ? preg_replace('|<|s', '&lt;', var_export($theObjectVars[$theVariable], true)) : var_export($theObjectVars[$theVariable], true));
                     }
                 }
                 unset($theObjectVars[$theVariable]);
             }
         }
     }
     //
     // Put the classes back in most derived order for generating printable
     // output.
     //
     $theClasses = array_reverse($theClasses);
     if ($theHTMLFlag) {
         $theString = "<table>\n<thead>\n";
         foreach ($theClasses as $theClass) {
             $theString .= "<th>\n{$theClass}\n</th>\n";
         }
         $theString .= "</thead>\n<tr valign=top>\n";
         foreach ($theClasses as $theClass) {
             $theString .= "<td>\n<table border=1>\n";
             foreach ($theOutput[$theClass] as $theVariableOutput) {
                 $theString .= "<tr>\n<td>\n{$theVariableOutput}\n</td>\n</tr>\n";
             }
             $theString .= "</table>\n</td>\n";
         }
         $theString .= "</tr>\n</table>\n";
     } else {
         $classIndent = "";
         $classDataIndent = "    ";
         $theString = "";
         foreach ($theClasses as $theClass) {
             $theString .= "{$classIndent}class {$theClass}\n\n";
             foreach ($theOutput[$theClass] as $theVariableOutput) {
                 $theString .= "{$classDataIndent}{$theVariableOutput}\n";
             }
             $theString .= "\n";
             $classIndent .= "    ";
             $classDataIndent .= "    ";
         }
     }
     return $theString;
 }
Example #5
0
<?php

include_once 'SDD/class.SDD.php';
echo SDD::dump($_POST);