+++ /dev/null
-<?php\r
-/**\r
-* Common base class of all phpdoc classes\r
-*\r
-* As a kind of common base class PhpdocObject holds \r
-* configuration values (e.g. error handling) and debugging\r
-* methods (e.g. introspection()). It does not have a constructor,\r
-* so you can always inheritig Phpdoc classes from this \r
-* class without any trouble.\r
-* \r
-* @author Ulf Wendel <ulf.wendel@phpdoc.de>\r
-* @version $Id: PhpdocObject.php,v 1.2 2000/12/03 20:30:42 uw Exp $\r
-* @package PHPDoc\r
-*/\r
-class PhpdocObject {\r
-\r
- /** \r
- * Variable containing the latest exceptions.\r
- *\r
- * The way PHPDoc handles errors is a little different from the\r
- * official PEAR way. PHPDoc methods do not return \r
- * error objects but save them to the class variable $err and try\r
- * to return a value that indicates that an error occured.\r
- *\r
- * @var array\r
- * @access public\r
- */\r
- var $err = array();\r
-\r
- /**\r
- * Default applicationname for the generated HTML files.\r
- * \r
- * @var string \r
- */\r
- var $application = "PHPDoc";\r
- \r
- /**\r
- * Use to save warnings.\r
- * \r
- * @var array\r
- */\r
- var $warn;\r
- \r
- /**\r
- * Flag determining wheter to print some status messages or not (default: false)\r
- *\r
- * @var boolean $flag_output\r
- * @see setFlagOutput()\r
- * @since 0.3\r
- */\r
- var $flag_output = false;\r
-\r
- /**\r
- * Sets the output flag - if set to true out() and outl() print messages\r
- *\r
- * @param boolean $flagOutput\r
- * @access public\r
- * @see $flag_output, out(), outl()\r
- * @since 0.3 \r
- */\r
- function setFlagOutput($flagOutput) {\r
- $this->flag_output = ($flagOutput) ? true : false;\r
- } // end func setFlagOutput\r
- \r
- /**\r
- * Print a string and flushes the output buffer\r
- * @param string $message\r
- */\r
- function out($message) {\r
- if (false == $this->flag_output)\r
- return;\r
- \r
- print $message;\r
- flush();\r
- } // end func out\r
- \r
- /**\r
- * Encodes an element name so that it can be used as a file name.\r
- * @param string element name\r
- * @return string url name\r
- */\r
- function nameToUrl($name) {\r
- return preg_replace("@[\s\./\\:]@", "_", $name);\r
- } // end func nameToUrl\r
-\r
- \r
- /**\r
- * Print a string, the specified HTML line break sign and flushes the output buffer\r
- * @param string $message\r
- */\r
- function outl($message) {\r
- if (false == $this->flag_output) \r
- return;\r
- \r
- print "$message\n";\r
- flush();\r
- } // end func outl\r
- \r
- /**\r
- * Dumps objects and arrays.\r
- * \r
- * Use this function to get an idea of the internal datastructures used. \r
- * The function dumps arrays and objects. It renders the content in \r
- * an HTML table. Play with it, you'll see it's very helpful\r
- * for debugging.\r
- * \r
- * @param string $title Optional title used in the HTML Table\r
- * @param mixed $data Optional array or object that you want to dump. \r
- * Fallback to $this.\r
- * @param boolean $userfunction Optional flag. If set to false userfunction\r
- * in an object are not shown (default). If set to \r
- * true, userfunctions are rendered\r
- *\r
- * @access public\r
- * @version 0.2\r
- */\r
- function introspection($title="", $data = "", $userfunction = true) {\r
- \r
- if (""==$data)\r
- $data = $this;\r
- \r
- printf('<table border="1" cellspacing="4" cellpadding="4" bordercolor="Silver">%s',\r
- $this->CR_HTML\r
- ); \r
- \r
- if (""!=$title)\r
- printf('<tr>%s<td colspan=4><b>%s</b></td>%s</tr>%s', \r
- $this->CR_HTML,\r
- $title,\r
- $this->CR_HTML,\r
- $this->CR_HTML\r
- );\r
- \r
- reset($data);\r
- while (list($k, $v)=each($data)) {\r
- \r
- if ("user function"==gettype($v) && !$userfunction) \r
- continue;\r
- \r
- if (is_array($v) || is_object($v)) {\r
- \r
- \r
- $color="navy";\r
- \r
- printf('<tr>\r
- <td align="left" valign="top">\r
- <font color="%s"><pre><b>%s</b></pre></font>\r
- </td>\r
- <td align="left" valign="top"><font color="%s"><pre>=></pre></font></td>\r
- <td align="left" valign="top" colspan=2>',\r
- $color,\r
- $k,\r
- $color,\r
- str_replace("<", "<", $v)\r
- );\r
- \r
- $this->introspection("", $v, $userfunction);\r
- \r
- printf('</td>%s</tr>%s', $this->CR_HTML, $this->CR_HTML);\r
- \r
- } else {\r
- \r
- $color="black";\r
- \r
- printf('<tr>\r
- <td align="left" valign="top">\r
- <font color="%s"><pre><b>%s</b></pre></font>\r
- </td>\r
- <td align="left" valign="top"><pre><font color="%s">=></pre></font></td>\r
- <td align="left" valign="top"><pre><font color="%s">[%s]</font></pre></td>\r
- <td align="left" valign="top"><pre><font color="%s">"%s"</font></pre></td>\r
- </tr>',\r
- $color,\r
- $k,\r
- $color,\r
- $color,\r
- gettype($v),\r
- $color,\r
- str_replace("<", "<", $v)\r
- );\r
- }\r
- }\r
- print '</table>'.$this->CR_HTML;\r
- } // end func introspection\r
- \r
-} // end class PhpdocObject\r
-?>
\ No newline at end of file