uw Sun Feb 18 08:29:22 2001 EDT
Modified files:
/php4/pear/PHPDoc/renderer PhpdocRendererObject.php
/php4/pear/PHPDoc/renderer/html PhpdocHTMLClassRenderer.php
PhpdocHTMLDocumentRenderer.php
PhpdocHTMLIndexRenderer.php
PhpdocHTMLModuleRenderer.php
PhpdocHTMLRenderer.php
PhpdocHTMLRendererManager.php
PhpdocHTMLWarningRenderer.php
Log:
Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs
with spaces.
Index: php4/pear/PHPDoc/renderer/PhpdocRendererObject.php
diff -u php4/pear/PHPDoc/renderer/PhpdocRendererObject.php:1.3
php4/pear/PHPDoc/renderer/PhpdocRendererObject.php:1.4
--- php4/pear/PHPDoc/renderer/PhpdocRendererObject.php:1.3 Sun Dec 3 06:36:00
2000
+++ php4/pear/PHPDoc/renderer/PhpdocRendererObject.php Sun Feb 18 08:29:20 2001
@@ -4,18 +4,19 @@
*
* Derive all custom renderer from this class.
*
+* @version $Id: PhpdocRendererObject.php,v 1.4 2001/02/18 16:29:20 uw Exp $
*/
class PhpdocRendererObject extends PhpdocObject {
- var $warn;
+ var $warn;
- var $accessor;
+ var $accessor;
- /**
- * Extension for generated files.
- * @var string $file_extension
- */
- var $file_extension = ".html";
+ /**
+ * Extension for generated files.
+ * @var string
+ */
+ var $file_extension = ".html";
} // end class PhpdocRendererObject
?>
Index: php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php
diff -u php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php:1.4
php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php:1.5
--- php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php:1.4 Sun Dec 3
14:37:37 2000
+++ php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php Sun Feb 18 08:29:21
+2001
@@ -2,391 +2,388 @@
/**
* Renders classes.
*
-* @version $Id: PhpdocHTMLClassRenderer.php,v 1.4 2000/12/03 22:37:37 uw Exp $
+* @version $Id: PhpdocHTMLClassRenderer.php,v 1.5 2001/02/18 16:29:21 uw Exp $
*/
class PhpdocHTMLClassRenderer extends PhpdocHTMLDocumentRenderer {
- /**
- * Internal array of " " strings to format HTML output.
- *
- * @var array $indent
- */
- var $indent = array();
-
- /**
- * Array of variables found in the xml document.
- *
- * @var array $variables
- */
- var $variables = array();
-
- /**
- * Sets the xml and template root directory.
- *
- * @param string XML file path
- * @param string Template file path
- * @param string Name of the current application
- * @param string Filename extension
- * @see setPath(), setTemplateRoot()
- */
- function PhpdocHTMLClassRenderer($path, $templateRoot, $application,
$extension = ".html") {
-
- $this->setPath($path);
- $this->setTemplateRoot($templateRoot);
- $this->application = $application;
- $this->file_extension = $extension;
-
- $this->accessor = new PhpdocClassAccessor;
- $this->tpl = new IntegratedTemplate($this->templateRoot);
- $this->fileHandler = new PhpdocFileHandler;
-
- } // end constructor
-
- /**
- * Renders a class.
- *
- * @param string XML source file
- * @param string Name of the HTML target file.
- * @access public
- */
- function renderClass($xmlfile, $htmlfile = "") {
-
- $this->tpl->loadTemplatefile("class.html");
- if ("" == $htmlfile)
- $htmlfile = substr($xmlfile, 6, -4) . $this->file_extension;
-
- $this->accessor->loadXMLFile($this->path.$xmlfile);
-
- $this->renderSubclasses();
- $this->renderInherited();
- $this->renderFunctions();
- $this->renderVariables();
- $this->renderUses();
- $this->renderConstants();
-
- $class = $this->accessor->getClassdata();
- $tplvars = array();
-
- $tplvars["CLASS_FILE"] = $class["file"]["value"];
- $tplvars["CLASS_NAME"] = $class["name"];
- $tplvars["CLASS_ACCESS"] = $class["access"];
- $tplvars["CLASS_PACKAGE"] = $class["package"];
-
- if ("" != $class["extends"])
- $tplvars["CLASS_EXTENDS"] = sprintf('extends <a
href="%s">%s</a>',
-
$class["extends"].$this->file_extension,
-
$class["extends"]
-
);
-
- $tplvars["CLASS_UNDOC"] = ("true" == $class["undoc"]) ?
$this->undocumented : "";
-
- $tplvars["CLASS_ABSTRACT"] = ("true" == $class["abstract"]) ?
"abstract" : "";
- $tplvars["CLASS_STATIC"] = ("true" == $class["static"]) ?
"static" : "";
- $tplvars["CLASS_FINAL"] = ("true" == $class["final"]) ?
"final" : "";
-
- $tplvars["CLASS_TREE"] = $this->getClasstree($class["name"]);
-
- if (isset($class["doc"]["link"]))
- $this->renderLinks($class["doc"]["link"], "class_");
-
- if (isset($class["doc"]["author"]))
- $this->renderAuthors($class["doc"]["author"], "class_");
-
- if (isset($class["doc"]["see"]))
- $this->renderSee($class["doc"]["see"], "class_");
-
- $fields = array( "version", "deprecated", "copyright",
"since", "magic");
- reset($fields);
- while (list($k, $field) = each($fields))
- if (isset($class["doc"][$field])) {
-
$this->tpl->setCurrentBlock("class_".strtolower($field));
- $this->tpl->setVariable(strtoupper($field),
$class["doc"][$field]["value"]);
- $this->tpl->parseCurrentBlock();
- }
-
- $fields = array( "description", "shortdescription" );
-
- reset($fields);
- while (list($k, $field)=each($fields))
- if (isset($class["doc"][$field]))
- $tplvars["CLASS_".strtoupper($field)] =
$this->encode($class["doc"][$field]["value"]);
-
- $this->tpl->setCurrentBlock("__global__");
- $this->tpl->setVariable($tplvars);
- $this->tpl->setVariable("APPNAME", $this->application);
-
- $this->fileHandler->createFile($this->path.$htmlfile,
$this->tpl->get() );
- $this->tpl->free();
-
- } // end func renderClass
-
-
-
- /**
- * Renders a list of inherited elements.
- *
- * @see renderInheritedElements()
- */
- function renderInherited() {
-
- $this->renderInheritedElements(
$this->accessor->getInheritedFunctions(),
-
"inheritedfunctions",
-
"function"
-
);
-
- $this->renderInheritedElements(
$this->accessor->getInheritedVariables(),
-
"inheritedvariables",
-
"variable"
-
);
-
- $this->renderInheritedElements(
$this->accessor->getInheritedConstants(),
-
"inheritedconstants",
-
"constant"
-
);
-
- $this->renderInheritedElements( $this->accessor->getInheritedUses(),
-
"inheriteduses",
-
"uses"
-
);
-
- } // end func renderInherited
-
- /**
- * Renders a list of a certain inherited element.
- *
- * @param array List of inherited elements.
- * @param string Templateblockname
- * @param string Element type: function, variable...
- * @see renderInherited()
- */
- function renderInheritedElements($inherited, $block, $type) {
-
- if (0 == count($inherited))
- return;
-
- $this->tpl->setCurrentBlock($block);
-
- reset($inherited);
- while (list($source, $elements) = each($inherited)) {
-
- $value = "";
-
- reset($elements);
- while (list($k, $element) = each($elements))
- $value .= sprintf('<a href="%s#%s_%s">%s</a>, ',
-
$source.$this->file_extension,
-
$type,
-
$element,
-
$element
-
);
- $value = substr($value, 0, -2);
-
- $this->tpl->setVariable("SOURCE", $source);
- $this->tpl->setVariable("ELEMENTS", $value);
- $this->tpl->parseCurrentBlock();
- }
-
- } // end func renderInheritedElements
-
- /**
- * Renders a list of direct known subclasses.
- */
- function renderSubclasses() {
-
- $subclasses = $this->accessor->getSubclasses();
- if (0 == count($subclasses))
- return;
-
- $elements = "";
- reset($subclasses);
- while (list($k, $subclass) = each($subclasses))
- $elements .= sprintf('<a href="%s">%s</a>, ',
$subclass.$this->file_extension, $subclass);
-
- $elements = substr($elements, 0, -2);
-
- if ("" != $elements) {
-
- $this->tpl->setCurrentBlock("subclasses");
- $this->tpl->setVariable("ELEMENTS", $elements);
- $this->tpl->parseCurrentBlock();
- }
-
- } // end func renderSubclasses
-
- /**
- * Adds a summary and a detailed list of all variables to the template.
- *
- * @see renderVariableSummary(), renderVariableDetail()
- */
- function renderVariables() {
-
- $this->variables["private"] =
$this->accessor->getVariablesByAccess("private");
- $this->variables["public"] =
$this->accessor->getVariablesByAccess("public");
-
- if (0 == count($this->variables["private"]) && 0 ==
count($this->variables["public"]))
- return;
-
- $this->renderVariableSummary();
- $this->renderVariableDetail();
-
- $this->variables = array();
-
- } // end func renderVariables
-
- /**
- * Adds a summary of all variables to the template.
- *
- * The function assumes that there is a block named "variablesummary" and
- * within it a block names "variablesummay_loop" in the template.
- *
- * @see renderVariableDetail()
- */
- function renderVariableSummary() {
-
- reset($this->accessModifiers);
- while (list($k, $access) = each($this->accessModifiers)) {
-
- if (0 == count($this->variables[$access]))
- continue;
-
- $this->tpl->setCurrentBlock("variablesummary_loop");
-
- reset($this->variables[$access]);
- while (list($name, $variable) =
each($this->variables[$access])) {
-
- $this->tpl->setVariable("NAME", $name);
- $this->tpl->setVariable("TYPE", $variable["type"]);
-
- if (isset($variable["doc"]["shortdescription"]))
- $this->tpl->setVariable("SHORTDESCRIPTION",
$this->encode($variable["doc"]["shortdescription"]["value"]));
-
- $this->tpl->parseCurrentBlock();
-
- }
-
- $this->tpl->setCurrentBlock("variablesummary");
- $this->tpl->setVariable("ACCESS", ucfirst($access));
- $this->tpl->parseCurrentBlock();
-
- }
-
- } // end func renderVariableSummary
-
- /**
- * Adds a detailed list of all variables to the template.
- *
- * The function assumes that there is a block named "variabledetails"
- * and within it a block names "variablesdetails_loop" in the template.
- *
- * @see renderVariableSummary()
- */
- function renderVariableDetail() {
-
- reset($this->accessModifiers);
- while (list($k, $access) = each($this->accessModifiers)) {
-
- if (0 == count($this->variables[$access]))
- continue;
-
- reset($this->variables[$access]);
- while (list($name, $variable)=each($this->variables[$access]))
{
-
- $tplvars = array();
- $tplvars["NAME"] =
$variable["name"];
- $tplvars["ACCESS"] = $variable["access"];
- $tplvars["TYPE"] = $variable["type"];
- $tplvars["VALUE"] =
htmlentities($variable["value"]);
-
- if ("true" == $variable["undoc"])
- $tplvars["UNDOC"] = $this->undocumented;
-
- if ("true" == $variable["static"])
- $tplvars["STATIC"] = "static";
-
- if ("true" == $variable["final"])
- $tplvars["FINAL"] = "final";
-
- if (isset($variable["doc"]["shortdescription"]))
- $tplvars["SHORTDESCRIPTION"] =
$this->encode($variable["doc"]["shortdescription"]["value"]);
-
- if (isset($variable["doc"]["description"]))
- $tplvars["DESCRIPTION"] =
$this->encode($variable["doc"]["description"]["value"]);
-
- $this->renderCommonDocfields("variabledetails_",
$variable);
-
- $this->tpl->setCurrentBlock("variabledetails_loop");
- $this->tpl->setVariable($tplvars);
- $this->tpl->parseCurrentBlock();
-
- }
-
- $this->tpl->setCurrentBlock("variabledetails");
- $this->tpl->setVariable("ACCESS", ucfirst($access) );
- $this->tpl->parseCurrentBlock();
-
- }
-
- } // end func renderVariableDetail
-
- /**
- * Returns a html string that shows the class tree.
- *
- * @param string name of the current class
- * @return string HTML that shows the tree
- */
- function getClasstree($class) {
-
- $path = $this->accessor->getClasstree();
- $level = 0;
- $num = count($path) - 1;
-
- for ($i = $num; $i >= 0; --$i) {
-
- $indent = $this->getIndent($level);
-
- if ($level > 0)
- $value.= sprintf("%s |<br>%s+-- ", $indent, $indent);
-
- $value.= sprintf('<a href="%s">%s</a><br>',
-
$path[$i].$this->file_extension,
-
$path[$i]
-
);
- ++$level;
-
- }
-
- $indent = $this->getIndent($level);
-
- if ($level > 0)
- $value.= sprintf("%s |<br>%s+-- ", $indent, $indent);
-
- $value.= sprintf('%s<br>', $class);
-
- return $value;
- } // end func getClasstree
-
- /**
- * Returns a certain number of " "s.
- *
- * @param int number of " " required.
- * @see $indent
- * @return string A string with the requested number of nunbreakable
html spaces
- */
- function getIndent($level) {
-
- if (!isset($this->indent[$level])) {
-
- $html = "";
- for ($i = 0; $i < $level; ++$i)
- $html .= " ";
+ /**
+ * Internal array of " " strings to format HTML output.
+ *
+ * @var array
+ */
+ var $indent = array();
+
+ /**
+ * Array of variables found in the xml document.
+ *
+ * @var array
+ */
+ var $variables = array();
+
+ /**
+ * Sets the xml and template root directory.
+ *
+ * @param string XML file path
+ * @param string Template file path
+ * @param string Name of the current application
+ * @param string Filename extension
+ * @see setPath(), setTemplateRoot()
+ */
+ function PhpdocHTMLClassRenderer($path, $templateRoot, $application, $extension =
+".html") {
+
+ $this->setPath($path);
+ $this->setTemplateRoot($templateRoot);
+ $this->application = $application;
+ $this->file_extension = $extension;
+
+ $this->accessor = new PhpdocClassAccessor;
+ $this->tpl = new IntegratedTemplate($this->templateRoot);
+ $this->fileHandler = new PhpdocFileHandler;
+
+ } // end constructor
+
+ /**
+ * Renders a class.
+ *
+ * @param string XML source file
+ * @param string Name of the HTML target file.
+ * @access public
+ */
+ function renderClass($xmlfile, $htmlfile = "") {
+
+ $this->tpl->loadTemplatefile("class.html");
+ if ("" == $htmlfile)
+ $htmlfile = substr($xmlfile, 6, -4) . $this->file_extension;
+
+ $this->accessor->loadXMLFile($this->path.$xmlfile);
+
+ $this->renderSubclasses();
+ $this->renderInherited();
+ $this->renderFunctions();
+ $this->renderVariables();
+ $this->renderUses();
+ $this->renderConstants();
+
+ $class = $this->accessor->getClassdata();
+ $tplvars = array();
+
+ $tplvars["CLASS_FILE"] = $class["file"]["value"];
+ $tplvars["CLASS_NAME"] = $class["name"];
+ $tplvars["CLASS_ACCESS"] = $class["access"];
+ $tplvars["CLASS_PACKAGE"] = $class["package"];
+
+ if ("" != $class["extends"])
+ $tplvars["CLASS_EXTENDS"] = sprintf('extends <a href="%s">%s</a>',
+
+$class["extends"].$this->file_extension,
+ $class["extends"]
+ );
+
+ $tplvars["CLASS_UNDOC"] = ("true" == $class["undoc"]) ?
+$this->undocumented : "";
+
+ $tplvars["CLASS_ABSTRACT"] = ("true" == $class["abstract"]) ? "abstract" : "";
+ $tplvars["CLASS_STATIC"] = ("true" == $class["static"]) ? "static" : "";
+ $tplvars["CLASS_FINAL"] = ("true" == $class["final"]) ? "final" : "";
+
+ $tplvars["CLASS_TREE"] = $this->getClasstree($class["name"]);
+
+ if (isset($class["doc"]["link"]))
+ $this->renderLinks($class["doc"]["link"], "class_");
+
+ if (isset($class["doc"]["author"]))
+ $this->renderAuthors($class["doc"]["author"], "class_");
+
+ if (isset($class["doc"]["see"]))
+ $this->renderSee($class["doc"]["see"], "class_");
+
+ $fields = array("version", "deprecated", "copyright", "since", "magic");
+ reset($fields);
+ while (list($k, $field) = each($fields))
+ if (isset($class["doc"][$field])) {
+ $this->tpl->setCurrentBlock("class_" . strtolower($field));
+ $this->tpl->setVariable(strtoupper($field),
+$class["doc"][$field]["value"]);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $fields = array( "description", "shortdescription" );
+
+ reset($fields);
+ while (list($k, $field) = each($fields))
+ if (isset($class["doc"][$field]))
+ $tplvars["CLASS_".strtoupper($field)] =
+$this->encode($class["doc"][$field]["value"]);
+
+ $this->tpl->setCurrentBlock("__global__");
+ $this->tpl->setVariable($tplvars);
+ $this->tpl->setVariable("APPNAME", $this->application);
+
+ $this->fileHandler->createFile($this->path.$htmlfile, $this->tpl->get() );
+ $this->tpl->free();
+
+ } // end func renderClass
+
+ /**
+ * Renders a list of inherited elements.
+ *
+ * @see renderInheritedElements()
+ */
+ function renderInherited() {
+
+ $this->renderInheritedElements( $this->accessor->getInheritedFunctions(),
+ "inheritedfunctions",
+ "function"
+ );
+
+ $this->renderInheritedElements( $this->accessor->getInheritedVariables(),
+ "inheritedvariables",
+ "variable"
+ );
+
+ $this->renderInheritedElements( $this->accessor->getInheritedConstants(),
+ "inheritedconstants",
+ "constant"
+ );
+
+ $this->renderInheritedElements( $this->accessor->getInheritedUses(),
+ "inheriteduses",
+ "uses"
+ );
+
+ } // end func renderInherited
+
+ /**
+ * Renders a list of a certain inherited element.
+ *
+ * @param array List of inherited elements.
+ * @param string Templateblockname
+ * @param string Element type: function, variable...
+ * @see renderInherited()
+ */
+ function renderInheritedElements($inherited, $block, $type) {
+
+ if (0 == count($inherited))
+ return;
+
+ $this->tpl->setCurrentBlock($block);
+
+ reset($inherited);
+ while (list($source, $elements) = each($inherited)) {
+
+ $value = "";
+
+ reset($elements);
+ while (list($k, $element) = each($elements))
+ $value .= sprintf('<a href="%s#%s_%s">%s</a>, ',
+ $source.$this->file_extension,
+ $type,
+ $element,
+ $element
+ );
+ $value = substr($value, 0, -2);
+
+ $this->tpl->setVariable("SOURCE", $source);
+ $this->tpl->setVariable("ELEMENTS", $value);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ } // end func renderInheritedElements
+
+ /**
+ * Renders a list of direct known subclasses.
+ */
+ function renderSubclasses() {
+
+ $subclasses = $this->accessor->getSubclasses();
+ if (0 == count($subclasses))
+ return;
+
+ $elements = "";
+ reset($subclasses);
+ while (list($k, $subclass) = each($subclasses))
+ $elements .= sprintf('<a href="%s">%s</a>, ',
+$subclass.$this->file_extension, $subclass);
+
+ $elements = substr($elements, 0, -2);
+
+ if ("" != $elements) {
+
+ $this->tpl->setCurrentBlock("subclasses");
+ $this->tpl->setVariable("ELEMENTS", $elements);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ } // end func renderSubclasses
+
+ /**
+ * Adds a summary and a detailed list of all variables to the template.
+ *
+ * @see renderVariableSummary(), renderVariableDetail()
+ */
+ function renderVariables() {
+
+ $this->variables["private"] =
+$this->accessor->getVariablesByAccess("private");
+ $this->variables["public"] =
+$this->accessor->getVariablesByAccess("public");
+
+ if (0 == count($this->variables["private"]) && 0 ==
+count($this->variables["public"]))
+ return;
+
+ $this->renderVariableSummary();
+ $this->renderVariableDetail();
+
+ $this->variables = array();
+
+ } // end func renderVariables
+
+ /**
+ * Adds a summary of all variables to the template.
+ *
+ * The function assumes that there is a block named "variablesummary" and
+ * within it a block names "variablesummay_loop" in the template.
+ *
+ * @see renderVariableDetail()
+ */
+ function renderVariableSummary() {
+
+ reset($this->accessModifiers);
+ while (list($k, $access) = each($this->accessModifiers)) {
+
+ if (0 == count($this->variables[$access]))
+ continue;
+
+ $this->tpl->setCurrentBlock("variablesummary_loop");
+
+ reset($this->variables[$access]);
+ while (list($name, $variable) = each($this->variables[$access])) {
+
+ $this->tpl->setVariable("NAME", $name);
+ $this->tpl->setVariable("TYPE", $variable["type"]);
+
+ if (isset($variable["doc"]["shortdescription"]))
+ $this->tpl->setVariable("SHORTDESCRIPTION",
+$this->encode($variable["doc"]["shortdescription"]["value"]));
+
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ $this->tpl->setCurrentBlock("variablesummary");
+ $this->tpl->setVariable("ACCESS", ucfirst($access));
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ } // end func renderVariableSummary
+
+ /**
+ * Adds a detailed list of all variables to the template.
+ *
+ * The function assumes that there is a block named "variabledetails"
+ * and within it a block names "variablesdetails_loop" in the template.
+ *
+ * @see renderVariableSummary()
+ */
+ function renderVariableDetail() {
+
+ reset($this->accessModifiers);
+ while (list($k, $access) = each($this->accessModifiers)) {
+
+ if (0 == count($this->variables[$access]))
+ continue;
+
+ reset($this->variables[$access]);
+ while (list($name, $variable) = each($this->variables[$access])) {
+
+ $tplvars = array();
+ $tplvars["NAME"] = $variable["name"];
+ $tplvars["ACCESS"] = $variable["access"];
+ $tplvars["TYPE"] = $variable["type"];
+ $tplvars["VALUE"] = htmlentities($variable["value"]);
+
+ if ("true" == $variable["undoc"])
+ $tplvars["UNDOC"] = $this->undocumented;
+
+ if ("true" == $variable["static"])
+ $tplvars["STATIC"] = "static";
+
+ if ("true" == $variable["final"])
+ $tplvars["FINAL"] = "final";
+
+ if (isset($variable["doc"]["shortdescription"]))
+ $tplvars["SHORTDESCRIPTION"] =
+$this->encode($variable["doc"]["shortdescription"]["value"]);
+
+ if (isset($variable["doc"]["description"]))
+ $tplvars["DESCRIPTION"] =
+$this->encode($variable["doc"]["description"]["value"]);
+
+ $this->renderCommonDocfields("variabledetails_", $variable);
+
+ $this->tpl->setCurrentBlock("variabledetails_loop");
+ $this->tpl->setVariable($tplvars);
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ $this->tpl->setCurrentBlock("variabledetails");
+ $this->tpl->setVariable("ACCESS", ucfirst($access) );
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ } // end func renderVariableDetail
+
+ /**
+ * Returns a html string that shows the class tree.
+ *
+ * @param string name of the current class
+ * @return string HTML that shows the tree
+ */
+ function getClasstree($class) {
+
+ $path = $this->accessor->getClasstree();
+ $level = 0;
+ $num = count($path) - 1;
+
+ for ($i = $num; $i >= 0; --$i) {
+
+ $indent = $this->getIndent($level);
+
+ if ($level > 0)
+ $value.= sprintf("%s |<br>%s+-- ", $indent, $indent);
+
+ $value.= sprintf('<a href="%s">%s</a><br>',
+ $path[$i] . $this->file_extension,
+ $path[$i]
+ );
+ ++$level;
+
+ }
+
+ $indent = $this->getIndent($level);
+
+ if ($level > 0)
+ $value.= sprintf("%s |<br>%s+-- ", $indent, $indent);
+
+ $value.= sprintf('%s<br>', $class);
+
+ return $value;
+ } // end func getClasstree
+
+ /**
+ * Returns a certain number of " "s.
+ *
+ * @param int number of " " required.
+ * @see $indent
+ * @return tring A string with the requested number of nunbreakable html spaces
+ */
+ function getIndent($level) {
+
+ if (!isset($this->indent[$level])) {
+
+ $html = "";
+ for ($i = 0; $i < $level; ++$i)
+ $html .= " ";
- $this->indent[$level] = $html;
+ $this->indent[$level] = $html;
- }
+ }
- return $this->indent[$level];
- } // end func getIndent
+ return $this->indent[$level];
+ } // end func getIndent
} // end class PhpdocHTMLClassRenderer
-
?>
Index: php4/pear/PHPDoc/renderer/html/PhpdocHTMLDocumentRenderer.php
diff -u php4/pear/PHPDoc/renderer/html/PhpdocHTMLDocumentRenderer.php:1.4
php4/pear/PHPDoc/renderer/html/PhpdocHTMLDocumentRenderer.php:1.5
--- php4/pear/PHPDoc/renderer/html/PhpdocHTMLDocumentRenderer.php:1.4 Sun Dec 3
14:37:37 2000
+++ php4/pear/PHPDoc/renderer/html/PhpdocHTMLDocumentRenderer.php Sun Feb 18
+08:29:21 2001
@@ -2,742 +2,743 @@
/**
* Provides functioninality to render modules and classes.
*
-* @version $Id: PhpdocHTMLDocumentRenderer.php,v 1.4 2000/12/03 22:37:37 uw Exp $
+* @version $Id: PhpdocHTMLDocumentRenderer.php,v 1.5 2001/02/18 16:29:21 uw Exp $
*/
class PhpdocHTMLDocumentRenderer extends PhpdocHTMLRenderer {
- /**
- * Message displayed if an object lacks documentation.
- *
- * @var string $undocumented
- * @access public
- */
- var $undocumented = "Warning: documentation is missing.";
-
- /**
- * Array of functions found in the xml document.
- *
- * @var array $functions
- */
- var $functions = array();
-
- /**
- * Array of included files.
- *
- * @var array $uses
- */
- var $uses = array();
-
- /**
- * Array of constants.
- *
- * @var array $constants
- */
- var $constants = array();
-
- /**
- * Array of access modifiers.
- *
- * @var array $accessModifiers
- */
- var $accessModifiers = array("public", "private");
-
- /**
- * Array of doc container fields that get mapped directly to templateblocks.
- *
- * @var array $simpleDocfields
- * @see renderVariableDetail()
- */
- var $simpleDocfields = array(
-
"VERSION" => "version",
-
"SINCE" => "since",
-
"DEPRECATED" => "deprecated",
-
"COPYRIGHT" => "copyright",
-
"MAGIC" => "magic"
-
);
-
- /**
- * Types of include statements.
- *
- * @var array $usesTypes
- * @see renderUses()
- */
- var $usesTypes = array( "include", "include_once", "require", "require_once" );
-
- /**
- * Adds a summary and a detailed list of all constants to the template.
- *
- * @see renderConstantSummary(), renderConstantDetail()
- */
- function renderConstants() {
-
- $this->constants["public"] =
$this->accessor->getConstantsByAccess("public");
- $this->constants["private"] =
$this->accessor->getConstantsByAccess("private");
-
- if (0 == count($this->constants["public"]) && 0 ==
count($this->constants["private"]))
- return;
-
- $this->renderConstantSummary();
- $this->renderConstantDetail();
- $this->constants = array();
-
- } // end func renderConstants
-
- /**
- * Adds a summary of all constants to the template.
- *
- * The function assumes that there is a block called "constantssummary" and
- * withing this block a bock called "constantssummary_loop" in the template.
- *
- * @see renderConstantDetail()
- */
- function renderConstantSummary() {
-
- reset($this->accessModifiers);
- while (list($k, $access) = each($this->accessModifiers)) {
- if (0 == count($this->constants[$access]))
- continue;
-
- $this->tpl->setCurrentBlock("constantssummary_loop");
-
- reset($this->constants[$access]);
- while (list($name, $const) = each($this->constants[$access])) {
-
- $this->tpl->setVariable("NAME", $name);
- $this->tpl->setVariable("VALUE",
htmlentities($const["value"]));
-
- if (isset($const["doc"]["shortdescription"]))
- $this->tpl->setVariable("SHORTDESCRIPTION",
$this->encode($const["doc"]["shortdescription"]["value"]));
-
- if ("true" == $const["undoc"])
- $this->tpl->setVariable("UNDOC",
$this->undocumented);
-
- $this->tpl->parseCurrentBlock();
- }
-
- $this->tpl->setCurrentBlock("constantssummary");
- $this->tpl->setVariable("ACCESS", ucfirst($access));
- $this->tpl->parseCurrentBlock();
-
- }
-
- } // end func renderConstantSummary
-
- /**
- * Adds a detailed list of all constants to the template.
- *
- * The function assumes that there is a block named "constantdetails" and
- * withing it another block named "constantdetails_loop".
- *
- * @see renderConstantSummary()
- */
- function renderConstantDetail() {
-
- reset($this->accessModifiers);
- while (list($k, $access) = each($this->accessModifiers)) {
- if (0 == count($this->constants[$access]))
- continue;
-
- reset($this->constants[$access]);
- while (list($name, $constant) =
each($this->constants[$access])) {
-
- $tplvars = array();
- $tplvars["NAME"] = $name;
- $tplvars["CASE"] = $constant["case"];
- $tplvars["VALUE"] =
htmlentities($constant["value"]);
-
- if ("true" == $constant["undoc"])
- $tplvars["UNDOC"] = $this->undocumented;
-
- if (isset($constant["doc"]["shortdescription"]))
- $tplvars["SHORTDESCRIPTION"] =
$this->encode($constant["doc"]["shortdescription"]["value"]);
-
- if (isset($constant["doc"]["description"]))
- $tplvars["DESCRIPTION"] =
$this->encode($constant["doc"]["description"]["value"]);
-
- $this->renderCommonDocfields("constantdetails_",
$constant);
-
- $this->tpl->setCurrentBlock("constantdetails_loop");
- $this->tpl->setVariable($tplvars);
- $this->tpl->parseCurrentBlock();
- }
-
- $this->tpl->setCurrentBlock("constantdetails");
- $this->tpl->setVariable("ACCESS", ucfirst($access));
- $this->tpl->parseCurrentBlock();
- }
-
- } // end func renderConstantsDetail
-
- /**
- * Adds a summary and a detailed list of included files to the template.
- * @see renderUsesSummary(), renderUsesDetail()
- */
- function renderUses() {
-
- $found = false;
-
- reset($this->usesTypes);
- while (list($k, $type) = each($this->usesTypes)) {
-
- $this->uses[$type] = $this->accessor->getUsesByType($type);
- if (!$found && 0 != count($this->uses[$type]))
- $found = true;
-
- }
-
- if (!$found)
- return;
-
- $this->renderUsesSummary();
- $this->renderUsesDetail();
-
- $this->uses = array();
- } // end func renderUses
-
- /**
- * Adds a detailed list of all included files to the template.
- *
- * The function assumes that there is a block names "usesdetail" and within the
block
- * a block names "usesdetail_loop" in the template.
- *
- * @see renderUsesSummary()
- */
- function renderUsesDetail() {
-
- reset($this->usesTypes);
- while (list($k, $type) = each($this->usesTypes)) {
- if (0 == count($this->uses[$type]))
- continue;
-
- reset($this->uses[$type]);
- while (list($file, $uses) = each($this->uses[$type])) {
-
- $tplvars = array();
- $tplvars["FILE"] = $uses["file"];
- $tplvars["TYPE"] = $type;
-
- if ("true" == $uses["undoc"])
- $tplvars["UNDOC"] = $this->undocumented;
-
- if (isset($uses["doc"]["shortdescription"]))
- $tplvars["SHORTDESCRIPTION"] =
$this->encode($uses["doc"]["shortdescription"]["value"]);
-
- if (isset($uses["doc"]["description"]))
- $tplvars["DESCRIPTION"] =
$this->encode($uses["doc"]["description"]["value"]);
-
- $this->renderCommonDocfields("usesdetails_", $uses);
- $this->tpl->setCurrentBlock("usesdetails_loop");
- $this->tpl->setVariable($tplvars);
- $this->tpl->parseCurrentBlock();
- }
-
- $this->tpl->setCurrentBlock("usesdetails");
- $this->tpl->setVariable("TYPE", $type);
- $this->tpl->parseCurrentBlock();
- }
-
- } // end func renderUsesDetail
-
- /**
- * Adds a summary of all included files to the template.
- *
- * The function assumes that there is a block names "usessummary" and within
- * the block another block names "usessummary_loop" in the template.
- *
- * @see renderUsesDetail()
- */
- function renderUsesSummary() {
-
- reset($this->usesTypes);
- while (list($k, $type) = each($this->usesTypes)) {
- if (0 == count($this->uses[$type]))
- continue;
-
- $this->tpl->setCurrentBlock("usessummary_loop");
-
- reset($this->uses[$type]);
- while (list($file, $uses) = each($this->uses[$type])) {
-
- $this->tpl->setVariable("FILE", $file);
- if (isset($uses["doc"]["shortdescription"]))
- $this->tpl->setVariable("SHORTDESCRIPTION",
$this->encode($uses["doc"]["shortdescription"]["value"]));
-
- if ("true" == $uses["undoc"])
- $this->tpl->setVariable("UNDOC",
$this->undocumented);
-
- $this->tpl->parseCurrentBlock();
- }
-
- $this->tpl->setCurrentBlock("usessummary");
- $this->tpl->setVariable("TYPE", $type);
- $this->tpl->parseCurrentBlock();
- }
-
- } // end func renderUsesSummary
-
- /**
- * Adds a summary and a detailed list of all functions to the template.
- *
- * @see renderFunctionSummary(), renderFunctionDetail(), $functions
- */
- function renderFunctions() {
-
- $this->functions["private"] =
$this->accessor->getFunctionsByAccess("private");
- $this->functions["public"] =
$this->accessor->getFunctionsByAccess("public");
-
- if (0 == count($this->functions["private"]) && 0 ==
count($this->functions["public"]))
- return;
-
- $this->renderFunctionSummary();
- $this->renderFunctionDetail();
- $this->functions = array();
-
- } // end func renderFunctions
-
- /**
- * Adds a function summary to the template.
- *
- * The function assumes that there is ablock names "functionsummary" and
- * within it a block names "functionsummary_loop" in the template.
- *
- * @see renderFunctionDetail(), renderFunctions(), $functions, $accessModifiers
- */
- function renderFunctionSummary() {
-
- reset($this->accessModifiers);
- while (list($k, $access) = each($this->accessModifiers)) {
- if (0 == count($this->functions[$access]))
- continue;
-
- $this->tpl->setCurrentBlock("functionsummary_loop");
- reset($this->functions[$access]);
- while (list($name, $function) =
each($this->functions[$access])) {
-
- $this->tpl->setVariable("NAME", $name);
-
- if (isset($function["doc"]["parameter"]))
- $this->tpl->setVariable("PARAMETER",
$this->getParameter($function["doc"]["parameter"]));
-
- if (isset($function["doc"]["shortdescription"]))
- $this->tpl->setVariable("SHORTDESCRIPTION",
$this->encode($function["doc"]["shortdescription"]["value"]));
-
- if (isset($function["doc"]["return"]))
- $this->tpl->setVariable("RETURNTYPE",
$function["doc"]["return"]["type"]);
- else
- $this->tpl->setVariable("RETURNTYPE", "void");
-
- if ("true" == $function["undoc"])
- $this->tpl->setVariable("UNDOC",
$this->undocumented);
-
- $this->tpl->parseCurrentBlock();
- }
-
- $this->tpl->setCurrentBlock("functionsummary");
- $this->tpl->setVariable("ACCESS", ucfirst($access) );
- $this->tpl->parseCurrentBlock();
- }
-
- } // end func renderFunctionSummary
-
- /**
- * Adds a detailed list of functions to the template.
- *
- * The function assumes that there is a block named "functiondetails" and
- * within it a bloc "functiondetails_loop" in the template.
- *
- * @see renderFunctions(), renderFunctionSummary(), $functions,
$accessModifiers
- */
- function renderFunctionDetail() {
-
- reset($this->accessModifiers);
- while (list($k, $access) = each($this->accessModifiers)) {
- if (0 == count($this->functions[$access]))
- continue;
-
- reset($this->functions[$access]);
- while (list($name, $function) =
each($this->functions[$access])) {
-
- $tplvars = array();
- $tplvars["NAME"] = $function["name"];
- $tplvars["ACCESS"] = $function["access"];
-
- if ("true" == $function["undoc"])
- $tplvars["UNDOC"] = $this->undocumented;
-
- if ("true" == $function["abstract"])
- $tplvars["ABSTRACT"] = "abstract";
-
- if ("true" == $function["static"])
- $tplvars["STATIC"] = "static";
-
- if (isset($function["doc"]["shortdescription"]))
- $tplvars["SHORTDESCRIPTION"] =
$this->encode($function["doc"]["shortdescription"]["value"]);
-
- if (isset($function["doc"]["description"]))
- $tplvars["DESCRIPTION"] =
$this->encode($function["doc"]["description"]["value"]);
-
- $this->renderCommonDocfields("functiondetails_",
$function);
-
- if (isset($function["doc"]["parameter"])) {
- $tplvars["PARAMETER"] =
$this->getParameter($function["doc"]["parameter"]);
-
$this->renderParameterDetail($function["doc"]["parameter"]);
- }
-
- if (isset($function["doc"]["throws"]))
-
$this->renderThrows($function["doc"]["throws"], "functiondetails_");
-
- if (isset($function["doc"]["global"]))
-
$this->renderGlobals($function["doc"]["global"], "functiondetails_");
-
- if (isset($function["doc"]["return"])) {
-
- $tplvars["RETURNTYPE"] =
$function["doc"]["return"]["type"];
-
-
$this->tpl->setCurrentBlock("functiondetails_return");
- $this->tpl->setVariable("TYPE",
$function["doc"]["return"]["type"]);
- $this->tpl->setVariable("DESCRIPTION",
$this->encode($function["doc"]["return"]["value"]));
-
- if (isset($function["doc"]["return"]["name"]))
- $this->tpl->setVariable("NAME",
$function["doc"]["return"]["name"]);
-
- $this->tpl->parseCurrentBlock();
-
- } else {
-
- $tplvars["RETURNTYPE"] = "void";
-
- }
-
- $this->tpl->setCurrentBlock("functiondetails_loop");
- $this->tpl->setVariable($tplvars);
- $this->tpl->parseCurrentBlock();
- }
-
- $this->tpl->setCurrentBlock("functiondetails");
- $this->tpl->setVariable("ACCESS", ucfirst($access) );
- $this->tpl->parseCurrentBlock();
- }
-
- } // end func renderFunctionDetail
-
- /**
- * Renders a detailed list of function parameters.
- *
- * The function assumes that there is a block named "functiondetails_parameter"
in
- * the template and within it a block named "functiondetails_parameter_loop".
- *
- * @param array Parameter
- */
- function renderParameterDetail($parameter) {
-
- if (!isset($parameter[0]))
- $parameter = array($parameter);
-
- $this->tpl->setCurrentBlock("functiondetails_parameter_loop");
-
- reset($parameter);
- while (list($k, $param) = each($parameter)) {
-
- $this->tpl->setVariable("NAME", $param["name"]);
- $this->tpl->setVariable("DESCRIPTION",
$this->encode($param["value"]));
-
- if (isset($param["type"]))
- $this->tpl->setVariable("TYPE", $param["type"]);
-
- if (isset($param["default"]))
- $this->tpl->setVariable("DEFAULT", "=
>>".htmlentities($param["default"])."<<");
-
- if ("true" == $param["undoc"])
- $this->tpl->setVariable("UNDOC", $this->undocumented);
-
- $this->tpl->parseCurrentBlock();
- }
-
- } // end func renderParameterDetail
-
- /**
- * Converts the XML parameter array into formatted string.
- *
- * @param array XML parameter array
- * @return string Formatted parameter string
- */
- function getParameter($parameter) {
-
- if (!is_array($parameter))
- return "void";
-
- $value = "";
-
- if (!isset($parameter[0])) {
-
- if (!isset($parameter["default"]))
- $value .= $parameter["type"] . " " .
$parameter["name"];
- else
- $value .= "[ ".$parameter["type"] . " " .
$parameter["name"]." ]";
-
- } else {
-
- $flag_optional = false;
-
- reset($parameter);
- while (list($k, $param) = each($parameter)) {
-
- if (!isset($param["default"])) {
- if ($flag_optional) {
- $value = substr($value, 0, -2)." ], ";
- $flag_optional = false;
- }
- } else {
- if (!$flag_optional) {
- $value .= "[ ";
- $flag_optional = true;
- }
- }
-
- $value .= $param["type"] . " " . $param["name"].", ";
- }
-
- $value = substr($value, 0, -2);
- if ($flag_optional)
- $value .= " ]";
-
- }
-
- return $value;
- } // end func getParameter
-
- /**
- * Renders a block with references to other source elements.
- *
- * @param array XML references array
- * @param string optional template blockname prefix
- */
- function renderSee($references, $prefix = "") {
-
- $value = "";
- if (!isset($references[0])) {
-
- if (isset($references["group"]))
- $value .= sprintf('<a href="%s#%s_%s">%s::%s</a>',
-
$this->nameToUrl($references["group"]).$this->file_extension,
-
$references["type"],
-
$references["value"],
-
$references["group"],
-
$references["value"]
-
);
- else
- $value .= sprintf('<a href="#%s_%s">%s</a>',
-
$references["type"],
-
$references["value"],
-
$references["value"]
-
);
-
- } else {
-
- reset($references);
- while (list($k, $reference) = each($references)) {
-
- if (isset($reference["group"]))
- $value .= sprintf('<a
href="%s#%s_%s">%s::%s</a>, ',
-
$this->nameToUrl($reference["group"]).$this->file_extension,
-
$reference["type"],
-
$reference["value"],
-
$reference["group"],
-
$reference["value"]
-
);
- else
- $value .= sprintf('<a href="#%s_%s">%s</a>, ',
-
$reference["type"],
-
$reference["value"],
-
$reference["value"]
-
);
-
- }
-
- $value = substr($value, 0, -2);
- }
-
- $this->tpl->setCurrentBlock(strtolower($prefix) . "see");
- $this->tpl->setVariable("SEE", $value);
- $this->tpl->parseCurrentBlock();
-
- } // end func renderSee
-
- /**
- * Renders an author list.
- *
- * @param array XML author array
- * @param string optional template blockname prefix
- */
- function renderAuthors($authors, $prefix = "") {
-
- $value = "";
-
- if (!isset($authors[0])) {
-
- if (isset($authors["email"]))
- $value .= sprintf('%s <<a
href="mailto:%s">%s</a>>, ', $authors["value"], $authors["email"],
$authors["email"]);
- else
- $value .= $authors["email"] . ", ";
-
- } else {
-
- reset($authors);
- while (list($k, $author) = each($authors)) {
-
- if (isset($author["email"]))
- $value .= sprintf('%s <<a
href="mailto:%s">%s</a>>, ', $author["value"], $author["email"], $author["email"]);
- else
- $value .= $author["email"] . ", ";
-
- }
-
- }
-
- $value = substr($value, 0, -2);
- $this->tpl->setCurrentBlock(strtolower($prefix) . "authors");
- $this->tpl->setVariable("AUTHOR", $value);
- $this->tpl->parseCurrentBlock();
-
- } // end func renderAuthors
-
- /**
- * Renders a list of external links.
- *
- * @param array XML link array
- * @param string optional template blockname prefix
- */
- function renderLinks($links, $prefix = "") {
-
- $value = "";
- if (!isset($links[0])) {
- $value .= sprintf('<a href="%s">%s</a>%s, ',
-
$links["url"],
-
$links["url"],
-
("" != $links["description"]) ? " - " . $links["description"] : ""
-
);
- } else {
-
- reset($links);
- while (list($k, $link) = each($links)) {
- $value .= sprintf('<a href="%s">%s</a>%s, ',
-
$link["url"],
-
$link["url"],
-
("" != $link["description"]) ? " - " . $links["description"]
: ""
-
);
- }
-
- }
-
- $value = substr($value, 0, 2);
- $this->tpl->setCurrentBlock(strtolower($prefix) . "links");
- $this->tpl->setVariable("LINK", $value);
- $this->tpl->parseCurrentBlock();
-
- } // end func renderLinks
-
- /**
- * Renders a list of exceptions.
- *
- * @param array XML array
- * @param string optional template blockname prefix
- */
- function renderThrows($throws, $prefix = "") {
-
- $value = "";
- if (!isset($throws[0])) {
-
- $value = $throws["value"];
-
- } else {
-
- reset($throws);
- while (list($k, $exception) = each($throws))
- $value .= sprintf("%s, ", $exception["value"]);
-
- $value = substr($value, 0, -2);
-
- }
-
- $this->tpl->setCurrentBlock(strtolower($prefix) . "throws");
- $this->tpl->setVariable("EXCEPTIONS", $value);
- $this->tpl->parseCurrentBlock();
-
- } // end func renderThrows
-
- /**
- * Renders a list of global elements.
- *
- * @param array XML globals array
- * @param string optional template blockname prefix
- */
- function renderGlobals($globals, $prefix = "") {
-
- $prefix = strtolower($prefix);
- $this->tpl->setCurrentBlock($prefix . "globals_loop");
-
- if (!isset($globals[0])) {
-
- $this->tpl->setVariable("NAME", $globals["name"]);
- $this->tpl->setVariable("DESCRIPTION",
$this->encode($globals["value"]));
-
- if (isset($globals["type"]))
- $this->tpl->setVariable("TYPE", $globals["type"]);
-
- $this->tpl->parseCurrentBlock();
-
- } else {
-
- reset($globals);
- while (list($k, $global) = each($globals)) {
-
- $this->tpl->setVariable("NAME", $global["name"]);
- $this->tpl->setVariable("DESCRIPTION",
$this->encode($global["value"]));
-
- if (isset($globals["type"]))
- $this->tpl->setVariable("TYPE",
$globals["type"]);
-
- $this->tpl->parseCurrentBlock();
-
- }
-
- }
-
- } // end func renderGlobals
-
- /**
- * Adds some tags to the template that are allowed nearly everywhere.
- *
- * @param string template blockname prefixs
- * @param array
- * @see $simpleDocfields, renderLinks(), renderAuthors(), renderSee()
- */
- function renderCommonDocfields($block, &$data) {
-
- reset($this->simpleDocfields);
- while (list($varname, $field) = each($this->simpleDocfields)) {
-
- if (isset($data["doc"][$field])) {
-
- $this->tpl->setCurrentBlock($block.$field);
- $this->tpl->setVariable($varname,
htmlentities($data["doc"][$field]["value"]));
- $this->tpl->parseCurrentBlock();
-
- }
-
- }
-
- if (isset($data["doc"]["link"]))
- $this->renderLinks($data["doc"]["link"], $block);
+ /**
+ * Message displayed if an object lacks documentation.
+ *
+ * @var string $undocumented
+ * @access public
+ */
+ var $undocumented = "Warning: documentation is missing.";
+
+ /**
+ * Array of functions found in the xml document.
+ *
+ * @var array $functions
+ */
+ var $functions = array();
+
+ /**
+ * Array of included files.
+ *
+ * @var array $uses
+ */
+ var $uses = array();
+
+ /**
+ * Array of constants.
+ *
+ * @var array $constants
+ */
+ var $constants = array();
+
+ /**
+ * Array of access modifiers.
+ *
+ * @var array $accessModifiers
+ */
+ var $accessModifiers = array("public", "private");
+
+ /**
+ * Array of doc container fields that get mapped directly to templateblocks.
+ *
+ * @var array $simpleDocfields
+ * @see renderVariableDetail()
+ */
+ var $simpleDocfields = array(
+ "VERSION" => "version",
+ "SINCE" => "since",
+ "DEPRECATED" => "deprecated",
+ "COPYRIGHT" => "copyright",
+ "MAGIC" => "magic"
+ );
+
+ /**
+ * Types of include statements.
+ *
+ * @var array $usesTypes
+ * @see renderUses()
+ */
+ var $usesTypes = array( "include", "include_once", "require", "require_once" );
+
+ /**
+ * Adds a summary and a detailed list of all constants to the template.
+ *
+ * @see renderConstantSummary(), renderConstantDetail()
+ */
+ function renderConstants() {
+
+ $this->constants["public"] = $this->accessor->getConstantsByAccess("public");
+ $this->constants["private"] =
+$this->accessor->getConstantsByAccess("private");
+
+ if (0 == count($this->constants["public"]) && 0 ==
+count($this->constants["private"]))
+ return;
+
+ $this->renderConstantSummary();
+ $this->renderConstantDetail();
+ $this->constants = array();
+
+ } // end func renderConstants
+
+ /**
+ * Adds a summary of all constants to the template.
+ *
+ * The function assumes that there is a block called "constantssummary" and
+ * withing this block a bock called "constantssummary_loop" in the template.
+ *
+ * @see renderConstantDetail()
+ */
+ function renderConstantSummary() {
+
+ reset($this->accessModifiers);
+ while (list($k, $access) = each($this->accessModifiers)) {
+ if (0 == count($this->constants[$access]))
+ continue;
+
+ $this->tpl->setCurrentBlock("constantssummary_loop");
+
+ reset($this->constants[$access]);
+ while (list($name, $const) = each($this->constants[$access])) {
+
+ $this->tpl->setVariable("NAME", $name);
+ $this->tpl->setVariable("VALUE", htmlentities($const["value"]));
+
+
+ if (isset($const["doc"]["shortdescription"]))
+ $this->tpl->setVariable("SHORTDESCRIPTION",
+$this->encode($const["doc"]["shortdescription"]["value"]));
+
+ if ("true" == $const["undoc"])
+ $this->tpl->setVariable("UNDOC", $this->undocumented);
+
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $this->tpl->setCurrentBlock("constantssummary");
+ $this->tpl->setVariable("ACCESS", ucfirst($access));
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ } // end func renderConstantSummary
+
+ /**
+ * Adds a detailed list of all constants to the template.
+ *
+ * The function assumes that there is a block named "constantdetails" and
+ * withing it another block named "constantdetails_loop".
+ *
+ * @see renderConstantSummary()
+ */
+ function renderConstantDetail() {
+
+ reset($this->accessModifiers);
+ while (list($k, $access) = each($this->accessModifiers)) {
+ if (0 == count($this->constants[$access]))
+ continue;
+
+ reset($this->constants[$access]);
+ while (list($name, $constant) = each($this->constants[$access])) {
+
+ $tplvars = array();
+ $tplvars["NAME" = $name;
+ $tplvars["CASE"] = $constant["case"];
+ $tplvars["VALUE"] = htmlentities($constant["value"]);
+
+ if ("true" == $constant["undoc"])
+ $tplvars["UNDOC"] = $this->undocumented;
+
+ if (isset($constant["doc"]["shortdescription"]))
+ $tplvars["SHORTDESCRIPTION"] =
+$this->encode($constant["doc"]["shortdescription"]["value"]);
+
+ if (isset($constant["doc"]["description"]))
+ $tplvars["DESCRIPTION"] =
+$this->encode($constant["doc"]["description"]["value"]);
+
+ $this->renderCommonDocfields("constantdetails_", $constant);
+
+ $this->tpl->setCurrentBlock("constantdetails_loop");
+ $this->tpl->setVariable($tplvars);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $this->tpl->setCurrentBlock("constantdetails");
+ $this->tpl->setVariable("ACCESS", ucfirst($access));
+ $this->tpl->parseCurrentBlock();
+ }
+
+ } // end func renderConstantsDetail
+
+ /**
+ * Adds a summary and a detailed list of included files to the template.
+ *
+ * @see renderUsesSummary(), renderUsesDetail()
+ */
+ function renderUses() {
+
+ $found = false;
+
+ reset($this->usesTypes);
+ while (list($k, $type) = each($this->usesTypes)) {
+
+ $this->uses[$type] = $this->accessor->getUsesByType($type);
+ if (!$found && 0 != count($this->uses[$type]))
+ $found = true;
+
+ }
+
+ if (!$found)
+ return;
+
+ $this->renderUsesSummary();
+ $this->renderUsesDetail();
+
+ $this->uses = array();
+ } // end func renderUses
+
+
+ /**
+ * Adds a detailed list of all included files to the template.
+ *
+ * The function assumes that there is a block names "usesdetail" and within the
+block
+ * a block names "usesdetail_loop" in the template.
+ *
+ * @see renderUsesSummary()
+ */
+ function renderUsesDetail() {
+
+ reset($this->usesTypes);
+ while (list($k, $type) = each($this->usesTypes)) {
+ if (0 == count($this->uses[$type]))
+ continue;
+
+ reset($this->uses[$type]);
+ while (list($file, $uses) = each($this->uses[$type])) {
+
+ $tplvars = array();
+ $tplvars["FILE"] = $uses["file"];
+ $tplvars["TYPE"] = $type;
+
+ if ("true" == $uses["undoc"])
+ $tplvars["UNDOC"] = $this->undocumented;
+
+ if (isset($uses["doc"]["shortdescription"]))
+ $tplvars["SHORTDESCRIPTION"] =
+$this->encode($uses["doc"]["shortdescription"]["value"]);
+
+ if (isset($uses["doc"]["description"]))
+ $tplvars["DESCRIPTION"] =
+$this->encode($uses["doc"]["description"]["value"]);
+
+ $this->renderCommonDocfields("usesdetails_", $uses);
+ $this->tpl->setCurrentBlock("usesdetails_loop");
+ $this->tpl->setVariable($tplvars);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $this->tpl->setCurrentBlock("usesdetails");
+ $this->tpl->setVariable("TYPE", $type);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ } // end func renderUsesDetail
+
+ /**
+ * Adds a summary of all included files to the template.
+ *
+ * The function assumes that there is a block names "usessummary" and within
+ * the block another block names "usessummary_loop" in the template.
+ *
+ * @see renderUsesDetail()
+ */
+ function renderUsesSummary() {
+
+ reset($this->usesTypes);
+ while (list($k, $type) = each($this->usesTypes)) {
+ if (0 == count($this->uses[$type]))
+ continue;
+
+ $this->tpl->setCurrentBlock("usessummary_loop");
+
+ reset($this->uses[$type]);
+ while (list($file, $uses) = each($this->uses[$type])) {
+
+ $this->tpl->setVariable("FILE", $file);
+ if (isset($uses["doc"]["shortdescription"]))
+ $this->tpl->setVariable("SHORTDESCRIPTION",
+$this->encode($uses["doc"]["shortdescription"]["value"]));
+
+ if ("true" == $uses["undoc"])
+ $this->tpl->setVariable("UNDOC", $this->undocumented);
+
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $this->tpl->setCurrentBlock("usessummary");
+ $this->tpl->setVariable("TYPE", $type);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ } // end func renderUsesSummary
+
+ /**
+ * Adds a summary and a detailed list of all functions to the template.
+ *
+ * @see renderFunctionSummary(), renderFunctionDetail(), $functions
+ */
+ function renderFunctions() {
+
+ $this->functions["private"] =
+$this->accessor->getFunctionsByAccess("private");
+ $this->functions["public"] = $this->accessor->getFunctionsByAccess("public");
+
+ if (0 == count($this->functions["private"]) && 0 ==
+count($this->functions["public"]))
+ return;
+
+ $this->renderFunctionSummary();
+ $this->renderFunctionDetail();
+ $this->functions = array();
+
+ } // end func renderFunctions
+
+ /**
+ * Adds a function summary to the template.
+ *
+ * The function assumes that there is ablock names "functionsummary" and
+ * within it a block names "functionsummary_loop" in the template.
+ *
+ * @see renderFunctionDetail(), renderFunctions(), $functions, $accessModifiers
+ */
+ function renderFunctionSummary() {
+
+ reset($this->accessModifiers);
+ while (list($k, $access) = each($this->accessModifiers)) {
+ if (0 == count($this->functions[$access]))
+ continue;
+
+ $this->tpl->setCurrentBlock("functionsummary_loop");
+ reset($this->functions[$access]);
+ while (list($name, $function) = each($this->functions[$access])) {
+
+ $this->tpl->setVariable("NAME", $name);
+
+ if (isset($function["doc"]["parameter"]))
+ $this->tpl->setVariable("PARAMETER",
+$this->getParameter($function["doc"]["parameter"]));
+
+ if (isset($function["doc"]["shortdescription"]))
+ $this->tpl->setVariable("SHORTDESCRIPTION",
+$this->encode($function["doc"]["shortdescription"]["value"]));
+
+ if (isset($function["doc"]["return"]))
+ $this->tpl->setVariable("RETURNTYPE",
+$function["doc"]["return"]["type"]);
+ else
+ $this->tpl->setVariable("RETURNTYPE", "void");
+
+ if ("true" == $function["undoc"])
+ $this->tpl->setVariable("UNDOC", $this->undocumented);
+
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $this->tpl->setCurrentBlock("functionsummary");
+ $this->tpl->setVariable("ACCESS", ucfirst($access) );
+ $this->tpl->parseCurrentBlock();
+ }
+
+ } // end func renderFunctionSummary
+
+ /**
+ * Adds a detailed list of functions to the template.
+ *
+ * The function assumes that there is a block named "functiondetails" and
+ * within it a bloc "functiondetails_loop" in the template.
+ *
+ * @see renderFunctions(), renderFunctionSummary(), $functions, $accessModifiers
+ */
+ function renderFunctionDetail() {
+
+ reset($this->accessModifiers);
+ while (list($k, $access) = each($this->accessModifiers)) {
+ if (0 == count($this->functions[$access]))
+ continue;
+
+ reset($this->functions[$access]);
+ while (list($name, $function) = each($this->functions[$access])) {
+
+ $tplvars = array();
+ $tplvars["NAME"] = $function["name"];
+ $tplvars["ACCESS"] = $function["access"];
+
+ if ("true" == $function["undoc"])
+ $tplvars["UNDOC"] = $this->undocumented;
+
+ if ("true" == $function["abstract"])
+ $tplvars["ABSTRACT"] = "abstract";
+
+ if ("true" == $function["static"])
+ $tplvars["STATIC"] = "static";
+
+ if (isset($function["doc"]["shortdescription"]))
+ $tplvars["SHORTDESCRIPTION"] =
+$this->encode($function["doc"]["shortdescription"]["value"]);
+
+ if (isset($function["doc"]["description"]))
+ $tplvars["DESCRIPTION"] =
+$this->encode($function["doc"]["description"]["value"]);
+
+ $this->renderCommonDocfields("functiondetails_", $function);
+
+ if (isset($function["doc"]["parameter"])) {
+ $tplvars["PARAMETER"] =
+$this->getParameter($function["doc"]["parameter"]);
+ $this->renderParameterDetail($function["doc"]["parameter"]);
+ }
+
+ if (isset($function["doc"]["throws"]))
+ $this->renderThrows($function["doc"]["throws"],
+"functiondetails_");
+
+ if (isset($function["doc"]["global"]))
+ $this->renderGlobals($function["doc"]["global"],
+"functiondetails_");
+
+ if (isset($function["doc"]["return"])) {
+
+ $tplvars["RETURNTYPE"] = $function["doc"]["return"]["type"];
+
+
+ $this->tpl->setCurrentBlock("functiondetails_return");
+ $this->tpl->setVariable("TYPE",
+$function["doc"]["return"]["type"]);
+ $this->tpl->setVariable("DESCRIPTION",
+$this->encode($function["doc"]["return"]["value"]));
+
+ if (isset($function["doc"]["return"]["name"]))
+ $this->tpl->setVariable("NAME",
+$function["doc"]["return"]["name"]);
+
+ $this->tpl->parseCurrentBlock();
+
+ } else {
+
+ $tplvars["RETURNTYPE"] = "void";
+
+ }
+
+ $this->tpl->setCurrentBlock("functiondetails_loop");
+ $this->tpl->setVariable($tplvars);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $this->tpl->setCurrentBlock("functiondetails");
+ $this->tpl->setVariable("ACCESS", ucfirst($access) );
+ $this->tpl->parseCurrentBlock();
+ }
+
+ } // end func renderFunctionDetail
+
+ /**
+ * Renders a detailed list of function parameters.
+ *
+ * The function assumes that there is a block named "functiondetails_parameter" in
+ * the template and within it a block named "functiondetails_parameter_loop".
+ *
+ * @param array Parameter
+ */
+ function renderParameterDetail($parameter) {
+
+ if (!isset($parameter[0]))
+ $parameter = array($parameter);
+
+ $this->tpl->setCurrentBlock("functiondetails_parameter_loop");
+
+ reset($parameter);
+ while (list($k, $param) = each($parameter)) {
+
+ $this->tpl->setVariable("NAME", $param["name"]);
+ $this->tpl->setVariable("DESCRIPTION", $this->encode($param["value"]));
+
+ if (isset($param["type"]))
+ $this->tpl->setVariable("TYPE", $param["type"]);
+
+ if (isset($param["default"]))
+ $this->tpl->setVariable("DEFAULT", "=
+>>".htmlentities($param["default"])."<<");
+
+ if ("true" == $param["undoc"])
+ $this->tpl->setVariable("UNDOC", $this->undocumented);
+
+ $this->tpl->parseCurrentBlock();
+ }
+
+ } // end func renderParameterDetail
+
+ /**
+ * Converts the XML parameter array into formatted string.
+ *
+ * @param array XML parameter array
+ * @return string Formatted parameter string
+ */
+ function getParameter($parameter) {
+
+ if (!is_array($parameter))
+ return "void";
+
+ $value = "";
+
+ if (!isset($parameter[0])) {
+
+ if (!isset($parameter["default"]))
+ $value .= $parameter["type"] . " " . $parameter["name"];
+ else
+ $value .= "[ ".$parameter["type"] . " " . $parameter["name"]." ]";
+
+ } else {
+
+ $flag_optional = false;
+
+ reset($parameter);
+ while (list($k, $param) = each($parameter)) {
+
+ if (!isset($param["default"])) {
+ if ($flag_optional) {
+ $value = substr($value, 0, -2) . " ], ";
+ $flag_optional = false;
+ }
+ } else {
+ if (!$flag_optional) {
+ $value .= "[ ";
+ $flag_optional = true;
+ }
+ }
+
+ $value .= $param["type"] . " " . $param["name"].", ";
+ }
+
+ $value = substr($value, 0, -2);
+ if ($flag_optional)
+ $value .= " ]";
+
+ }
+
+ return $value;
+ } // end func getParameter
+
+ /**
+ * Renders a block with references to other source elements.
+ *
+ * @param array XML references array
+ * @param string optional template blockname prefix
+ */
+ function renderSee($references, $prefix = "") {
+
+ $value = "";
+ if (!isset($references[0])) {
+
+ if (isset($references["group"]))
+ $value .= sprintf('<a href="%s#%s_%s">%s::%s</a>',
+
+$this->nameToUrl($references["group"]).$this->file_extension,
+ $references["type"],
+ $references["value"],
+ $references["group"],
+ $references["value"]
+ );
+ else
+ $value .= sprintf('<a href="#%s_%s">%s</a>',
+ $references["type"],
+ $references["value"],
+ $references["value"]
+ );
+
+ } else {
+
+ reset($references);
+ while (list($k, $reference) = each($references)) {
+
+ if (isset($reference["group"]))
+ $value .= sprintf('<a href="%s#%s_%s">%s::%s</a>, ',
+
+$this->nameToUrl($reference["group"]).$this->file_extension,
+ $reference["type"],
+ $reference["value"],
+ $reference["group"],
+ $reference["value"]
+ );
+ else
+ $value .= sprintf('<a href="#%s_%s">%s</a>, ',
+ $reference["type"],
+ $reference["value"],
+ $reference["value"]
+ );
+
+ }
+
+ $value = substr($value, 0, -2);
+ }
+
+ $this->tpl->setCurrentBlock(strtolower($prefix) . "see");
+ $this->tpl->setVariable("SEE", $value);
+ $this->tpl->parseCurrentBlock();
+
+ } // end func renderSee
+
+ /**
+ * Renders an author list.
+ *
+ * @param array XML author array
+ * @param string optional template blockname prefix
+ */
+ function renderAuthors($authors, $prefix = "") {
+
+ $value = "";
+
+ if (!isset($authors[0])) {
+
+ if (isset($authors["email"]))
+ $value .= sprintf('%s <<a href="mailto:%s">%s</a>>, ',
+$authors["value"], $authors["email"], $authors["email"]);
+ else
+ $value .= $authors["email"] . ", ";
+
+ } else {
+
+ reset($authors);
+ while (list($k, $author) = each($authors)) {
+
+ if (isset($author["email"]))
+ $value .= sprintf('%s <<a href="mailto:%s">%s</a>>, ',
+$author["value"], $author["email"], $author["email"]);
+ else
+ $value .= $author["email"] . ", ";
+
+ }
+
+ }
+
+ $value = substr($value, 0, -2);
+ $this->tpl->setCurrentBlock(strtolower($prefix) . "authors");
+ $this->tpl->setVariable("AUTHOR", $value);
+ $this->tpl->parseCurrentBlock();
+
+ } // end func renderAuthors
+
+ /**
+ * Renders a list of external links.
+ *
+ * @param array XML link array
+ * @param string optional template blockname prefix
+ */
+ function renderLinks($links, $prefix = "") {
+
+ $value = "";
+ if (!isset($links[0])) {
+ $value .= sprintf('<a href="%s">%s</a>%s, ',
+ $links["url"],
+ $links["url"],
+ ("" != $links["description"]) ? " - " .
+$links["description"] : ""
+ );
+ } else {
+
+ reset($links);
+ while (list($k, $link) = each($links)) {
+ $value .= sprintf('<a href="%s">%s</a>%s, ',
+ $link["url"],
+ $link["url"],
+ ("" != $link["description"]) ? " - " .
+$links["description"] : ""
+ );
+ }
+
+ }
+
+ $value = substr($value, 0, 2);
+ $this->tpl->setCurrentBlock(strtolower($prefix) . "links");
+ $this->tpl->setVariable("LINK", $value);
+ $this->tpl->parseCurrentBlock();
+
+ } // end func renderLinks
+
+ /**
+ * Renders a list of exceptions.
+ *
+ * @param array XML array
+ * @param string optional template blockname prefix
+ */
+ function renderThrows($throws, $prefix = "") {
+
+ $value = "";
+ if (!isset($throws[0])) {
+
+ $value = $throws["value"];
+
+ } else {
+
+ reset($throws);
+ while (list($k, $exception) = each($throws))
+ $value .= sprintf("%s, ", $exception["value"]);
+
+ $value = substr($value, 0, -2);
+
+ }
+
+ $this->tpl->setCurrentBlock(strtolower($prefix) . "throws");
+ $this->tpl->setVariable("EXCEPTIONS", $value);
+ $this->tpl->parseCurrentBlock();
+
+ } // end func renderThrows
+
+ /**
+ * Renders a list of global elements.
+ *
+ * @param array XML globals array
+ * @param string optional template blockname prefix
+ */
+ function renderGlobals($globals, $prefix = "") {
+
+ $prefix = strtolower($prefix);
+ $this->tpl->setCurrentBlock($prefix . "globals_loop");
+
+ if (!isset($globals[0])) {
+
+ $this->tpl->setVariable("NAME", $globals["name"]);
+ $this->tpl->setVariable("DESCRIPTION", $this->encode($globals["value"]));
+
+ if (isset($globals["type"]))
+ $this->tpl->setVariable("TYPE", $globals["type"]);
+
+ $this->tpl->parseCurrentBlock();
+
+ } else {
+
+ reset($globals);
+ while (list($k, $global) = each($globals)) {
+
+ $this->tpl->setVariable("NAME", $global["name"]);
+ $this->tpl->setVariable("DESCRIPTION",
+$this->encode($global["value"]));
+
+ if (isset($globals["type"]))
+ $this->tpl->setVariable("TYPE", $globals["type"]);
+
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ }
+
+ } // end func renderGlobals
+
+ /**
+ * Adds some tags to the template that are allowed nearly everywhere.
+ *
+ * @param string template blockname prefixs
+ * @param array
+ * @see $simpleDocfields, renderLinks(), renderAuthors(), renderSee()
+ */
+ function renderCommonDocfields($block, &$data) {
+
+ reset($this->simpleDocfields);
+ while (list($varname, $field) = each($this->simpleDocfields)) {
+
+ if (isset($data["doc"][$field])) {
+
+ $this->tpl->setCurrentBlock($block.$field);
+ $this->tpl->setVariable($varname,
+htmlentities($data["doc"][$field]["value"]));
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ }
+
+ if (isset($data["doc"]["link"]))
+ $this->renderLinks($data["doc"]["link"], $block);
- if (isset($data["doc"]["author"]))
- $this->renderAuthors($data["doc"]["author"], $block);
+ if (isset($data["doc"]["author"]))
+ $this->renderAuthors($data["doc"]["author"], $block);
- if (isset($data["doc"]["see"]))
- $this->renderSee($data["doc"]["see"], $block);
+ if (isset($data["doc"]["see"]))
+ $this->renderSee($data["doc"]["see"], $block);
- } // end func renderCommonDocfields
+ } // end func renderCommonDocfields
} // end func PhpdocHTMLDocumentRenderer
?>
Index: php4/pear/PHPDoc/renderer/html/PhpdocHTMLIndexRenderer.php
diff -u php4/pear/PHPDoc/renderer/html/PhpdocHTMLIndexRenderer.php:1.5
php4/pear/PHPDoc/renderer/html/PhpdocHTMLIndexRenderer.php:1.6
--- php4/pear/PHPDoc/renderer/html/PhpdocHTMLIndexRenderer.php:1.5 Thu Jan 11
14:09:38 2001
+++ php4/pear/PHPDoc/renderer/html/PhpdocHTMLIndexRenderer.php Sun Feb 18 08:29:21
+2001
@@ -1,457 +1,459 @@
<?php
/**
* Renders Index lists.
+*
+* @version $Id: PhpdocHTMLIndexRenderer.php,v 1.6 2001/02/18 16:29:21 uw Exp $
*/
class PhpdocHTMLIndexRenderer extends PhpdocHTMLRenderer {
- /**
- * Some container in the package list.
- *
- * @var array
- * @see renderPackagelist()
- */
- var $packageFields = array("class", "module");
-
- /**
- * Packagelist from the PhpdocIndexAccessor
- *
- * @var array
- */
- var $packages = array();
-
- /**
- * Array with classtree informations
- *
- * @var array
- */
- var $classtree = array();
-
- /**
- * IntegratedTemplate Object used be renderClasstree()
- *
- * @var object IntegratedTemplate
- * @see renderClasstree()
- */
- var $treeTpl;
-
- /**
- * IntegratedTemplateObject used by renderModulegroup()
- *
- * @var object IntegratedTemplate
- * @see renderModulegroup()
- */
- var $moduleTpl;
-
- /**
- * Sets the xml and template root directory.
- *
- * @param string XML file path
- * @param string Template file path
- * @param string Name of the application
- * @param string Filename extension
- * @see setPath(), setTemplateRoot()
- */
- function PhpdocHTMLIndexRenderer($path, $templateRoot, $application,
$extension = ".html") {
-
- $this->setPath($path);
- $this->setTemplateRoot($templateRoot);
- $this->application = $application;
- $this->file_extension = $extension;
-
- $this->accessor = new PhpdocIndexAccessor;
- $this->tpl = new IntegratedTemplate($this->templateRoot);
- $this->fileHandler = new PhpdocFileHandler;
-
- } // end constructor
-
- /**
- * Builds all index files phpdoc needs assuming that the xml files have default
names
- *
- * @access public
- * @see renderElementlist(), renderPackagelist(), renderFramelementlist(),
renderFramePackageSummary()
- */
- function generate() {
-
- $this->renderElementlist("elementlist.xml");
- $this->renderFrameElementlist("elementlist.xml");
- $this->renderPackagelist("packagelist.xml");
- $this->renderFramePackageSummary("packagelist.xml");
- $this->renderFrameElementlist("packagelist.xml");
-
- } // end function generate
-
- /**
- * Saves the generated classtree summary to disk.
- *
- * @see renderClasstree()
- * @access public
- */
- function finishClasstree() {
-
- if (!is_object($this->treeTpl))
- return;
-
- $this->treeTpl->setVariable("APPNAME", $this->application);
-
$this->fileHandler->createFile($this->path."phpdoc_classtree".$this->file_extension,
$this->treeTpl->get() );
- $this->treeTpl = "";
-
- } // end func finishClasstree
-
- /**
- * Adds a classtree to the classtree summary template.
- *
- * @param string XML Classtree file
- * @see finishClasstree()
- * @access public
- */
- function addClasstree($xmlfile) {
-
- $this->accessor->loadXMLFile($this->path.$xmlfile);
-
- if (!is_object($this->treeTpl)) {
- $this->treeTpl = new IntegratedTemplate($this->templateRoot);
- $this->treeTpl->loadTemplatefile("classtree.html");
- }
-
- $this->classtree = $this->accessor->getClasstree();
- $this->treeTpl->setCurrentBlock("classtree");
- $this->treeTpl->setVariable("BASECLASS",
$this->classtree["baseclass"]);
- $this->treeTpl->setVariable("TREE",
"<ul>".$this->buildClasstreeHTML($this->classtree["baseclass"])."</ul>");
- $this->treeTpl->parseCurrentBlock();
-
- return true;
- } // end func addClasstree
-
- function finishModulegroup() {
-
- if (!is_object($this->moduleTpl))
- return;
-
- $this->moduleTpl->setVariable("APPNAME", $this->application);
-
$this->fileHandler->createFile($this->path."phpdoc_modulegroup".$this->file_extension,
$this->moduleTpl->get() );
- $this->moduleTpl = "";
- } // end func finishModulegroups
-
- /**
- * Renders a modulegroup xml file.
- *
- * @param string XML File
- */
- function addModulegroup($xmlfile) {
-
- $this->accessor->loadXMLFile($this->path.$xmlfile);
-
- if (!is_object($this->moduleTpl)) {
- $this->moduleTpl = new
IntegratedTemplate($this->templateRoot);
- $this->moduleTpl->loadTemplateFile("modulegroup.html");
- }
-
- $modulegroup = $this->accessor->getModulegroup();
- $modules = "<ul>";
-
- reset($modulegroup["modules"]);
- while (list($k, $module) = each($modulegroup["modules"]))
- $modules .= sprintf('<li><a href="%s">%s</a>',
$this->nameToUrl($module) . $this->file_extension, $module);
-
- $modules .= "</ul>";
-
- $this->moduleTpl->setCurrentBlock("modulegroup");
- $this->moduleTpl->setVariable("MODULEGROUP", $modulegroup["group"]);
- $this->moduleTpl->setVariable("MODULES", $modules);
- $this->moduleTpl->parseCurrentBlock();
-
- } // end func addModulegroup
-
- /**
- * Renders the element index list.
- *
- * @param string XML file
- * @access public
- * @see generate()
- */
- function renderElementlist($xmlfile) {
-
- $this->accessor->loadXMLFile($this->path.$xmlfile);
- $this->tpl->loadTemplatefile("elementlist.html");
-
- $chapters = $this->accessor->getChapternames();
- if (0 != count($chapters)) {
-
- $this->tpl->setCurrentBlock("chaptersummary_loop");
-
- reset($chapters);
- while (list($k, $chapter) = each($chapters)) {
- $this->tpl->setVariable("CHAPTER", $chapter);
- $this->tpl->parseCurrentBlock();
- }
-
- $chapters = $this->accessor->getChapters();
- reset($chapters);
- while (list($name, $elements) = each($chapters)) {
-
- if (!isset($elements["element"][0]))
- $elements["element"] =
array($elements["element"]);
-
- $this->tpl->setCurrentBlock("chapter_loop");
-
- reset($elements["element"]);
- while (list($k, $element) =
each($elements["element"])) {
-
- switch($element["type"]) {
- case "package":
- $desc = "Package";
- break;
-
- case "class":
- $desc = sprintf('Class <a
href="%s">%s</a>.',
-
$this->nameToUrl($element["name"]) .
$this->file_extension,
-
$element["name"]
-
);
- break;
-
- case "module":
- $desc = sprintf('Module <a
href="%s">%s</a>.',
-
$this->nameToUrl($element["name"]) .
$this->file_extension,
-
$element["name"]
-
);
- break;
-
- case "functions":
- $desc = sprintf('Function in
%s <a href="%s">%s</a>',
-
$element["sourcetype"],
-
$this->nameToUrl($element["source"]) .
$this->file_extension,
-
$element["source"]
-
);
- break;
-
- case "variables":
- $desc = sprintf('Variable in
Class <a href="%s">%s</a>',
-
$this->nameToUrl($element["source"]) .
$this->file_extension,
-
$element["source"]
-
);
- break;
-
- case "uses":
- $desc = sprintf('Included file
in %s <a href="%s">%s</a>',
-
$element["sourcetype"],
-
$this->nameToUrl($element["source"]) .
$this->file_extension,
-
$element["source"]
-
);
- break;
-
- case "consts":
- $desc = sprintf('Constant
defined in %s <a href="%s">%s</a>',
-
$element["sourcetype"],
-
$this->nameToUrl($element["source"]) .
$this->file_extension,
-
$element["source"]
-
);
- break;
-
- }
-
- $this->tpl->setVariable("ELEMENTNAME",
$element["name"]);
- $this->tpl->setVariable("ELEMENT", $desc);
- $this->tpl->setVariable("SHORTDESCRIPTION",
$element["value"]);
- $this->tpl->parseCurrentBlock();
-
- }
-
- $this->tpl->setCurrentBlock("chapter");
- $this->tpl->setVariable("CHAPTER", $name);
- $this->tpl->parseCurrentBlock();
-
- }
-
- }
-
- $this->tpl->setVariable("APPNAME", $this->application);
- $this->fileHandler->createFile($this->path . "phpdoc_elementlist" .
$this->file_extension, $this->tpl->get() );
- $this->tpl->free();
-
- } // end func renderElementlist
-
- /**
- * Renders a complete packagelist.
- *
- * @param string XML file
- * @access public
- * @see renderFrameElementlist(), renderFramePackagesummary()
- */
- function renderPackagelist($xmlfile) {
-
- $this->loadPackagelist($xmlfile);
- $this->tpl->loadTemplatefile("packagelist.html");
-
- reset($this->packages);
- while (list($packagename, $package) = each($this->packages)) {
-
- reset($this->packageFields);
- while (list($k, $field) = each($this->packageFields)) {
- if (!isset($package[$field]))
- continue;
-
-
$this->tpl->setCurrentBlock("package_".$field."_loop");
-
- reset($package[$field]);
- while (list($k, $element) = each($package[$field])) {
-
- $this->tpl->setVariable("ELEMENT", sprintf('<a
href="%s">%s</a>',
-
$this->nameToUrl($element) .
$this->file_extension,
-
$element
-
)
-
);
-
- $this->tpl->parseCurrentBlock();
- }
-
- $this->tpl->setCurrentBlock("package_" . $field);
- $this->tpl->setVariable("EMPTY", "");
- $this->tpl->parseCurrentBlock();
-
- }
-
- $this->tpl->setCurrentBlock("package");
- $this->tpl->setVariable("PACKAGE_NAME", $packagename);
- $this->tpl->parseCurrentBlock();
-
- }
-
- $this->tpl->setVariable("APPNAME", $this->application);
- $this->fileHandler->createFile($this->path . "phpdoc_packagelist" .
$this->file_extension, $this->tpl->get() );
- $this->tpl->free();
-
- } // end func renderPackagelist
-
- /**
- * Renders files for the lower left frame with the elements of a certain file.
- *
- * @param string This function needs the packagelist.xml to work!
- * @access public
- * @see renderFramePackagesummary(), renderPackagelist()
- */
- function renderFrameElementlist($xmlfile) {
-
- $this->loadPackagelist($xmlfile);
-
- reset($this->packages);
- while (list($packagename, $package) = each($this->packages)) {
-
- $this->tpl->loadTemplatefile("frame_packageelementlist.html");
-
- reset($this->packageFields);
- while (list($k, $field) = each($this->packageFields)) {
-
- if (!isset($package[$field]))
- continue;
-
-
$this->tpl->setCurrentBlock("package_".$field."_loop");
-
- reset($package[$field]);
- while (list($k, $element) = each($package[$field])) {
-
- $this->tpl->setVariable("ELEMENT", sprintf('<a
href="%s" target="main">%s</a>',
-
$this->nameToUrl($element) .
$this->file_extension,
-
$element
-
)
-
);
- $this->tpl->parseCurrentBlock();
- }
-
- $this->tpl->setCurrentBlock("package_" . $field);
- $this->tpl->setVariable("EMPTY", "");
- $this->tpl->parseCurrentBlock();
-
- }
-
- $this->tpl->setCurrentBlock("package");
- $this->tpl->setVariable("PACKAGE_NAME", $packagename);
- $this->tpl->parseCurrentBlock();
-
- $this->tpl->setVariable("APPNAME", $this->application);
- $packagename = $this->nameToUrl($packagename);
- $this->fileHandler->createFile($this->path .
"packageelementlist_" . $packagename . $this->file_extension, $this->tpl->get() );
-
- }
-
- $this->tpl->free();
-
- } // end func renderFrameElementlist
-
- /**
- * Renders a Packagesummary for the frameset.
- *
- * @param string XML file.
- * @access public
- * @see renderPackagelist(), renderFrameElementlist()
- */
- function renderFramePackagesummary($xmlfile) {
-
- $this->loadPackagelist($xmlfile);
-
- $this->tpl->loadTemplatefile("frame_packagelist.html");
- $this->tpl->setCurrentBlock("package");
-
- reset($this->packages);
- while (list($packagename, $v) = each($this->packages)) {
-
- $this->tpl->setVariable("PACKAGE", sprintf('<a
href="packageelementlist_%s" target="elements">%s</a>',
-
$this->nameToUrl($packagename) .
$this->file_extension,
-
$packagename )
-
);
- $this->tpl->parseCurrentBlock();
-
- }
-
- $this->tpl->setVariable("APPNAME", $this->application);
- $this->fileHandler->createFile($this->path . "frame_packagelist" .
$this->file_extension, $this->tpl->get() );
- $this->tpl->free();
-
- } // end func renderFramePackagesummary
-
- /**
- * Imports the packagelist from the PhpdocIndexAccessor if not done previously.
- *
- * @param string XMl file.
- * @see $packages
- */
- function loadPackagelist($xmlfile) {
-
- if (0 == count($this->packages)) {
- $this->accessor->loadXMLFile($this->path . $xmlfile);
- $this->packages = $this->accessor->getPackagelist();
- }
-
- } // end func loadPackagelist
-
- /**
- * Recursivly builds an HTML class tree using <ul><li></ul>.
- *
- * @param string Name of the class the recursive loop starts with
- * @see renderClasstree()
- */
- function buildClasstreeHTML($class) {
-
- $html = "";
-
- if (0 == count($this->classtree["classes"][$class])) {
-
- $html .= sprintf('<li><a href="%s">%s</a>',
$this->nameToUrl($class) . $this->file_extension, $class);
-
- } else {
-
- $html .= sprintf('<li><a href="%s">%s</a>',
$this->nameToUrl($class) . $this->file_extension, $class);
- $html .= "<ul>";
-
- reset($this->classtree["classes"][$class]);
- while (list($k, $subclass) =
each($this->classtree["classes"][$class]))
- $html .= $this->buildClasstreeHTML($subclass);
+ /**
+ * Some container in the package list.
+ *
+ * @var array
+ * @see renderPackagelist()
+ */
+ var $packageFields = array("class", "module");
+
+ /**
+ * Packagelist from the PhpdocIndexAccessor
+ *
+ * @var array
+ */
+ var $packages = array();
+
+ /**
+ * Array with classtree informations
+ *
+ * @var array
+ */
+ var $classtree = array();
+
+ /**
+ * IntegratedTemplate Object used be renderClasstree()
+ *
+ * @var object IntegratedTemplate
+ * @see renderClasstree()
+ */
+ var $treeTpl;
+
+ /**
+ * IntegratedTemplateObject used by renderModulegroup()
+ *
+ * @var object IntegratedTemplate
+ * @see renderModulegroup()
+ */
+ var $moduleTpl;
+
+ /**
+ * Sets the xml and template root directory.
+ *
+ * @param string XML file path
+ * @param string Template file path
+ * @param string Name of the application
+ * @param string Filename extension
+ * @see setPath(), setTemplateRoot()
+ */
+ function PhpdocHTMLIndexRenderer($path, $templateRoot, $application, $extension =
+".html") {
+
+ $this->setPath($path);
+ $this->setTemplateRoot($templateRoot);
+ $this->application = $application;
+ $this->file_extension = $extension;
+
+ $this->accessor = new PhpdocIndexAccessor;
+ $this->tpl = new IntegratedTemplate($this->templateRoot);
+ $this->fileHandler = new PhpdocFileHandler;
+
+ } // end constructor
+
+ /**
+ * Builds all index files phpdoc needs assuming that the xml files have default
+names
+ *
+ * @access public
+ * @see renderElementlist(), renderPackagelist(), renderFramelementlist(),
+renderFramePackageSummary()
+ */
+ function generate() {
+
+ $this->renderElementlist("elementlist.xml");
+ $this->renderFrameElementlist("elementlist.xml");
+ $this->renderPackagelist("packagelist.xml");
+ $this->renderFramePackageSummary("packagelist.xml");
+ $this->renderFrameElementlist("packagelist.xml");
+
+ } // end function generate
+
+ /**
+ * Saves the generated classtree summary to disk.
+ *
+ * @see renderClasstree()
+ * @access public
+ */
+ function finishClasstree() {
+
+ if (!is_object($this->treeTpl))
+ return;
+
+ $this->treeTpl->setVariable("APPNAME", $this->application);
+ $this->fileHandler->createFile($this->path . "phpdoc_classtree" .
+$this->file_extension, $this->treeTpl->get() );
+ $this->treeTpl = "";
+
+ } // end func finishClasstree
+
+ /**
+ * Adds a classtree to the classtree summary template.
+ *
+ * @param string XML Classtree file
+ * @see finishClasstree()
+ * @access public
+ */
+ function addClasstree($xmlfile) {
+
+ $this->accessor->loadXMLFile($this->path.$xmlfile);
+
+ if (!is_object($this->treeTpl)) {
+ $this->treeTpl = new IntegratedTemplate($this->templateRoot);
+ $this->treeTpl->loadTemplatefile("classtree.html");
+ }
+
+ $this->classtree = $this->accessor->getClasstree();
+ $this->treeTpl->setCurrentBlock("classtree");
+ $this->treeTpl->setVariable("BASECLASS", $this->classtree["baseclass"]);
+ $this->treeTpl->setVariable("TREE", "<ul>" .
+$this->buildClasstreeHTML($this->classtree["baseclass"]) . "</ul>");
+ $this->treeTpl->parseCurrentBlock();
+
+ return true;
+ } // end func addClasstree
+
+ function finishModulegroup() {
+
+ if (!is_object($this->moduleTpl))
+ return;
+
+ $this->moduleTpl->setVariable("APPNAME", $this->application);
+ $this->fileHandler->createFile($this->path . "phpdoc_modulegroup" .
+$this->file_extension, $this->moduleTpl->get() );
+ $this->moduleTpl = "";
+ } // end func finishModulegroups
+
+ /**
+ * Renders a modulegroup xml file.
+ *
+ * @param string XML File
+ */
+ function addModulegroup($xmlfile) {
+
+ $this->accessor->loadXMLFile($this->path.$xmlfile);
+
+ if (!is_object($this->moduleTpl)) {
+ $this->moduleTpl = new IntegratedTemplate($this->templateRoot);
+ $this->moduleTpl->loadTemplateFile("modulegroup.html");
+ }
+
+ $modulegroup = $this->accessor->getModulegroup();
+ $modules = "<ul>";
+
+ reset($modulegroup["modules"]);
+ while (list($k, $module) = each($modulegroup["modules"]))
+ $modules .= sprintf('<li><a href="%s">%s</a>', $this->nameToUrl($module)
+. $this->file_extension, $module);
+
+ $modules .= "</ul>";
+
+ $this->moduleTpl->setCurrentBlock("modulegroup");
+ $this->moduleTpl->setVariable("MODULEGROUP", $modulegroup["group"]);
+ $this->moduleTpl->setVariable("MODULES", $modules);
+ $this->moduleTpl->parseCurrentBlock();
+
+ } // end func addModulegroup
+
+ /**
+ * Renders the element index list.
+ *
+ * @param string XML file
+ * @access public
+ * @see generate()
+ */
+ function renderElementlist($xmlfile) {
+
+ $this->accessor->loadXMLFile($this->path.$xmlfile);
+ $this->tpl->loadTemplatefile("elementlist.html");
+
+ $chapters = $this->accessor->getChapternames();
+ if (0 != count($chapters)) {
+
+ $this->tpl->setCurrentBlock("chaptersummary_loop");
+
+ reset($chapters);
+ while (list($k, $chapter) = each($chapters)) {
+ $this->tpl->setVariable("CHAPTER", $chapter);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $chapters = $this->accessor->getChapters();
+ reset($chapters);
+ while (list($name, $elements) = each($chapters)) {
+
+ if (!isset($elements["element"][0]))
+ $elements["element"] = array($elements["element"]);
+
+ $this->tpl->setCurrentBlock("chapter_loop");
+
+ reset($elements["element"]);
+ while (list($k, $element) = each($elements["element"])) {
+
+ switch($element["type"]) {
+ case "package":
+ $desc = "Package";
+ break;
+
+ case "class":
+ $desc = sprintf('Class <a href="%s">%s</a>.',
+ $this->nameToUrl($element["name"]) .
+$this->file_extension,
+ $element["name"]
+ );
+ break;
+
+ case "module":
+ $desc = sprintf('Module <a href="%s">%s</a>.',
+ $this->nameToUrl($element["name"]) .
+$this->file_extension,
+ $element["name"]
+ );
+ break;
+
+ case "functions":
+ $desc = sprintf('Function in %s <a href="%s">%s</a>',
+ $element["sourcetype"],
+ $this->nameToUrl($element["source"])
+. $this->file_extension,
+ $element["source"]
+ );
+ break;
+
+ case "variables":
+ $desc = sprintf('Variable in Class <a href="%s">%s</a>',
+ $this->nameToUrl($element["source"])
+. $this->file_extension,
+ $element["source"]
+ );
+ break;
+
+ case "uses":
+ $desc = sprintf('Included file in %s <a href="%s">%s</a>',
+ $element["sourcetype"],
+ $this->nameToUrl($element["source"])
+. $this->file_extension,
+ $element["source"]
+ );
+ break;
+
+ case "consts":
+ $desc = sprintf('Constant defined in %s <a
+href="%s">%s</a>',
+ $element["sourcetype"],
+ $this->nameToUrl($element["source"])
+. $this->file_extension,
+ $element["source"]
+ );
+ break;
+
+ }
+
+ $this->tpl->setVariable("ELEMENTNAME", $element["name"]);
+ $this->tpl->setVariable("ELEMENT", $desc);
+ $this->tpl->setVariable("SHORTDESCRIPTION", $element["value"]);
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ $this->tpl->setCurrentBlock("chapter");
+ $this->tpl->setVariable("CHAPTER", $name);
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ }
+
+ $this->tpl->setVariable("APPNAME", $this->application);
+ $this->fileHandler->createFile($this->path . "phpdoc_elementlist" .
+$this->file_extension, $this->tpl->get() );
+ $this->tpl->free();
+
+ } // end func renderElementlist
+
+ /**
+ * Renders a complete packagelist.
+ *
+ * @param string XML file
+ * @access public
+ * @see renderFrameElementlist(), renderFramePackagesummary()
+ */
+ function renderPackagelist($xmlfile) {
+
+ $this->loadPackagelist($xmlfile);
+ $this->tpl->loadTemplatefile("packagelist.html");
+
+ reset($this->packages);
+ while (list($packagename, $package) = each($this->packages)) {
+
+ reset($this->packageFields);
+ while (list($k, $field) = each($this->packageFields)) {
+ if (!isset($package[$field]))
+ continue;
+
+ $this->tpl->setCurrentBlock("package_".$field."_loop");
+
+ reset($package[$field]);
+ while (list($k, $element) = each($package[$field])) {
+
+ $this->tpl->setVariable("ELEMENT", sprintf('<a href="%s">%s</a>',
+
+$this->nameToUrl($element) . $this->file_extension,
+ $element
+ )
+ );
+
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $this->tpl->setCurrentBlock("package_" . $field);
+ $this->tpl->setVariable("EMPTY", "");
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ $this->tpl->setCurrentBlock("package");
+ $this->tpl->setVariable("PACKAGE_NAME", $packagename);
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ $this->tpl->setVariable("APPNAME", $this->application);
+ $this->fileHandler->createFile($this->path . "phpdoc_packagelist" .
+$this->file_extension, $this->tpl->get() );
+ $this->tpl->free();
+
+ } // end func renderPackagelist
+
+ /**
+ * Renders files for the lower left frame with the elements of a certain file.
+ *
+ * @param string This function needs the packagelist.xml to work!
+ * @access public
+ * @see renderFramePackagesummary(), renderPackagelist()
+ */
+ function renderFrameElementlist($xmlfile) {
+
+ $this->loadPackagelist($xmlfile);
+
+ reset($this->packages);
+ while (list($packagename, $package) = each($this->packages)) {
+
+ $this->tpl->loadTemplatefile("frame_packageelementlist.html");
+
+ reset($this->packageFields);
+ while (list($k, $field) = each($this->packageFields)) {
+
+ if (!isset($package[$field]))
+ continue;
+
+ $this->tpl->setCurrentBlock("package_" . $field . "_loop");
+
+ reset($package[$field]);
+ while (list($k, $element) = each($package[$field])) {
+
+ $this->tpl->setVariable("ELEMENT", sprintf('<a href="%s"
+target="main">%s</a>',
+
+$this->nameToUrl($element) . $this->file_extension,
+ $element
+ )
+ );
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $this->tpl->setCurrentBlock("package_" . $field);
+ $this->tpl->setVariable("EMPTY", "");
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ $this->tpl->setCurrentBlock("package");
+ $this->tpl->setVariable("PACKAGE_NAME", $packagename);
+ $this->tpl->parseCurrentBlock();
+
+ $this->tpl->setVariable("APPNAME", $this->application);
+ $packagename = $this->nameToUrl($packagename);
+ $this->fileHandler->createFile($this->path . "packageelementlist_" .
+$packagename . $this->file_extension, $this->tpl->get() );
+
+ }
+
+ $this->tpl->free();
+
+ } // end func renderFrameElementlist
+
+ /**
+ * Renders a Packagesummary for the frameset.
+ *
+ * @param string XML file.
+ * @access public
+ * @see renderPackagelist(), renderFrameElementlist()
+ */
+ function renderFramePackagesummary($xmlfile) {
+
+ $this->loadPackagelist($xmlfile);
+
+ $this->tpl->loadTemplatefile("frame_packagelist.html");
+ $this->tpl->setCurrentBlock("package");
+
+ reset($this->packages);
+ while (list($packagename, $v) = each($this->packages)) {
+
+ $this->tpl->setVariable("PACKAGE", sprintf('<a
+href="packageelementlist_%s" target="elements">%s</a>',
+
+$this->nameToUrl($packagename) . $this->file_extension,
+ $packagename )
+ );
+ $this->tpl->parseCurrentBlock();
+
+
+ }
+
+ $this->tpl->setVariable("APPNAME", $this->application);
+ $this->fileHandler->createFile($this->path . "frame_packagelist" .
+$this->file_extension, $this->tpl->get() );
+ $this->tpl->free();
+
+ } // end func renderFramePackagesummary
+
+ /**
+ * Imports the packagelist from the PhpdocIndexAccessor if not done previously.
+ *
+ * @param string XML file.
+ * @see $packages
+ */
+ function loadPackagelist($xmlfile) {
+
+ if (0 == count($this->packages)) {
+ $this->accessor->loadXMLFile($this->path . $xmlfile);
+ $this->packages = $this->accessor->getPackagelist();
+ }
+
+ } // end func loadPackagelist
+
+ /**
+ * Recursivly builds an HTML class tree using <ul><li></ul>.
+ *
+ * @param string Name of the class the recursive loop starts with
+ * @see renderClasstree()
+ */
+ function buildClasstreeHTML($class) {
+
+ $html = "";
+
+ if (0 == count($this->classtree["classes"][$class])) {
+
+ $html .= sprintf('<li><a href="%s">%s</a>', $this->nameToUrl($class) .
+$this->file_extension, $class);
+
+ } else {
+
+ $html .= sprintf('<li><a href="%s">%s</a>', $this->nameToUrl($class) .
+$this->file_extension, $class);
+ $html .= "<ul>";
+
+ reset($this->classtree["classes"][$class]);
+ while (list($k, $subclass) = each($this->classtree["classes"][$class]))
+ $html .= $this->buildClasstreeHTML($subclass);
- $html .= "</ul>";
+ $html .= "</ul>";
- }
+ }
- return $html;
- } // end func buildClasstreeHTML
+ return $html;
+ } // end func buildClasstreeHTML
} // end class PhpdocHTMLIndexRenderer
-?>
+?>
\ No newline at end of file
Index: php4/pear/PHPDoc/renderer/html/PhpdocHTMLModuleRenderer.php
diff -u php4/pear/PHPDoc/renderer/html/PhpdocHTMLModuleRenderer.php:1.4
php4/pear/PHPDoc/renderer/html/PhpdocHTMLModuleRenderer.php:1.5
--- php4/pear/PHPDoc/renderer/html/PhpdocHTMLModuleRenderer.php:1.4 Sun Dec 3
14:37:37 2000
+++ php4/pear/PHPDoc/renderer/html/PhpdocHTMLModuleRenderer.php Sun Feb 18 08:29:21
+2001
@@ -2,94 +2,94 @@
/**
* Renders modules.
*
-* @version $Id: PhpdocHTMLModuleRenderer.php,v 1.4 2000/12/03 22:37:37 uw Exp $
+* @version $Id: PhpdocHTMLModuleRenderer.php,v 1.5 2001/02/18 16:29:21 uw Exp $
*/
class PhpdocHTMLModuleRenderer extends PhpdocHTMLDocumentRenderer {
- /**
- * Sets the xml and template root directory.
- *
- * @param string XML file path
- * @param string Template file path
- * @param string Name of the current application
- * @param string Filename extension
- * @see setPath(), setTemplateRoot()
- */
- function PhpdocHTMLModuleRenderer($path, $templateRoot, $application,
$extension = ".html") {
-
- $this->setPath($path);
- $this->setTemplateRoot($templateRoot);
- $this->application = $application;
- $this->file_extension = $extension;
-
- $this->accessor = new PhpdocModuleAccessor;
- $this->tpl = new IntegratedTemplate($this->templateRoot);
- $this->fileHandler = new PhpdocFileHandler;
-
- } // end constructor
-
- /**
- * Renders a module
- *
- * @param string XML source file
- * @param string Name of the HTML target file.
- * @access public
- */
- function renderModule($xmlfile, $htmlfile = "") {
-
- $this->tpl->loadTemplatefile("module.html");
- if ("" == $htmlfile)
- $htmlfile = substr($xmlfile, 7, -4) . $this->file_extension;
-
- $this->accessor->loadXMLFile($this->path . $xmlfile);
- $module = $this->accessor->getModuledata();
-
- $this->renderFunctions();
- $this->renderUses();
- $this->renderConstants();
-
- $tplvars = array();
- $tplvars["MODULE_FILE"] = $module["file"]["value"];
- $tplvars["MODULE_NAME"] = $module["name"];
- $tplvars["MODULE_GROUP"] = $module["group"];
- $tplvars["MODULE_ACCESS"] = $module["access"];
- $tplvars["MODULE_PACKAGE"] = $module["package"];
- $tplvars["MODULE_UNDOC"] = ("true" == $module["undoc"])
? $this->undocumented : "";
-
- if (isset($module["doc"]["link"]))
- $this->renderLinks($module["doc"]["link"], "class_");
-
- if (isset($module["doc"]["author"]))
- $this->renderAuthors($module["doc"]["author"], "class_");
-
- if (isset($module["doc"]["see"]))
- $this->renderSee($module["doc"]["see"], "class_");
-
- $fields = array( "version", "deprecated", "copyright", "since",
"magic");
- reset($fields);
- while (list($k, $field) = each($fields))
-
- if (isset($module["doc"][$field])) {
- $this->tpl->setCurrentBlock("module_" .
strtolower($field));
- $this->tpl->setVariable(strtoupper($field),
$module["doc"][$field]["value"]);
- $this->tpl->parseCurrentBlock();
- }
-
- $fields = array( "description", "shortdescription" );
- reset($fields);
- while (list($k, $field) = each($fields))
-
- if (isset($module["doc"][$field]))
- $tplvars["MODULE_" . strtoupper($field)] =
$this->encode($module["doc"][$field]["value"]);
-
- $this->tpl->setCurrentBlock("__global__");
- $this->tpl->setVariable($tplvars);
- $this->tpl->setVariable("APPNAME", $this->application);
+ /**
+ * Sets the xml and template root directory.
+ *
+ * @param string XML file path
+ * @param string Template file path
+ * @param string Name of the current application
+ * @param string Filename extension
+ * @see setPath(), setTemplateRoot()
+ */
+ function PhpdocHTMLModuleRenderer($path, $templateRoot, $application, $extension
+= ".html") {
+
+ $this->setPath($path);
+ $this->setTemplateRoot($templateRoot);
+ $this->application = $application;
+ $this->file_extension = $extension;
+
+ $this->accessor = new PhpdocModuleAccessor;
+ $this->tpl = new IntegratedTemplate($this->templateRoot);
+ $this->fileHandler = new PhpdocFileHandler;
+
+ } // end constructor
+
+ /**
+ * Renders a module
+ *
+ * @param string XML source file
+ * @param string Name of the HTML target file.
+ * @access public
+ */
+ function renderModule($xmlfile, $htmlfile = "") {
+
+ $this->tpl->loadTemplatefile("module.html");
+ if ("" == $htmlfile)
+ $htmlfile = substr($xmlfile, 7, -4) . $this->file_extension;
+
+ $this->accessor->loadXMLFile($this->path . $xmlfile);
+ $module = $this->accessor->getModuledata();
+
+ $this->renderFunctions();
+ $this->renderUses();
+ $this->renderConstants();
+
+ $tplvars = array();
+ $tplvars["MODULE_FILE"] = $module["file"]["value"];
+ $tplvars["MODULE_NAME"] = $module["name"];
+ $tplvars["MODULE_GROUP"] = $module["group"];
+ $tplvars["MODULE_ACCESS"] = $module["access"];
+ $tplvars["MODULE_PACKAGE"] = $module["package"];
+ $tplvars["MODULE_UNDOC"] = ("true" == $module["undoc"]) ?
+$this->undocumented : "";
+
+ if (isset($module["doc"]["link"]))
+ $this->renderLinks($module["doc"]["link"], "class_");
+
+ if (isset($module["doc"]["author"]))
+ $this->renderAuthors($module["doc"]["author"], "class_");
+
+ if (isset($module["doc"]["see"]))
+ $this->renderSee($module["doc"]["see"], "class_");
+
+ $fields = array( "version", "deprecated", "copyright", "since", "magic");
+ reset($fields);
+ while (list($k, $field) = each($fields))
+
+ if (isset($module["doc"][$field])) {
+ $this->tpl->setCurrentBlock("module_" . strtolower($field));
+ $this->tpl->setVariable(strtoupper($field),
+$module["doc"][$field]["value"]);
+ $this->tpl->parseCurrentBlock();
+ }
+
+ $fields = array( "description", "shortdescription" );
+ reset($fields);
+ while (list($k, $field) = each($fields))
+
+ if (isset($module["doc"][$field]))
+ $tplvars["MODULE_" . strtoupper($field)] =
+$this->encode($module["doc"][$field]["value"]);
+
+ $this->tpl->setCurrentBlock("__global__");
+ $this->tpl->setVariable($tplvars);
+ $this->tpl->setVariable("APPNAME", $this->application);
- $this->fileHandler->createFile($this->path . $htmlfile,
$this->tpl->get() );
- $this->tpl->free();
+ $this->fileHandler->createFile($this->path . $htmlfile, $this->tpl->get() );
+ $this->tpl->free();
- } // end func renderModule
+ } // end func renderModule
} // end class PhpdocHTMLModuleRenderer
?>
Index: php4/pear/PHPDoc/renderer/html/PhpdocHTMLRenderer.php
diff -u php4/pear/PHPDoc/renderer/html/PhpdocHTMLRenderer.php:1.4
php4/pear/PHPDoc/renderer/html/PhpdocHTMLRenderer.php:1.5
--- php4/pear/PHPDoc/renderer/html/PhpdocHTMLRenderer.php:1.4 Thu Feb 8 14:30:09
2001
+++ php4/pear/PHPDoc/renderer/html/PhpdocHTMLRenderer.php Sun Feb 18 08:29:21
+2001
@@ -1,78 +1,80 @@
<?php
/**
* Default HTML Renderer based on templates.
+*
+* @version $Id: PhpdocHTMLRenderer.php,v 1.5 2001/02/18 16:29:21 uw Exp $
*/
class PhpdocHTMLRenderer extends PhpdocRendererObject {
- /**
- * Template object
- *
- * @var object IntegratedTemplates $tpl
- */
- var $tpl;
-
- /**
- * XML data accessor object.
- *
- * @var object PhpdocAccessor
- */
- var $accessor;
-
- /**
- * Rootpath for Templatefiles.
- *
- * @var string $templateRoot
- * @see setTemplateRoot()
- */
- var $templateRoot = "";
-
- /**
- * Directory path prefix.
- *
- * @var string $path
- */
- var $path = "";
-
- /**
- * Sets a directory path prefix.
- *
- * @param string
- */
- function setPath($path) {
-
- if (!empty($path) && "/" != substr($path, -1))
- $path .= "/";
-
- $this->path = $path;
- } // end func path
-
- /**
- * Sets the template directory.
- *
- * @param string
- */
- function setTemplateRoot($templateRoot) {
-
- if (!empty($templateRoot) && '/' != substr($templateRoot, -1))
- $templateRoot .= "/";
-
- $this->templateRoot = $templateRoot;
- } // end func setTemplateRoot
-
- /**
- * Encodes the given string.
- *
- * This function gets used to encode all userdependend
- * elements of the phpdoc xml files. Use it to
- * customize your rendering result: beware newlines (nl2br()),
- * strip tags etc.
- *
- * @param string String to encode
- * @return string $string Encoded string
- */
- function encode($string) {
- return nl2br(htmlspecialchars($string));
- } // end func encode
+ /**
+ * Template object
+ *
+ * @var object IntegratedTemplate
+ */
+ var $tpl;
+
+ /**
+ * XML data accessor object.
+ *
+ * @var object PhpdocAccessor
+ */
+ var $accessor;
+
+ /**
+ * Rootpath for Templatefiles.
+ *
+ * @var string $templateRoot
+ * @see setTemplateRoot()
+ */
+ var $templateRoot = "";
+
+ /**
+ * Directory path prefix.
+ *
+ * @var string $path
+ */
+ var $path = "";
+
+ /**
+ * Sets a directory path prefix.
+ *
+ * @param string
+ */
+ function setPath($path) {
+
+ if (!empty($path) && "/" != substr($path, -1))
+ $path .= "/";
+
+ $this->path = $path;
+ } // end func path
+
+ /**
+ * Sets the template directory.
+ *
+ * @param string
+ */
+ function setTemplateRoot($templateRoot) {
+
+ if (!empty($templateRoot) && '/' != substr($templateRoot, -1))
+ $templateRoot .= "/";
+
+ $this->templateRoot = $templateRoot;
+ } // end func setTemplateRoot
+
+ /**
+ * Encodes the given string.
+ *
+ * This function gets used to encode all userdependend
+ * elements of the phpdoc xml files. Use it to
+ * customize your rendering result: beware newlines (nl2br()),
+ * strip tags etc.
+ *
+ * @param string String to encode
+ * @return string $string Encoded string
+ */
+ function encode($string) {
+ return nl2br(htmlspecialchars($string));
+ } // end func encode
} // end class PhpdocHTMLRenderer
?>
Index: php4/pear/PHPDoc/renderer/html/PhpdocHTMLRendererManager.php
diff -u php4/pear/PHPDoc/renderer/html/PhpdocHTMLRendererManager.php:1.3
php4/pear/PHPDoc/renderer/html/PhpdocHTMLRendererManager.php:1.4
--- php4/pear/PHPDoc/renderer/html/PhpdocHTMLRendererManager.php:1.3 Sun Dec 3
06:36:01 2000
+++ php4/pear/PHPDoc/renderer/html/PhpdocHTMLRendererManager.php Sun Feb 18
+08:29:21 2001
@@ -2,98 +2,99 @@
/**
* Controls the HTML Renderer objects.
*
+* @version $Id: PhpdocHTMLRendererManager.php,v 1.4 2001/02/18 16:29:21 uw Exp $
*/
class PhpdocHTMLRendererManager extends PhpdocObject {
- /**
- * @var object PhpdocHTMLIndexRenderer
- */
- var $indexrenderer;
-
- /**
- * @var object PhpdocHTMLClassRenderer
- */
- var $classrenderer;
-
- /**
- * @var object PhpdocHTMLModuleRenderer
- */
- var $modulerenderer;
-
- /**
- * @var object PhpdocHTMLWarningRenderer
- */
- var $warningrenderer;
-
- /**
- * Creates all necessary renderer objects
- *
- * @param string Name of the target directory
- * @param string Name of the directory with the templates.
- * @param string Name of the current application
- * @param string Extension of generated files
- */
- function PhpdocHTMLRendererManager($target, $template, $application,
$extension = ".html") {
-
- $this->indexrenderer = new PhpdocHTMLIndexRenderer($target, $template,
$application, $extension);
- $this->indexrenderer->generate();
-
- $this->classrenderer = new PhpdocHTMLClassRenderer($target,
$template, $application, $extension);
- $this->modulerenderer = new PhpdocHTMLModuleRenderer($target,
$template, $application, $extension);
- $this->warningrenderer = new PhpdocHTMLWarningRenderer($target,
$template, $application, $extension);
-
- } // end constructor
-
- /**
- * Renders the given xml file.
- *
- * @param string XML file.
- * @param string Content of the XML file: class, classtree,
- *
module, modulegroup, warnings, indexdata
- * @access public
- */
- function render($xmlfile, $type) {
-
- switch (strtolower($type)) {
-
- case "class":
- $this->classrenderer->renderClass($xmlfile);
- break;
-
- case "classtree":
- $this->indexrenderer->addClasstree($xmlfile);
- break;
-
- case "module":
- $this->modulerenderer->renderModule($xmlfile);
- break;
-
- case "modulegroup":
- $this->indexrenderer->addModulegroup($xmlfile);
- break;
-
- case "warning":
- $this->warningrenderer->addWarnings($xmlfile);
- break;
-
- }
-
- } // end func render
-
- /**
- * Finishes the rendering process.
- *
- * Finish means here: write the classtree and modulegroup overview to disk.
- *
- * @access public
- */
- function finish() {
-
- $this->indexrenderer->finishClasstree();
- $this->indexrenderer->finishModulegroup();
- $this->warningrenderer->finishWarnings();
+ /**
+ * @var object PhpdocHTMLIndexRenderer
+ */
+ var $indexrenderer;
+
+ /**
+ * @var object PhpdocHTMLClassRenderer
+ */
+ var $classrenderer;
+
+ /**
+ * @var object PhpdocHTMLModuleRenderer
+ */
+ var $modulerenderer;
+
+ /**
+ * @var object PhpdocHTMLWarningRenderer
+ */
+ var $warningrenderer;
+
+ /**
+ * Creates all necessary renderer objects
+ *
+ * @param string Name of the target directory
+ * @param string Name of the directory with the templates.
+ * @param string Name of the current application
+ * @param string Extension of generated files
+ */
+ function PhpdocHTMLRendererManager($target, $template, $application, $extension =
+".html") {
+
+ $this->indexrenderer = new PhpdocHTMLIndexRenderer($target, $template,
+$application, $extension);
+ $this->indexrenderer->generate();
+
+ $this->classrenderer = new PhpdocHTMLClassRenderer($target, $template,
+$application, $extension);
+ $this->modulerenderer = new PhpdocHTMLModuleRenderer($target, $template,
+$application, $extension);
+ $this->warningrenderer = new PhpdocHTMLWarningRenderer($target, $template,
+$application, $extension);
+
+ } // end constructor
+
+ /**
+ * Renders the given xml file.
+ *
+ * @param string XML file.
+ * @param string Content of the XML file: class, classtree,
+ * module, modulegroup, warnings, indexdata
+ * @access public
+ */
+ function render($xmlfile, $type) {
+
+ switch (strtolower($type)) {
+
+ case "class":
+ $this->classrenderer->renderClass($xmlfile);
+ break;
+
+ case "classtree":
+ $this->indexrenderer->addClasstree($xmlfile);
+ break;
+
+ case "module":
+ $this->modulerenderer->renderModule($xmlfile);
+ break;
+
+ case "modulegroup":
+ $this->indexrenderer->addModulegroup($xmlfile);
+ break;
+
+ case "warning":
+ $this->warningrenderer->addWarnings($xmlfile);
+ break;
+
+ }
+
+ } // end func render
+
+ /**
+ * Finishes the rendering process.
+ *
+ * Finish means here: write the classtree and modulegroup overview to disk.
+ *
+ * @access public
+ */
+ function finish() {
+
+ $this->indexrenderer->finishClasstree();
+ $this->indexrenderer->finishModulegroup();
+ $this->warningrenderer->finishWarnings();
- } // end func finish
+ } // end func finish
} // end class PhpdocHTMLRendererManager
?>
Index: php4/pear/PHPDoc/renderer/html/PhpdocHTMLWarningRenderer.php
diff -u php4/pear/PHPDoc/renderer/html/PhpdocHTMLWarningRenderer.php:1.4
php4/pear/PHPDoc/renderer/html/PhpdocHTMLWarningRenderer.php:1.5
--- php4/pear/PHPDoc/renderer/html/PhpdocHTMLWarningRenderer.php:1.4 Sun Dec 3
14:37:37 2000
+++ php4/pear/PHPDoc/renderer/html/PhpdocHTMLWarningRenderer.php Sun Feb 18
+08:29:21 2001
@@ -1,88 +1,90 @@
<?php
/**
* Renders files with warnings.
+*
+* @version $Id: PhpdocHTMLWarningRenderer.php,v 1.5 2001/02/18 16:29:21 uw Exp $
*/
class PhpdocHTMLWarningRenderer extends PhpdocHTMLRenderer {
- /**
- * Sets the xml and template root directory.
- *
- * @param string XML file path
- * @param string Template file path
- * @param string Name of the application
- * @param string Filename extension
- * @see setPath(), setTemplateRoot()
- */
- function PhpdocHTMLWarningRenderer($path, $templateRoot, $application,
$extension = ".html") {
-
- $this->setPath($path);
- $this->setTemplateRoot($templateRoot);
- $this->application = $application;
- $this->file_extension = $extension;
-
- $this->accessor = new PhpdocWarningAccessor;
- $this->fileHandler = new PhpdocFileHandler;
-
- } // end constructor
-
- /**
- * Saves the generated report.
- *
- * @see addWarnings()
- * @access public
- */
- function finishWarnings() {
-
- if (!is_object($this->tpl))
- return;
-
- $this->tpl->setVariable("APPNAME", $this->application);
- $this->fileHandler->createFile($this->path."phpdoc_warnings" .
$this->file_extension, $this->tpl->get() );
-
- $this->tpl = "";
-
- } // end func finishWarnings
-
- /**
- * Adds file with warnings to the warning list.
- *
- * @param string XML file
- * @see finishWarnings()
- * @access public
- */
- function addWarnings($xmlfile) {
-
- $data = $this->accessor->getWarnings($this->path . $xmlfile);
- if (!is_object($this->tpl)) {
- $this->tpl = new IntegratedTemplate($this->templateRoot);
- $this->tpl->loadTemplateFile("warnings.html");
- }
-
- reset($data);
- while (list($file, $warnings) = each($data)) {
-
- $this->tpl->setCurrentBlock("warning_loop");
-
- reset($warnings);
- while (list($k, $warning) = each($warnings)) {
-
- $this->tpl->setVariable("WARNINGTYPE",
$warning["type"]);
- $this->tpl->setVariable("WARNING",
$this->encode($warning["value"]));
- $this->tpl->setVariable("ELEMENT",
htmlentities($warning["name"]));
- $this->tpl->setVariable("ELEMENTTYPE",
$warning["elementtype"]);
- $this->tpl->parseCurrentBlock();
-
- }
-
- $this->tpl->setCurrentBlock("warning");
- $this->tpl->setVariable("FILE", $file);
- $this->tpl->setVariable("NUMWARNINGS", count($warnings));
- $this->tpl->parseCurrentBlock();
+ /**
+ * Sets the xml and template root directory.
+ *
+ * @param string XML file path
+ * @param string Template file path
+ * @param string Name of the application
+ * @param string Filename extension
+ * @see setPath(), setTemplateRoot()
+ */
+ function PhpdocHTMLWarningRenderer($path, $templateRoot, $application, $extension
+= ".html") {
+
+ $this->setPath($path);
+ $this->setTemplateRoot($templateRoot);
+ $this->application = $application;
+ $this->file_extension = $extension;
+
+ $this->accessor = new PhpdocWarningAccessor;
+ $this->fileHandler = new PhpdocFileHandler;
+
+ } // end constructor
+
+ /**
+ * Saves the generated report.
+ *
+ * @see addWarnings()
+ * @access public
+ */
+ function finishWarnings() {
+
+ if (!is_object($this->tpl))
+ return;
+
+ $this->tpl->setVariable("APPNAME", $this->application);
+ $this->fileHandler->createFile($this->path."phpdoc_warnings" .
+$this->file_extension, $this->tpl->get() );
+
+ $this->tpl = "";
+
+ } // end func finishWarnings
+
+ /**
+ * Adds file with warnings to the warning list.
+ *
+ * @param string XML file
+ * @see finishWarnings()
+ * @access public
+ */
+ function addWarnings($xmlfile) {
+
+ $data = $this->accessor->getWarnings($this->path . $xmlfile);
+ if (!is_object($this->tpl)) {
+ $this->tpl = new IntegratedTemplate($this->templateRoot);
+ $this->tpl->loadTemplateFile("warnings.html");
+ }
+
+ reset($data);
+ while (list($file, $warnings) = each($data)) {
+
+ $this->tpl->setCurrentBlock("warning_loop");
+
+ reset($warnings);
+ while (list($k, $warning) = each($warnings)) {
+
+ $this->tpl->setVariable("WARNINGTYPE", $warning["type"]);
+ $this->tpl->setVariable("WARNING", $this->encode($warning["value"]));
+ $this->tpl->setVariable("ELEMENT", htmlentities($warning["name"]));
+ $this->tpl->setVariable("ELEMENTTYPE", $warning["elementtype"]);
+ $this->tpl->parseCurrentBlock();
+
+ }
+
+ $this->tpl->setCurrentBlock("warning");
+ $this->tpl->setVariable("FILE", $file);
+ $this->tpl->setVariable("NUMWARNINGS", count($warnings));
+ $this->tpl->parseCurrentBlock();
- }
+ }
- return true;
- } // end func addWarnings
+ return true;
+ } // end func addWarnings
} // end class PhpdocHTMLIndexRenderer
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]