/** Build the function definitons. * * @param Doclet doclet */ function globalWriter(&$doclet) { parent::MDWriter($doclet); $this->_id = "definition"; $rootDoc =& $this->_doclet->rootDoc(); $packages =& $rootDoc->packages(); ksort($packages); foreach ($packages as $packageName => $package) { $this->_depth = $package->depth() + 1; ob_start(); echo "- - -\n\n"; echo "#Globals#\n\n"; echo "- - -\n\n"; $globals =& $package->globals(); if ($globals) { ksort($globals); echo "<table id=\"summary_global\" class=\"title\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Global Summary</th></tr>", "\n"; foreach ($globals as $global) { $textTag =& $global->tags("@text"); $type =& $global->type(); echo "<tr>\n"; echo "<td>", $global->modifiers(FALSE), " ", $global->typeAsString(), "</td>\n"; echo "<td class=\"description\">"; echo "<p class=\"name\"><a href=\"#", $this->_asURL($global), "\">", $global->name(), "</a></p>"; if ($textTag) { echo "<p class=\"description\">", strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"), "</p>"; } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; echo "<h2 id=\"detail_global\">Global Detail</h2>", "\n"; foreach ($globals as $global) { $textTag =& $global->tags("@text"); $type =& $global->type(); $this->_sourceLocation($global); echo "<h3 id=\"", $global->name(), "\">", $global->name(), "</h3>\n"; echo "\n\n", $global->modifiers(), " ", $global->typeAsString(), " **"; echo $global->name(), "**"; if ($global->value()) { echo " = ", htmlspecialchars($global->value()); } echo "\n\n"; echo "<div class=\"details\">", "\n"; if ($textTag) { echo $this->_processInlineTags($textTag), "\n"; } echo "</div>\n\n"; $this->_processTags($global->tags()); echo "- - -\n\n"; } } $this->_output = ob_get_contents(); ob_end_clean(); $this->_write($this->_normalize($package->_name) . "_package-globals.md"); } }
/** Build the function definitons. * * @param Doclet doclet */ function functionWriter(&$doclet) { parent::MDWriter($doclet); $this->_id = "definition"; $rootDoc =& $this->_doclet->rootDoc(); $packages =& $rootDoc->packages(); ksort($packages); foreach ($packages as $packageName => $package) { $this->_depth = $package->depth() + 1; ob_start(); echo "- - -\n\n"; echo "#Functions#\n\n"; echo "- - -\n\n"; $functions =& $package->functions(); if ($functions) { ksort($functions); echo "<table id=\"summary_function\" class=\"title\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Function Summary</th></tr>", "\n"; foreach ($functions as $function) { $textTag =& $function->tags("@text"); echo "<tr>\n"; echo "<td>", $this->_methodSignature($function), "</td>\n"; echo "<td class=\"description\">"; echo "<p class=\"name\"><a href=\"#", $this->_asURL($function), "\">", $function->name(), "</a>", $this->_flatSignature($function), "</p>"; if ($textTag) { echo "<p class=\"description\">", strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"), "</p>"; } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; echo "<h2 id=\"detail_function\">Function Detail</h2>", "\n"; foreach ($functions as $function) { $textTag =& $function->tags("@text"); $this->_sourceLocation($function); echo "<h3 id=\"", $function->name(), "()\">", $function->name(), "</h3>\n"; echo $this->_methodSignature($function); echo " {$function->name()} {$this->_flatSignature($function)}\n\n"; echo "<div class=\"details\">\n"; if ($textTag) { echo $this->_processInlineTags($textTag), "\n"; } $this->_processTags($function->tags()); echo "</div>\n\n"; echo "- - -\n\n"; } } $this->_output = ob_get_contents(); ob_end_clean(); $this->_write($this->_normalize($package->_name) . "_package-functions.md"); } }
/** Build the deprecated index. * * @param Doclet doclet */ function deprecatedWriter(&$doclet) { parent::MDWriter($doclet); //$this->_id = "definition"; $rootDoc =& $this->_doclet->rootDoc(); $deprecatedClasses = array(); $classes =& $rootDoc->classes(); $deprecatedFields = array(); $deprecatedMethods = array(); if ($classes) { foreach ($classes as $class) { if ($class->tags("@deprecated")) { $deprecatedClasses[] = $class; } $fields =& $class->fields(); if ($fields) { foreach ($fields as $field) { if ($field->tags("@deprecated")) { $deprecatedFields[] = $field; } } } $classes =& $class->methods(); if ($classes) { foreach ($classes as $method) { if ($method->tags("@deprecated")) { $deprecatedMethods[] = $method; } } } } } $deprecatedGlobals = array(); $globals =& $rootDoc->globals(); if ($globals) { foreach ($globals as $global) { if ($global->tags("@deprecated")) { $deprecatedGlobals[] = $global; } } } $deprecatedFunctions = array(); $functions =& $rootDoc->functions(); if ($functions) { foreach ($functions as $function) { if ($function->tags("@deprecated")) { $deprecatedFunctions[] = $function; } } } ob_start(); echo "- - -\n\n"; echo "#Deprecated API#\n\n"; echo "- - -\n\n"; if ($deprecatedClasses || $deprecatedFields || $deprecatedMethods || $deprecatedGlobals || $deprecatedFunctions) { echo "##Contents##\n\n"; if ($deprecatedClasses) { echo "\n* <a href=\"#deprecated_class\">Deprecated Classes</a>"; } if ($deprecatedFields) { echo "\n* <a href=\"#deprecated_field\">Deprecated Fields</a>"; } if ($deprecatedMethods) { echo "\n* <a href=\"#deprecated_method\">Deprecated Methods</a>"; } if ($deprecatedGlobals) { echo "\n* <a href=\"#deprecated_global\">Deprecated Globals</a>"; } if ($deprecatedFunctions) { echo "\n* <a href=\"#deprecated_function\">Deprecated Functions</a>"; } } if ($deprecatedClasses) { echo "\n\n<table id=\"deprecated_class\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\">Deprecated Classes</th></tr>", "\n"; foreach ($deprecatedClasses as $class) { $textTag =& $class->tags("@text"); echo "<tr><td class=\"name\"><a href=\"", $this->_asURL($class), "\">", $class->qualifiedName(), "</a></td>"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td></tr>\n"; } echo "</table>\n\n"; } if ($deprecatedFields) { echo "<table id=\"deprecated_field\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Deprecated Fields</th></tr>", "\n"; foreach ($deprecatedFields as $field) { $textTag =& $field->tags("@text"); echo "<tr>\n"; echo "<td class=\"name\"><a href=\"", $this->_asURL($field), "\">", $field->qualifiedName(), "</a></td>\n"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } if ($deprecatedMethods) { echo "<table id=\"deprecated_method\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Deprecated Methods</th></tr>", "\n"; foreach ($deprecatedMethods as $method) { $textTag =& $method->tags("@text"); echo "<tr>\n"; echo "<td class=\"name\"><a href=\"", $this->_asURL($method), "\">", $method->qualifiedName(), "</a></td>\n"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } if ($deprecatedGlobals) { echo "<table id=\"deprecated_global\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Deprecated Globals</th></tr>", "\n"; foreach ($deprecatedGlobals as $global) { $textTag =& $global->tags("@text"); echo "<tr>\n"; echo "<td class=\"name\"><a href=\"", $this->_asURL($global), "\">", $global->qualifiedName(), "</a></td>\n"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } if ($deprecatedFunctions) { echo "<table id=\"deprecated_function\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Deprecated Functions</th></tr>", "\n"; foreach ($deprecatedFunctions as $function) { $textTag =& $function->tags("@text"); echo "<tr>\n"; echo "<td class=\"name\"><a href=\"", $this->_asURL($function), "\">", $function->qualifiedName(), "</a></td>\n"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } $this->_output = ob_get_contents(); ob_end_clean(); $this->_write("deprecated-list.md"); }
/** Build the package summaries. * * @param Doclet doclet */ function packageWriter(&$doclet) { parent::MDWriter($doclet); $rootDoc =& $this->_doclet->rootDoc(); $phpdoctor =& $this->_doclet->phpdoctor(); $displayTree = $phpdoctor->getOption("tree"); if ($displayTree) { $this->_id = "tree"; $tree = array(); $classes =& $rootDoc->classes(); if ($classes) { foreach ($classes as $class) { $this->_buildTree($tree, $class); } } ob_start(); echo "\n\n- - -\n\n"; echo "#Class Hierarchy#\n\n"; $this->_displayTree($tree); $this->_output = ob_get_contents(); ob_end_clean(); $this->_write("overview-tree.md"); } $this->_id = "package"; $packages =& $rootDoc->packages(); ksort($packages); foreach ($packages as $packageName => $package) { $this->_depth = $package->depth() + 1; ob_start(); echo "\n\n- - -\n\n"; echo "#Namespace ", $package->name(), "#\n\n"; if ($displayTree) { echo "<div><a href='{$this->_asURL($package)}/package-tree.md'>View Class Hierarchy for this Package</a></div>\n\n"; } $textTag =& $package->tags("@text"); if ($textTag) { echo "<div class=\"comment\">", $this->_processInlineTags($textTag, TRUE), "</div>\n\n"; echo "<dl><dt>See:</dt><dd><b><a href=\"#overview_description\">Description</a></b></dd></dl>", "\n\n"; } $classes =& $package->ordinaryClasses(); if ($classes) { ksort($classes); echo "<table class=\"title\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Class Summary</th></tr>", "\n"; foreach ($classes as $name => $class) { $textTag =& $classes[$name]->tags("@text"); echo "<tr><td class=\"name\"><a href=\"", $this->_asURL($classes[$name]), "\">", $classes[$name]->name(), "</a></td>"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td></tr>\n"; } echo "</table>\n\n"; } $interfaces =& $package->interfaces(); if ($interfaces) { ksort($interfaces); echo "<table class=\"title\">" . "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Interface Summary</th></tr>" . "\n"; foreach ($interfaces as $name => $interface) { $textTag =& $interfaces[$name]->tags("@text"); echo "<tr><td class=\"name\"><a href=\"", $this->_asURL($interfaces[$name]), "\">", $interfaces[$name]->name(), "</a></td>"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td></tr>\n"; } echo "</table>\n\n"; } $exceptions =& $package->exceptions(); if ($exceptions) { ksort($exceptions); echo "<table class=\"title\">" . "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Exception Summary</th></tr>" . "\n"; foreach ($exceptions as $name => $exception) { $textTag =& $exceptions[$name]->tags("@text"); echo "<tr><td class=\"name\"><a href=\"", $this->_asURL($exceptions[$name]), "\">", $exceptions[$name]->name(), "</a></td>"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td></tr>\n"; } echo "</table>\n\n"; } $functions =& $package->functions(); if ($functions) { ksort($functions); echo "<table class=\"title\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Function Summary</th></tr>", "\n"; foreach ($functions as $name => $function) { $textTag =& $functions[$name]->tags("@text"); echo "<tr><td class=\"name\"><a href=\"package-functions.md#", $functions[$name]->name(), "\">", $functions[$name]->name(), "</a></td>"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td></tr>\n"; } echo "</table>\n\n"; } $globals =& $package->globals(); if ($globals) { ksort($globals); echo "<table class=\"title\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Global Summary</th></tr>", "\n"; foreach ($globals as $name => $global) { $textTag =& $globals[$name]->tags("@text"); echo "<tr><td class=\"name\"><a href=\"package-globals.md#", $globals[$name]->name(), "\">", $globals[$name]->name(), "</a></td>"; echo "<td class=\"description\">"; if ($textTag) { echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"); } echo "</td></tr>\n"; } echo "</table>\n\n"; } $textTag =& $package->tags("@text"); if ($textTag) { echo "#Namespace ", $package->name(), " Description#\n\n"; echo "<div class=\"comment\" id=\"overview_description\">" . $this->_processInlineTags($textTag), "</div>\n\n"; } echo "- - -\n\n"; $this->_output = ob_get_contents(); ob_end_clean(); $this->_write($package->_name . "/README.md"); if ($displayTree) { $this->_id = "tree"; $tree = array(); $classes =& $package->ordinaryClasses(); if ($classes) { ksort($classes); foreach ($classes as $class) { $this->_buildTree($tree, $class); } } ob_start(); echo "- - -\n\n"; echo "#Class Hierarchy for Package {$package->name()}"; echo "\n\n<div><a href='{$this->_asURL($package)}'>Back to package summary</a></div>\n\n"; $this->_displayTree($tree); $this->_output = ob_get_contents(); ob_end_clean(); $this->_write($package->_name . "/package-tree.md", $package->name(), TRUE); } } }
/** Build the todo index. * * @param Doclet doclet */ function todoWriter(&$doclet) { parent::MDWriter($doclet); $rootDoc =& $this->_doclet->rootDoc(); $todoClasses = array(); $classes =& $rootDoc->classes(); $todoFields = array(); $todoMethods = array(); if ($classes) { foreach ($classes as $class) { if ($class->tags("@todo")) { $todoClasses[] = $class; } $fields =& $class->fields(); if ($fields) { foreach ($fields as $field) { if ($field->tags("@todo")) { $todoFields[] = $field; } } } $classes =& $class->methods(); if ($classes) { foreach ($classes as $method) { if ($method->tags("@todo")) { $todoMethods[] = $method; } } } } } $todoGlobals = array(); $globals =& $rootDoc->globals(); if ($globals) { foreach ($globals as $global) { if ($global->tags("@todo")) { $todoGlobals[] = $global; } } } $todoFunctions = array(); $functions =& $rootDoc->functions(); if ($functions) { foreach ($functions as $function) { if ($function->tags("@todo")) { $todoFunctions[] = $function; } } } ob_start(); echo "- - -\n\n"; echo "#Todo#"; echo "\n\n- - -\n\n"; if ($todoClasses || $todoFields || $todoMethods || $todoGlobals || $todoFunctions) { echo "##Contents##\n\n"; echo "<ul>\n"; if ($todoClasses) { echo "<li><a href=\"#todo_class\">Todo Classes</a></li>"; } if ($todoFields) { echo "<li><a href=\"#todo_field\">Todo Fields</a></li>"; } if ($todoMethods) { echo "<li><a href=\"#todo_method\">Todo Methods</a></li>"; } if ($todoGlobals) { echo "<li><a href=\"#todo_global\">Todo Globals</a></li>"; } if ($todoFunctions) { echo "<li><a href=\"#todo_function\">Todo Functions</a></li>"; } echo "</ul>\n"; } if ($todoClasses) { echo "<table id=\"todo_class\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Todo Classes</th></tr>", "\n"; foreach ($todoClasses as $class) { $todoTag =& $class->tags("@todo"); echo "<tr><td class=\"name\"><a href=\"", $this->_asURL($class), "\">", $class->qualifiedName(), "</a></td>"; echo "<td class=\"description\">"; if ($todoTag) { echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>"); } echo "</td></tr>\n"; } echo "</table>\n\n"; } if ($todoFields) { echo "<table id=\"todo_field\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Todo Fields</th></tr>", "\n"; foreach ($todoFields as $field) { $todoTag =& $field->tags("@todo"); echo "<tr>\n"; echo "<td class=\"name\"><a href=\"", $this->_asURL($field), "\">", $field->qualifiedName(), "</a></td>\n"; echo "<td class=\"description\">"; if ($todoTag) { echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>"); } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } if ($todoMethods) { echo "<table id=\"todo_method\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Todo Methods</th></tr>", "\n"; foreach ($todoMethods as $method) { $todoTag =& $method->tags("@todo"); echo "<tr>\n"; echo "<td class=\"name\"><a href=\"", $this->_asURL($method), "\">", $method->qualifiedName(), "</a></td>\n"; echo "<td class=\"description\">"; if ($todoTag) { echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>"); } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } if ($todoGlobals) { echo "<table id=\"todo_global\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Todo Globals</th></tr>", "\n"; foreach ($todoGlobals as $global) { $todoTag =& $global->tags("@todo"); echo "<tr>\n"; echo "<td class=\"name\"><a href=\"", $this->_asURL($global), "\">", $global->qualifiedName(), "</a></td>\n"; echo "<td class=\"description\">"; if ($todoTag) { echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>"); } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } if ($todoFunctions) { echo "<table id=\"todo_function\" class=\"detail\">", "\n"; echo "<tr><th colspan=\"2\" class=\"title\">Todo Functions</th></tr>", "\n"; foreach ($todoFunctions as $function) { $todoTag =& $function->tags("@todo"); echo "<tr>\n"; echo "<td class=\"name\"><a href=\"", $this->_asURL($function), "\">", $function->qualifiedName(), "</a></td>\n"; echo "<td class=\"description\">"; if ($todoTag) { echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>"); } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } $this->_output = ob_get_contents(); ob_end_clean(); $this->_write("todo-list.md"); }
/** * * @param Doclet $doclet */ function classWriter(&$doclet) { parent::MDWriter($doclet); $this->_id = "definition"; $rootDoc =& $this->_doclet->rootDoc(); $phpdoctor =& $this->_doclet->phpdoctor(); $packages =& $rootDoc->packages(); ksort($packages); foreach ($packages as $packageName => $package) { $this->_depth = $package->depth() + 1; $classes =& $package->allClasses(); if ($classes) { ksort($classes); foreach ($classes as $name => $class) { ob_start(); echo "\n\n- - -\n\n"; echo "**", $class->qualifiedName(), "**\n\n"; $this->_sourceLocation($class); if ($class->isInterface()) { echo "#Interface {$class->name()}#\n\n"; } else { echo "#Class {$class->name()}#\n\n"; } $result = $this->_buildTree($rootDoc, $classes[$name]); echo $result[0]; echo "\n\n"; $implements =& $class->interfaces(); if (count($implements) > 0) { echo "<dl>\n"; echo "<dt>All Implemented Interfaces:</dt>\n"; echo "<dd>"; foreach ($implements as $interface) { echo "<a href=\"", $this->_asURL($interface), "\">"; if ($interface->packageName() != $class->packageName()) { echo $interface->packageName(), "\\"; } echo $interface->name(), "</a> "; } echo "</dd>\n"; echo "</dl>\n\n"; } $subclasses =& $class->subclasses(); if ($subclasses) { echo "<dl>\n"; echo "<dt>All Known Subclasses:</dt>\n"; echo "<dd>"; foreach ($subclasses as $subclass) { echo "<a href=\"", $this->_asURL($subclass), "\">"; if ($subclass->packageName() != $class->packageName()) { echo $subclass->packageName(), "\\"; } echo $subclass->name(), "</a> "; } echo "</dd>\n"; echo "</dl>\n\n"; } echo "\n\n- - -\n\n"; if ($class->isInterface()) { echo "<p><strong>", $class->modifiers(), " interface</strong> <span>{$class->name()}</span>"; } else { echo "<p><strong>", $class->modifiers(), " class</strong> <span>{$class->name()}</span>"; } if ($class->superclass()) { $superclass =& $rootDoc->classNamed($class->superclass()); if ($superclass) { echo "\n<strong>extends</strong> <a href=\"", $this->_asURL($superclass), "\">", $superclass->name(), "</a>\n\n"; } else { echo "\n<strong>extends</strong> ", $class->superclass(), "\n\n"; } } echo "</p>\n\n"; $textTag =& $class->tags("@text"); if ($textTag) { echo "<div class=\"comment\" id=\"overview_description\">", $this->_processInlineTags($textTag), "</div>\n\n"; } $this->_processTags($class->tags()); echo "\n\n<hr />\n\n"; $constants =& $class->constants(); ksort($constants); $fields =& $class->fields(); ksort($fields); $constructor =& $class->constructor(); $methods =& $class->methods(TRUE); ksort($methods); if ($constants) { echo "\n\n<table id=\"summary_field\">\n"; echo "<tr><th colspan=\"2\">Constant Summary</th></tr>\n"; foreach ($constants as $field) { $textTag =& $field->tags("@text"); echo "<tr>\n"; echo "<td>\n {$this->_fieldSignature($field)}\n </td>\n"; echo "<td class=\"description\">"; echo "<p class=\"name\" ><a href=\"#", $this->_asURL($field), "\">"; if (is_null($field->constantValue())) { echo " \$"; } echo $field->name(), "</a>\n </p>"; if ($textTag) { echo "<p class=\"description\">", strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"), "</p>"; } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } if ($fields) { echo "\n\n<table id=\"summary_field\">\n"; echo "<tr><th colspan=\"2\">Field Summary</th></tr>\n"; foreach ($fields as $field) { $textTag =& $field->tags("@text"); echo "<tr>\n"; echo "<td>{$this->_fieldSignature($field)}</td>\n"; echo "<td class=\"description\">"; echo "<p class=\"name\" ><a href=\"", $this->_asURL($field), "\">"; if (is_null($field->constantValue())) { echo " \$"; } echo $field->name(), "</a>\n </p>"; if ($textTag) { echo "<p class=\"description\">", strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"), "</p>"; } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } if ($class->superclass()) { $superclass =& $rootDoc->classNamed($class->superclass()); if ($superclass) { $this->inheritFields($superclass, $rootDoc, $package); } } if ($constructor) { echo "<table id=\"summary_constructor\">", "\n"; echo "<tr><th colspan=\"2\">Constructor Summary</th></tr>", "\n"; $textTag =& $constructor->tags("@text"); echo "<tr>\n"; echo "<td>{$this->_methodSignature($constructor)}</td>\n"; echo "<td class=\"description\">"; echo "<p class=\"name\"><a href=\"#{$constructor->name()}\">", $constructor->name(), "</a>", $this->_flatSignature($constructor), "</p>"; if ($textTag) { echo "<p class=\"description\">", strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"), "</p>"; } echo "</td>\n"; echo "</tr>\n"; echo "</table>\n\n"; } if ($methods) { echo "<table id=\"summary_method\">", "\n"; echo "<tr><th colspan=\"2\">Method Summary</th></tr>", "\n"; foreach ($methods as $method) { $textTag =& $method->tags("@text"); echo "<tr>\n"; echo "<td>{$this->_methodSignature($method)}</td>\n"; echo "<td class=\"description\">"; echo "<p class=\"name\"><a href=\"#", strtolower($method->name()), "\">", $method->name(), "</a>", $this->_flatSignature($method), "</p>"; if ($textTag) { echo "<p class=\"description\">", strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"), "</p>"; } echo "</td>\n"; echo "</tr>\n"; } echo "</table>\n\n"; } if ($class->superclass()) { $superclass =& $rootDoc->classNamed($class->superclass()); if ($superclass) { $this->inheritMethods($superclass, $rootDoc, $package); } } if ($constants) { echo "##Constant Detail##", "\n"; foreach ($constants as $field) { $textTag =& $field->tags("@text"); $type =& $field->type(); $this->_sourceLocation($field); echo "<h3 id=\"", $field->name(), "\">", $field->name(), "</h3>\n"; echo $this->_fieldSignature($field); echo "<span class='no'>"; if (is_null($field->constantValue())) { echo " \$"; } echo $field->name(), "</span>"; if (!is_null($field->value())) { echo "<span class='o'> = ", htmlspecialchars($field->value()), "</span>\n\n"; } echo "<div class=\"details\">", "\n"; if ($textTag) { echo $this->_processInlineTags($textTag); } $this->_processTags($field->tags()); echo "\n</div>"; echo "\n\n- - -\n\n"; } } if ($fields) { echo "##Field Detail##", "\n"; foreach ($fields as $field) { $textTag =& $field->tags("@text"); $type =& $field->type(); $this->_sourceLocation($field); echo "<h3 id=\"", $field->name(), "\">", $field->name(), "</h3>\n"; echo $this->_fieldSignature($field); echo "<span class='no'>"; if (is_null($field->constantValue())) { echo " \$"; } echo $field->name(), "</span>"; if (!is_null($field->value())) { echo "<span class='o'> = ", htmlspecialchars($field->value()), "</span>\n\n"; } echo "<div class=\"details\">", "\n"; if ($textTag) { echo $this->_processInlineTags($textTag); } $this->_processTags($field->tags()); echo "\n</div>"; echo "\n\n- - -\n\n"; } } if ($constructor) { echo "<h2>Constructor Detail</h2>\n\n"; $textTag =& $constructor->tags("@text"); $this->_sourceLocation($constructor); echo "<h3 id=\"{$constructor->name()}\">{$constructor->name()}</h3>\n"; echo $this->_methodSignature($constructor); echo " <span class='nf'>{$constructor->name()}</span> {$this->_flatSignature($constructor)}"; echo "\n\n"; echo "<div class=\"details\">", "\n"; if ($textTag) { echo $this->_processInlineTags($textTag); } $this->_processTags($constructor->tags()); echo "\n</div>"; echo "\n\n- - -\n\n"; } if ($methods) { echo "<h2 id=\"detail_method\">Method Detail</h2>", "\n"; foreach ($methods as $method) { $textTag =& $method->tags("@text"); $this->_sourceLocation($method); echo "<h3 id=\"", $method->name(), "()\">", $method->name(), "</h3>\n"; echo $this->_methodSignature($method); echo " <span class='nf'>{$method->name()}</span> {$this->_flatSignature($method)}"; echo "\n\n"; echo "<div class=\"details\">", "\n"; if ($textTag) { echo $this->_processInlineTags($textTag); } $this->_processTags($method->tags()); echo "\n</div>"; echo "\n\n- - -\n\n"; } } $this->_output = ob_get_contents(); ob_end_clean(); $this->_write($this->_asPath($class) . '.md'); } } } }
/** Build the element index. * * @param Doclet doclet */ function indexWriter(&$doclet) { parent::MDWriter($doclet); $phpdoctor =& $this->_doclet->phpdoctor(); $displayTree = $phpdoctor->getOption("tree"); $rootDoc =& $this->_doclet->rootDoc(); $classes =& $rootDoc->classes(); if ($classes == NULL) { $classes = array(); } $functions =& $rootDoc->functions(); if ($functions == NULL) { $functions = array(); } $globals =& $rootDoc->globals(); if ($globals == NULL) { $globals = array(); } $elements = array_merge($classes, $functions, $globals); uasort($elements, array($this, "compareElements")); ob_start(); echo "#INDEX#"; if (isset($this->_doclet->phpdoctor()->_options["github_repository"])) { echo "\n\n[View Source codes]({$this->getSourcesBaseURL()})"; } if ($displayTree) { echo "\n\n[View class hierarchy]({$this->getDirBaseURL()}/overview-tree)"; } echo "\n\n[View depreacted list]({$this->getDirBaseURL()}/deprecated-list)"; echo "\n\n[View todo list]({$this->getDirBaseURL()}/todo-list)"; echo "\n\n[View the list of all classes, functions and globals]({$this->getDirBaseURL()}/index-all)"; $this->_output = ob_get_contents(); ob_end_clean(); $this->_write("README.md"); ///------------------------------------------------------ ob_start(); $letter = 64; foreach ($elements as $name => $element) { $firstChar = strtoupper(substr($element->name(), 0, 1)); if (is_object($element) && $firstChar != chr($letter)) { $letter = ord($firstChar); echo "<a href=\"#", strtolower(chr($letter)), "\">", chr($letter), "</a>\n"; } } echo "- - -\n\n"; $first = TRUE; foreach ($elements as $element) { if (is_object($element)) { if (strtoupper(substr($element->name(), 0, 1)) != chr($letter)) { $letter = ord(strtoupper(substr($element->name(), 0, 1))); if (!$first) { echo "</dl>\n"; } $first = FALSE; echo "<h1 id=\"letter", chr($letter), "\">", chr($letter), "</h1>\n"; echo "<dl>\n"; } $parent =& $element->containingClass(); if ($parent && strtolower(get_class($parent)) != "rootdoc") { $in = "class <a href=\"" . $this->_asURL($parent) . "\">" . $parent->qualifiedName() . "</a>"; } else { $package =& $element->containingPackage(); $in = "namespace <a href=\"" . $this->_asURL($package) . "/README.md\">" . $package->name() . "</a>"; } switch (strtolower(get_class($element))) { case "classdoc": if ($element->isOrdinaryClass()) { echo "<dt><a href=\"", $this->_asURL($element), "\">", $element->name(), "</a> - Class in ", $in, "</dt>\n"; } elseif ($element->isInterface()) { echo "<dt><a href=\"", $this->_asURL($element), "\">", $element->name(), "</a> - Interface in ", $in, "</dt>\n"; } elseif ($element->isException()) { echo "<dt><a href=\"", $this->_asURL($element), "\">", $element->name(), "</a> - Exception in ", $in, "</dt>\n"; } break; case 'methoddoc': if ($element->isFunction()) { echo '<dt><a href="', $this->_asURL($element), '">', $element->name(), '()</a> - Function in ', $in, "</dt>\n"; } break; case "fielddoc": if ($element->isGlobal()) { echo "<dt><a href=\"", $this->_asURL($element), "\">", $element->name(), "</a> - Global in ", $in, "</dt>\n"; } break; } if (($textTag =& $element->tags("@text")) && ($firstSentenceTags =& $textTag->firstSentenceTags($this->_doclet))) { echo "<dd>"; foreach ($firstSentenceTags as $firstSentenceTag) { echo $firstSentenceTag->text($this->_doclet); } echo "</dd>\n"; } } } echo "</dl>\n"; $this->_output = ob_get_contents(); ob_end_clean(); $this->_write("index-all.md"); }