+++ /dev/null
-<?php\r
-/**\r
-* Base of the class and module exporter.\r
-* \r
-* @version $Id: PhpdocXMLDocumentExporter.php,v 1.2 2000/12/03 22:37:38 uw Exp $\r
-*/\r
-class PhpdocXMLDocumentExporter extends PhpdocXMLExporter {\r
- \r
- /**\r
- * Mapping from internal result array index name to xml tag name.\r
- *\r
- * @var array $docTags\r
- */\r
- var $docTags = array(\r
- "desc" => "description",\r
- "sdesc" => "shortdescription",\r
- \r
- "version" => "version",\r
- "since" => "since",\r
- "version" => "version",\r
- "deprec" => "deprecated",\r
- "copyright" => "copyright",\r
- "exclude" => "exclude",\r
- "brother" => "brother",\r
- "magic" => "magic"\r
- );\r
-\r
- /**\r
- * Attributes of the <see> container.\r
- *\r
- * @var array $seeAttributes\r
- */ \r
- var $seeAttributes = array(\r
- "type" => "CDATA",\r
- "group" => "CDATA"\r
- );\r
- \r
- /**\r
- * Attributes of the <link> container.\r
- *\r
- * @var array $linkAttributes\r
- */\r
- var $linkAttributes = array( "url" => "CDATA" );\r
-\r
- /**\r
- * Attributes of the <author> container.\r
- *\r
- * @var array $authorAttributes\r
- */ \r
- var $authorAttributes = array( "email" => "CDATA" );\r
- \r
- /**\r
- * Attributes of <inherited> and <overriden> container.\r
- *\r
- * @var array $inheritedOverridenAttributes\r
- */ \r
- var $inheritedOverridenAttributes = array(\r
- "src" => "CDATA",\r
- "type" => "CDATA"\r
- ); \r
-\r
- /**\r
- * Attributes of the <constant> container.\r
- *\r
- * @var array $constAttributes \r
- */ \r
- var $constAttributes = array(\r
- "name" => "CDATA",\r
- "undoc" => "Boolean",\r
- "access" => "CDATA",\r
- "case" => "CDATA"\r
- );\r
-\r
- /**\r
- * Attribues of the <uses> container.\r
- *\r
- * @var array $usesAttributes\r
- */ \r
- var $usesAttributes = array(\r
- "type" => "CDATA",\r
- "file" => "CDATA",\r
- "undoc" => "Boolean"\r
- );\r
- \r
- /**\r
- * Attribues of the <function> container.\r
- *\r
- * @var array $functionAttributes\r
- */ \r
- var $functionAttributes = array(\r
- "name" => "CDATA",\r
- "undoc" => "Boolean",\r
- "access" => "CDATA",\r
- "abstract" => "Boolean",\r
- "static" => "CDATA"\r
- );\r
-\r
- /**\r
- * Attributes of the <return> container.\r
- *\r
- * @var array $returnAttributes\r
- */ \r
- var $returnAttributes = array( \r
- "name" => "CDATA",\r
- "type" => "CDATA"\r
- ); \r
-\r
- /**\r
- * Attributes of the <global> container.\r
- *\r
- * @var array $globalAttributes\r
- */ \r
- var $globalAttributes = array(\r
- "name" => "CDATA",\r
- "type" => "CDATA"\r
- ); \r
-\r
- /**\r
- * Attributes of the <param> container.\r
- *\r
- * @var array $paramAttributes\r
- */ \r
- var $paramAttributes = array(\r
- "name" => "CDATA",\r
- "default" => "CDATA",\r
- "type" => "CDATA",\r
- "undoc" => "Boolean"\r
- ); \r
- \r
- /**\r
- * Writes a <file> container.\r
- *\r
- * @param string $file filename\r
- */\r
- function filenameXML($file) {\r
- $this->xmlwriter->addElement("file", $file);\r
- } // end func filenameXML\r
- \r
- /**\r
- * Adds all constants (define(), const) to the xml document.\r
- *\r
- * @param array Array of constants\r
- * @return boolean Returns false on failure otherwise true\r
- */\r
- function constsXML($consts) {\r
- if (!is_array($consts) || 0 == count($consts)) \r
- return true;\r
- \r
- reset($consts);\r
- while (list($k, $data)=each($consts)) {\r
- \r
- $attribs = $this->getAttributes($data, $this->constAttributes);\r
- $this->xmlwriter->startElement("constant", (isset($data["value"])) ? $data["value"] : "", $attribs, false, true);\r
- $this->docXML($data);\r
- $this->xmlwriter->endElement("constant", true);\r
- \r
- }\r
- \r
- return true;\r
- } // end func constsXML\r
- \r
- /**\r
- * Adds a list of used files (include, require...) to the xml document.\r
- * \r
- * @param array\r
- */\r
- function usesXML($uses) {\r
- if (!is_array($uses)) {\r
- $this->err[] = new PhpdocError("No array given.", __FILE__, __LINE__);\r
- return false;\r
- }\r
- \r
- reset($uses);\r
- while (list($k, $data) = each($uses)) {\r
- \r
- $attribs = $this->getAttributes($data, $this->usesAttributes);\r
- $this->xmlwriter->startElement("uses", "", $attribs, false, true);\r
- $this->docXML($data); \r
- $this->xmlwriter->endElement("uses", true);\r
- \r
- }\r
- \r
- return true;\r
- } // end func usesXML\r
- \r
- /**\r
- * Adds a list of functions to the xml file.\r
- * \r
- * @param array\r
- */\r
- function functionsXML($functions) {\r
- if (!is_array($functions)) {\r
- $this->err[] = new PhpdocError("No array given.", __FILE__, __LINE__);\r
- return false;\r
- }\r
-\r
- reset($functions);\r
- while (list($k, $data) = each($functions)) {\r
- \r
- $attribs = $this->getAttributes($data, $this->functionAttributes); \r
- $this->xmlwriter->startElement("function", "", $attribs, false, true);\r
- $this->docXML($data); \r
- $this->xmlwriter->endElement("function", true);\r
- \r
- }\r
- \r
- } // end functionsXML\r
- \r
- /**\r
- * Adds a documentation block (author, links, see, params...) to the xml document\r
- * \r
- * @param array\r
- */\r
- function docXML($data) {\r
- \r
- $this->xmlwriter->startElement("doc", "", "", false, true);\r
- \r
- if (isset($data["link"]))\r
- $this->linkXML($data["link"]); \r
- \r
- if (isset($data["author"]))\r
- $this->authorXML($data["author"]);\r
- \r
- if (isset($data["see"]))\r
- $this->seeXML($data["see"]);\r
- \r
- if (isset($data["params"]))\r
- $this->paramsXML($data["params"]);\r
- \r
- if (isset($data["return"]))\r
- $this->returnXML($data["return"]);\r
- \r
- if (isset($data["throws"])) \r
- $this->throwsXML($data["throws"]);\r
- \r
- if (isset($data["global"]))\r
- $this->globalsXML($data["global"]);\r
-\r
- if (isset($data["inherited"])) {\r
- \r
- \r
- $attribs = array(\r
- "src" => array(\r
- "type" => $this->inheritedOverridenAttributes["src"],\r
- "value" => $data["inherited"]\r
- )\r
- );\r
- $this->xmlwriter->addElement("inherited", "", $attribs);\r
- }\r
- \r
- if (isset($data["overrides"])) {\r
- $attribs = array( \r
- "src" => array(\r
- "type" => $this->inheritedOverridenAttributes["src"],\r
- "value" => $data["overrides"]\r
- )\r
- );\r
- $this->xmlwriter->addElement("overriden", "", $attribs); \r
- }\r
- \r
- reset($this->docTags);\r
- while (list($field, $tag) = each($this->docTags))\r
- if (isset($data[$field]))\r
- $this->xmlwriter->addElement($tag, $data[$field], "");\r
- \r
- $this->xmlwriter->endElement("doc", true);\r
- } // end func docXML\r
-\r
- /**\r
- * Adds <global> container to the xml document.\r
- * \r
- * @param array\r
- */\r
- function globalsXML($globals) {\r
- \r
- reset($globals);\r
- while (list($k, $data) = each($globals)) {\r
- $attribs = $this->getAttributes($data, $this->globalAttributes);\r
- $this->xmlwriter->addElement("global", (isset($data["desc"])) ? $data["desc"] : "", $attribs);\r
- }\r
- \r
- } // end func globalsXML\r
- \r
- /**\r
- * Adds <throws> container to the xml document.\r
- * \r
- * @param array\r
- */\r
- function throwsXML($exceptions) {\r
- \r
- reset($exceptions);\r
- while (list($k, $exception) = each($exceptions)) \r
- $this->xmlwriter->addElement("throws", $exception, "", true);\r
- \r
- } // end func throwsXML\r
- \r
- /**\r
- * Adds <return> container to the xml document.\r
- * \r
- * @param array\r
- */\r
- function returnXML($return) {\r
-\r
- $desc = ""; \r
- \r
- if (is_array($return)) {\r
- \r
- if (isset($return["desc"])) {\r
- $desc = $return["desc"];\r
- unset($return["desc"]);\r
- }\r
- $attribs = $this->getAttributes($return, $this->returnAttributes);\r
- \r
- } else {\r
- \r
- $attribs["type"] = array( "type" => "CDATA", "value" => $return );\r
- \r
- }\r
- \r
- $this->xmlwriter->addElement("return", $desc, $attribs);\r
- \r
- } // end func returnXML \r
- \r
- /**\r
- * Adds <parameter> container to the xml document.\r
- * \r
- * @param array\r
- */\r
- function paramsXML($params) {\r
- \r
- reset($params);\r
- while (list($k, $data) = each($params)) {\r
- $attribs = $this->getAttributes($data, $this->paramAttributes);\r
- $this->xmlwriter->addElement("parameter", (isset($data["desc"])) ? $data["desc"] : "", $attribs);\r
- }\r
-\r
- } // end func paramsXML\r
- \r
- /**\r
- * Adds <author> container to the xml document.\r
- *\r
- * @param array\r
- */\r
- function authorXML($authors) {\r
- \r
- reset($authors);\r
- while (list($k, $data) = each($authors)) {\r
- \r
- $attribs = array();\r
- \r
- if (isset($data["mail"]))\r
- $attribs = array(\r
- "email" => array(\r
- "type" => $this->authorAttributes["email"],\r
- "value" => $data["mail"]\r
- )\r
- );\r
- $this->xmlwriter->addElement("author",$data["name"], $attribs);\r
- \r
- }\r
- \r
- } // end func authorXML\r
- \r
- /**\r
- * Adds <link> container to the xml document.\r
- *\r
- * @param array\r
- */\r
- function linkXML($links) {\r
- \r
- reset($links);\r
- while (list($k, $data) = each($links)) {\r
- \r
- $attribs = array(\r
- "url" => array(\r
- "type" => $this->linkAttributes["url"],\r
- "value" => $data["url"]\r
- )\r
- );\r
- $this->xmlwriter->addElement("link", (isset($data["desc"])) ? $data["desc"] : "", $attribs); \r
- \r
- }\r
- \r
- } // end func linkXML\r
- \r
- /**\r
- * Adds <see> container to the xml document.\r
- * \r
- * @param array\r
- */\r
- function seeXML($see) {\r
- \r
- reset($see);\r
- while (list($type, $data) = each($see)) {\r
- \r
- reset($data);\r
- while (list($k, $data2) = each($data)) {\r
- \r
- $attribs = array(\r
- "type" => array(\r
- "type" => $this->seeAttributes["type"],\r
- "value" => strtolower($type)\r
- )\r
- );\r
- if (isset($data2["group"]))\r
- $attribs["group"] = array(\r
- "type" => $this->seeAttributes["group"],\r
- "value" => $data2["group"]\r
- );\r
- \r
- $this->xmlwriter->addElement("see", $data2["name"], $attribs);\r
- \r
- }\r
- \r
- }\r
- \r
- } // end func SeeXML\r
-\r
-} // end class PhpdocXMLDocumentExporter\r
-?>
\ No newline at end of file