Пример #1
0
    /** Build the HTML frameset.
     *
     * @param Doclet doclet
     */
    function frameOutputWriter(&$doclet)
    {
        parent::HTMLWriter($doclet);
        ob_start();
        echo <<<END
\t\t
<frameset cols="20%,80%">

<frameset rows="30%,70%">

<frame src="overview-frame.html" name="packagelist">
<frame src="allitems-frame.html" name="index">

</frameset>

<frame src="overview-summary.html" name="main">

<noframes>
    <body>
        <h2>Frame Alert</h2>
        <p>This document is designed to be viewed using frames. If you see this message, you are using a non-frame-capable browser.<br>
        Link to <a href="overview-summary.html">Non-frame version</a>.</p>
    </body>
</noframes>

</frameset>
END;
        $this->_output = ob_get_contents();
        ob_end_clean();
        $this->_write('index.html', FALSE, FALSE);
    }
Пример #2
0
    /** Build the HTML frameset.
     *
     * @param Doclet doclet
     */
    public function frameOutputWriter(&$doclet)
    {
        parent::HTMLWriter($doclet);
        ob_start();
        echo <<<END

<frameset cols="20%,80%" frameborder="1" border="1" bordercolor="#bbb" framespacing="1">

<frame src="frame.html" name="index">
<frame src="namespaces.html" name="main">

<noframes>
    <body>
        <h2>Frame Alert</h2>
        <p>This document is designed to be viewed using frames. If you see this message, you are using a non-frame-capable browser.<br>
        Link to <a href="namespaces.html">Non-frame version</a>.</p>
    </body>
</noframes>

</frameset>
END;
        $this->_output = ob_get_contents();
        ob_end_clean();
        $this->_write('index.html', false, false, false);
    }
Пример #3
0
 /** Build the function definitons.
  *
  * @param Doclet doclet
  */
 function functionWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $this->_id = 'definition';
     $rootDoc =& $this->_doclet->rootDoc();
     $packages =& $rootDoc->packages();
     ksort($packages);
     foreach ($packages as $packageName => $package) {
         $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
         $this->_sections[1] = array('title' => 'Package', 'url' => $package->asPath() . '/package-summary.html');
         $this->_sections[2] = array('title' => 'Function', 'selected' => TRUE);
         //$this->_sections[3] = array('title' => 'Use');
         $this->_sections[4] = array('title' => 'Tree', 'url' => 'overview-tree.html');
         $this->_sections[5] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
         $this->_sections[6] = array('title' => 'Index', 'url' => 'index-all.html');
         $this->_depth = $package->depth() + 1;
         ob_start();
         echo "<hr>\n\n";
         echo "<h1>Functions</h1>\n\n";
         echo "<hr>\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 class="type">', $function->modifiers(FALSE), ' ', $function->returnTypeAsString(), "</td>\n";
                 echo '<td class="description">';
                 echo '<p class="name"><a href="#', $function->name(), '()">', $function->name(), '</a>', $function->flatSignature(), '</p>';
                 if ($textTag) {
                     echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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');
                 echo '<div class="location">', $function->location(), "</div>\n";
                 echo '<h3 id="', $function->name(), '()">', $function->name(), "</h3>\n";
                 echo '<code class="signature">', $function->modifiers(), ' ', $function->returnTypeAsString(), ' <strong>';
                 echo $function->name(), '</strong>', $function->flatSignature();
                 echo "</code>\n";
                 echo '<div class="details">', "\n";
                 if ($textTag) {
                     echo $this->_processInlineTags($textTag), "\n";
                 }
                 $this->_processTags($function->tags());
                 echo "</div>\n\n";
                 echo "<hr>\n\n";
             }
         }
         $this->_output = ob_get_contents();
         ob_end_clean();
         $this->_write($package->asPath() . '/package-functions.html', 'Functions', TRUE);
     }
 }
Пример #4
0
 /** Build the function definitons.
  *
  * @param Doclet doclet
  */
 public function functionWriter(&$doclet)
 {
     parent::HTMLWriter($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 '<header>';
         echo '<h1>' . $this->_doclet->_docTitle . '</h1>';
         echo "<span>Global</span>\n\n";
         echo "<h2>Functions</h2>\n\n";
         echo '</header>';
         $functions =& $package->functions();
         if ($functions) {
             ksort($functions);
             echo '<table>', "\n";
             foreach ($functions as $function) {
                 $textTag =& $function->tags('@text');
                 echo "<tr>\n";
                 echo '<td class="type">', $function->modifiers(FALSE), ' ', $function->returnTypeAsString(), "</td>\n";
                 echo '<td class="description">';
                 echo '<p class="name"><a href="#', $function->name(), '()">', $function->name(), '</a>', $function->flatSignature(), '</p>';
                 if ($textTag) {
                     echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><u><em>'), '</p>';
                 }
                 echo "</td>\n";
                 echo "</tr>\n";
             }
             echo "</table>\n\n";
             echo '<h2>Details</h2>', "\n";
             foreach ($functions as $function) {
                 $textTag =& $function->tags('@text');
                 $this->_sourceLocation($function);
                 echo '<h3 id="', $function->name(), '()">', $function->name(), "</h3>\n";
                 echo '<code class="signature">', $function->modifiers(), ' ', $function->returnTypeAsString(), ' <strong>';
                 echo $function->name(), '</strong>', $function->flatSignature();
                 echo "</code>\n";
                 echo '<div class="details">', "\n";
                 if ($textTag) {
                     echo $this->_processInlineTags($textTag), "\n";
                 }
                 $this->_processTags($function->tags());
                 echo "</div>\n\n";
             }
         }
         $this->_output = ob_get_contents();
         ob_end_clean();
         $this->_write($package->asPath() . '/package-functions.html', 'Functions', TRUE);
     }
 }
Пример #5
0
 /** Build the package frame index.
  *
  * @param Doclet doclet
  */
 function packageFrameWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $rootDoc =& $this->_doclet->rootDoc();
     $this->_output =& $this->_allItems($rootDoc);
     $this->_write('allitems-frame.html', 'All Items', FALSE);
     $packages =& $rootDoc->packages();
     ksort($packages);
     foreach ($packages as $packageName => $package) {
         $this->_depth = $package->depth() + 1;
         $this->_output =& $this->_buildFrame($package);
         $this->_write($package->asPath() . '/package-frame.html', $package->name(), FALSE);
     }
 }
Пример #6
0
 function functionWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $rootDoc =& $this->_doclet->rootDoc();
     $packages =& $rootDoc->packages();
     ksort($packages);
     foreach ($packages as $packageName => $package) {
         $doc = new DomDocument();
         $doc->preserveWhiteSpace = FALSE;
         $doc->formatOutput = TRUE;
         $dom_functions = $doc->createElement('functions');
         $dom_functions->setAttribute('package', $package->name());
         $functions =& $package->functions();
         if ($functions) {
             ksort($functions);
             foreach ($functions as $function) {
                 $dom_function = $doc->createElement('function');
                 $dom_modifiers = $doc->createElement('modifiers');
                 foreach (explode(' ', trim($function->modifiers())) as $modifier) {
                     $dom_modifiers->appendChild($doc->createElement('modifier', $modifier));
                 }
                 $dom_function->appendChild($dom_modifiers);
                 $type = $function->returnTypeAsString();
                 $type = $this->__removeTextFromMarkup($type);
                 $dom_function->setAttribute('name', $function->name());
                 $dom_function->setAttribute('return', $type);
                 $dom_signature = $doc->createElement('parameters');
                 $this->getSignature($function, $doc, $dom_signature);
                 $dom_function->appendChild($dom_signature);
                 $dom_location = $doc->createElement('location', $function->sourceFilename());
                 $dom_location->setAttribute('line', $function->sourceLine());
                 $dom_function->appendChild($dom_location);
                 $textTag =& $function->tags('@text');
                 if ($textTag) {
                     $dom_description = $doc->createElement('description', $this->_processInlineTags($textTag));
                     $dom_function->appendChild($dom_description);
                 }
                 $dom_functions->appendChild($dom_function);
             }
         }
         $doc->appendChild($dom_functions);
         $this->_output = $doc->saveXML();
         $this->_write($package->asPath() . '/package-functions.xml', 'Functions', TRUE);
     }
 }
Пример #7
0
    /** Build the HTML frameset.
     *
     * @param Doclet doclet
     */
    function frameOutputWriter(&$doclet)
    {
        parent::HTMLWriter($doclet);
        ob_start();
        echo <<<END
\t\t
\t\t<table border="0" width="100%" height="100%">
\t\t\t<tr>
\t\t\t\t<td width="200" class="sidebar">
\t\t\t\t\t<iframe frameBorder="0" scrolling="no" src="overview-frame.html" class="overview-frame" name="packagelist" width="100%"></iframe>
\t\t\t\t\t<p>&nbsp;</p>
\t\t\t\t\t<iframe frameBorder="0" scrolling="no" src="allitems-frame.html" class="allitems-frame" name="index" width="100%"></iframe>
\t\t\t\t</td>
\t\t\t\t<td><iframe frameBorder="0" scrolling="no" src="overview-summary.html" class="overview-summary-frame" name="main" width="100%"></iframe></td>
\t\t\t</tr>
\t\t</table>
END;
        //<frameset cols="20%,80%" frameborder="1" framespacing="1" border="1">
        //
        //<frameset rows="30%,70%" frameborder="2" framespacing="2" border="2">
        //
        //<frame src="overview-frame.html" name="packagelist">
        //<frame src="allitems-frame.html" name="index">
        //
        //</frameset>
        //
        //<frame src="overview-summary.html" name="main">
        //
        //<noframes>
        //    <body>
        //        <h2>Frame Alert</h2>
        //        <p>This document is designed to be viewed using frames. If you see this message, you are using a non-frame-capable browser.<br>
        //        Link to <a href="overview-summary.html">Non-frame version</a>.</p>
        //    </body>
        //</noframes>
        //
        //</frameset>
        $this->_output = ob_get_contents();
        ob_end_clean();
        $this->_write('index.html', FALSE, FALSE);
    }
Пример #8
0
 /** Build the package frame index.
  *
  * @param Doclet doclet
  */
 function packageIndexFrameWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     ob_start();
     echo '<body id="frame">', "\n\n";
     echo '<h1>' . $this->_doclet->getHeader() . "</h1>\n\n";
     echo "<ul>\n";
     echo '<li><a href="allitems-frame.html" target="index">All Items</a></li>' . "\n";
     echo "</ul>\n\n";
     echo "<h1>Namespaces</h1>\n\n";
     $rootDoc =& $this->_doclet->rootDoc();
     echo "<ul>\n";
     $packages =& $rootDoc->packages();
     ksort($packages);
     foreach ($packages as $name => $package) {
         echo '<li><a href="' . $package->asPath() . '/package-frame.html" target="index">' . $package->name() . '</a></li>' . "\n";
     }
     echo "</ul>\n\n";
     echo '</body>', "\n\n";
     $this->_output = ob_get_contents();
     ob_end_clean();
     $this->_write('overview-frame.html', 'Overview', FALSE);
 }
Пример #9
0
 /** Parse the source files.
  *
  * @param Doclet doclet
  */
 function sourceWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $rootDoc =& $this->_doclet->rootDoc();
     $phpdoctor =& $this->_doclet->phpdoctor();
     $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
     $this->_sections[1] = array('title' => 'Package');
     $this->_sections[2] = array('title' => 'Class');
     //$this->_sections[3] = array('title' => 'Use');
     if ($phpdoctor->getOption('tree')) {
         $this->_sections[4] = array('title' => 'Tree', 'url' => 'overview-tree.html');
     }
     $this->_sections[5] = array('title' => 'Files', 'url' => 'overview-files.html', 'selected' => TRUE);
     $this->_sections[6] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
     $this->_sections[7] = array('title' => 'Index', 'url' => 'index-all.html');
     $sources =& $rootDoc->sources();
     $this->_id = 'files';
     ob_start();
     echo "<hr>\n\n";
     echo '<h1>Source Files</h1>';
     echo "<ul>\n";
     foreach ($sources as $filename => $data) {
         $url = strtolower(str_replace(DIRECTORY_SEPARATOR, '/', $filename));
         echo '<li><a href="source/', $url, '.html">', $filename, '</a></li>';
     }
     echo "</ul>\n";
     $this->_output = ob_get_contents();
     ob_end_clean();
     $this->_write('overview-files.html', 'Overview', TRUE);
     $this->_id = 'file';
     foreach ($sources as $filename => $data) {
         $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
         $this->_sections[1] = array('title' => 'Package');
         $this->_sections[2] = array('title' => 'Class');
         //$this->_sections[3] = array('title' => 'Use');
         if ($phpdoctor->getOption('tree')) {
             $this->_sections[4] = array('title' => 'Tree');
         }
         $this->_sections[5] = array('title' => 'Files', 'url' => 'overview-files.html');
         $this->_sections[6] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
         $this->_sections[7] = array('title' => 'Todo', 'url' => 'todo-list.html');
         $this->_sections[8] = array('title' => 'Index', 'url' => 'index-all.html');
         $this->_depth = substr_count($filename, '/') + 1;
         if (class_exists('GeSHi')) {
             $geshi = new GeSHi($data[0], 'php');
             $source = $geshi->parse_code();
         } else {
             $source = '<pre>' . $data[0] . '</pre>';
         }
         ob_start();
         echo "<hr>\n\n";
         echo '<h1>' . $filename . "</h1>\n";
         if (isset($data[1]['tags']['@text'])) {
             echo '<div class="comment" id="overview_description">', $this->_processInlineTags($data[1]['tags']['@text']), "</div>\n\n";
         }
         echo "<hr>\n\n";
         foreach (explode("\n", $source) as $index => $line) {
             echo '<a name="line' . ($index + 1) . '"></a>' . $line . "\n";
         }
         $this->_output = ob_get_contents();
         ob_end_clean();
         $this->_write('source/' . strtolower($filename) . '.html', $filename, TRUE);
     }
 }
Пример #10
0
 /** Build the function definitons.
  *
  * @param Doclet doclet
  */
 public function globalWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $this->_id = 'definition';
     $rootDoc =& $this->_doclet->rootDoc();
     $packages =& $rootDoc->packages();
     ksort($packages);
     foreach ($packages as $packageName => $package) {
         $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
         $this->_sections[1] = array('title' => 'Namespace', 'url' => $package->asPath() . '/package-summary.html');
         $this->_sections[2] = array('title' => 'Global', 'selected' => TRUE);
         //$this->_sections[3] = array('title' => 'Use');
         $this->_sections[4] = array('title' => 'Tree', 'url' => 'overview-tree.html');
         if ($doclet->includeSource()) {
             $this->_sections[5] = array('title' => 'Files', 'url' => 'overview-files.html');
         }
         $this->_sections[6] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
         $this->_sections[7] = array('title' => 'Todo', 'url' => 'todo-list.html');
         $this->_sections[8] = array('title' => 'Index', 'url' => 'index-all.html');
         $this->_depth = $package->depth() + 1;
         ob_start();
         echo "<hr>\n\n";
         echo "<h1>Globals</h1>\n\n";
         echo "<hr>\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 class="type">', $global->modifiers(FALSE), ' ', $global->typeAsString(), "</td>\n";
                 echo '<td class="description">';
                 echo '<p class="name"><a href="#', $global->name(), '">', $global->name(), '</a></p>';
                 if ($textTag) {
                     echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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 '<code class="signature">', $global->modifiers(), ' ', $global->typeAsString(), ' <strong>';
                 echo $global->name(), '</strong>';
                 if ($global->value()) {
                     echo ' = ', htmlspecialchars($global->value());
                 }
                 echo "</code>\n";
                 echo '<div class="details">', "\n";
                 if ($textTag) {
                     echo $this->_processInlineTags($textTag), "\n";
                 }
                 echo "</div>\n\n";
                 $this->_processTags($global->tags());
                 echo "<hr>\n\n";
             }
         }
         $this->_output = ob_get_contents();
         ob_end_clean();
         $this->_write($package->asPath() . '/package-globals.html', 'Globals', TRUE);
     }
 }
Пример #11
0
 function deprecatedWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $rootDoc =& $this->_doclet->rootDoc();
     $doc = new DomDocument();
     $doc->preserveWhiteSpace = FALSE;
     $doc->formatOutput = TRUE;
     $dom_deprecated = $doc->createElement('deprecated');
     $deprecatedClasses = array();
     $deprecatedFields = array();
     $deprecatedMethods = array();
     $deprecatedConstants = array();
     $deprecatedGlobals = array();
     $deprecatedFunctions = array();
     $classes =& $rootDoc->classes();
     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;
                     }
                 }
             }
             $constants =& $class->constants();
             if ($constants) {
                 foreach ($constants as $constant) {
                     if ($constant->tags('@deprecated')) {
                         $deprecatedConstants[] = $constant;
                     }
                 }
             }
         }
     }
     $globals =& $rootDoc->globals();
     if ($globals) {
         foreach ($globals as $global) {
             if ($global->tags('@deprecated')) {
                 $deprecatedGlobals[] = $global;
             }
         }
     }
     $functions =& $rootDoc->functions();
     if ($functions) {
         foreach ($functions as $function) {
             if ($function->tags('@deprecated')) {
                 $deprecatedFunctions[] = $function;
             }
         }
     }
     if ($deprecatedClasses) {
         $dom_list = $doc->createElement('classes');
         foreach ($deprecatedClasses as $item) {
             $textTag =& $item->tags('@text');
             $description = '';
             if ($textTag) {
                 $description = $this->_processInlineTags($textTag);
             }
             $dom_item = $doc->createElement('class', $description);
             $dom_item->setAttribute('name', $item->name());
             $dom_item->setAttribute('package', $item->packageName());
             $dom_list->appendChild($dom_item);
         }
         $dom_deprecated->appendChild($dom_list);
     }
     if ($deprecatedFields) {
         $dom_list = $doc->createElement('fields');
         foreach ($deprecatedFields as $item) {
             $textTag =& $item->tags('@text');
             $description = '';
             if ($textTag) {
                 $description = $this->_processInlineTags($textTag);
             }
             $dom_item = $doc->createElement('field', $description);
             $dom_item->setAttribute('name', $item->name());
             $dom_item->setAttribute('class', $item->containingClass()->name());
             $dom_item->setAttribute('package', $item->packageName());
             $dom_list->appendChild($dom_item);
         }
         $dom_deprecated->appendChild($dom_list);
     }
     if ($deprecatedConstants) {
         $dom_list = $doc->createElement('constants');
         foreach ($deprecatedConstants as $item) {
             $textTag =& $item->tags('@text');
             $description = '';
             if ($textTag) {
                 $description = $this->_processInlineTags($textTag);
             }
             $dom_item = $doc->createElement('constant', $description);
             $dom_item->setAttribute('name', $item->name());
             $dom_item->setAttribute('class', $item->containingClass()->name());
             $dom_item->setAttribute('package', $item->packageName());
             $dom_list->appendChild($dom_item);
         }
         $dom_deprecated->appendChild($dom_list);
     }
     if ($deprecatedMethods) {
         $dom_list = $doc->createElement('methods');
         foreach ($deprecatedMethods as $item) {
             $textTag =& $item->tags('@text');
             $description = '';
             if ($textTag) {
                 $description = $this->_processInlineTags($textTag);
             }
             $dom_item = $doc->createElement('method', $description);
             $dom_item->setAttribute('name', $item->name());
             $dom_item->setAttribute('class', $item->containingClass()->name());
             $dom_item->setAttribute('package', $item->packageName());
             $dom_list->appendChild($dom_item);
         }
         $dom_deprecated->appendChild($dom_list);
     }
     if ($deprecatedGlobals) {
         $dom_list = $doc->createElement('globals');
         foreach ($deprecatedGlobals as $item) {
             $textTag =& $item->tags('@text');
             $description = '';
             if ($textTag) {
                 $description = $this->_processInlineTags($textTag);
             }
             $dom_item = $doc->createElement('global', $description);
             $dom_item->setAttribute('name', $item->name());
             $dom_item->setAttribute('package', $item->packageName());
             $dom_list->appendChild($dom_item);
         }
         $dom_deprecated->appendChild($dom_list);
     }
     if ($deprecatedFunctions) {
         $dom_list = $doc->createElement('functions');
         foreach ($deprecatedFunctions as $item) {
             $textTag =& $item->tags('@text');
             $description = '';
             if ($textTag) {
                 $description = $this->_processInlineTags($textTag);
             }
             $dom_item = $doc->createElement('function', $description);
             $dom_item->setAttribute('name', $item->name());
             $dom_item->setAttribute('package', $item->packageName());
             $dom_list->appendChild($dom_item);
         }
         $dom_deprecated->appendChild($dom_list);
     }
     $doc->appendChild($dom_deprecated);
     $this->_output = $doc->saveXML();
     $this->_write('deprecated.xml', 'Deprecated', TRUE);
 }
Пример #12
0
 /** Build the class definitons.
  *
  * @param Doclet doclet
  */
 public function __construct(&$doclet)
 {
     parent::HTMLWriter($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 '<header>';
                 echo '<h1>' . $this->_doclet->_docTitle . '</h1>';
                 if ($class->isInterface()) {
                     echo "<span>Interface</span>\n\n";
                 } elseif ($class->isTrait()) {
                     echo "<span>Trait</span>\n\n";
                 } else {
                     echo "<span>Class</span>\n\n";
                 }
                 echo '<h2>', $class->qualifiedName(), "</h2>\n\n";
                 echo '</header>';
                 $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="', str_repeat('../', $this->_depth), $interface->asPath(), '">';
                         if ($interface->packageName() != $class->packageName()) {
                             echo $interface->packageName(), '\\';
                         }
                         echo $interface->name(), '</a> ';
                     }
                     echo "</dd>\n";
                     echo "</dl>\n\n";
                 }
                 $traits =& $class->traits();
                 if (count($traits) > 0) {
                     echo "<dl>\n";
                     echo "<dt>All Used Traits:</dt>\n";
                     echo '<dd>';
                     foreach ($traits as $trait) {
                         echo '<a href="', str_repeat('../', $this->_depth), $trait->asPath(), '">';
                         if ($trait->packageName() != $class->packageName()) {
                             echo $trait->packageName(), '\\';
                         }
                         echo $trait->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="', str_repeat('../', $this->_depth), $subclass->asPath(), '">';
                         if ($subclass->packageName() != $class->packageName()) {
                             echo $subclass->packageName(), '\\';
                         }
                         echo $subclass->name(), '</a> ';
                     }
                     echo "</dd>\n";
                     echo "</dl>\n\n";
                 }
                 if ($class->isInterface()) {
                     echo '<p class="signature">', $class->modifiers(), ' interface <strong>', $class->name(), '</strong>';
                 } elseif ($class->isTrait()) {
                     echo '<p class="signature">', $class->modifiers(), ' trait <strong>', $class->name(), '</strong>';
                 } else {
                     echo '<p class="signature">', $class->modifiers(), ' class <strong>', $class->name(), '</strong>';
                 }
                 if ($class->superclass()) {
                     $superclass =& $rootDoc->classNamed($class->superclass());
                     if ($superclass) {
                         echo ' extends <a href="', str_repeat('../', $this->_depth), $superclass->asPath(), '">', $superclass->name(), "</a>\n\n";
                     } else {
                         echo ' extends ', $class->superclass(), "\n\n";
                     }
                 }
                 echo "</p>\n\n";
                 $textTag =& $class->tags('@text');
                 if ($textTag) {
                     echo '<div class="comment">', $this->_processInlineTags($textTag), "</div>\n\n";
                 }
                 $this->_processTags($class->tags());
                 $constants =& $class->constants();
                 ksort($constants);
                 $fields =& $class->fields();
                 ksort($fields);
                 $methods =& $class->methods();
                 ksort($methods);
                 $isSomething = false;
                 if ($constants) {
                     $isSomething = true;
                     echo '<h3>Constants</h3>', "\n";
                     echo '<table>', "\n";
                     foreach ($constants as $field) {
                         $textTag =& $field->tags('@text');
                         echo "<tr>\n";
                         echo '<td class="type">', $field->modifiers(FALSE), ' ', $field->typeAsString(), "</td>\n";
                         echo '<td class="description">';
                         echo '<p class="name"><a href="#', $field->name(), '">';
                         if (is_null($field->constantValue())) {
                             echo '$';
                         }
                         echo $field->name(), '</a></p>';
                         if ($textTag) {
                             echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><u><em>'), '</p>';
                         }
                         echo "</td>\n";
                         echo "</tr>\n";
                     }
                     echo "</table>\n\n";
                 }
                 if ($fields) {
                     $isSomething = true;
                     echo '<h3>Fields</h3>', "\n";
                     echo '<table>', "\n";
                     foreach ($fields as $field) {
                         $textTag =& $field->tags('@text');
                         echo "<tr>\n";
                         echo '<td class="type">', $field->modifiers(FALSE), ' ', $field->typeAsString(), "</td>\n";
                         echo '<td class="description">';
                         echo '<p class="name"><a href="#', $field->name(), '">';
                         if (is_null($field->constantValue())) {
                             echo '$';
                         }
                         echo $field->name(), '</a></p>';
                         if ($textTag) {
                             echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><u><em>'), '</p>';
                         }
                         echo "</td>\n";
                         echo "</tr>\n";
                     }
                     echo "</table>\n\n";
                 }
                 if ($class->superclass()) {
                     $superclass =& $rootDoc->classNamed($class->superclass());
                     if ($superclass) {
                         $isSomething = true;
                         $this->inheritFields($superclass, $rootDoc, $package);
                     }
                 }
                 if ($methods) {
                     $isSomething = true;
                     echo '<h3>Methods</h3>', "\n";
                     echo '<table>', "\n";
                     foreach ($methods as $method) {
                         $textTag =& $method->tags('@text');
                         echo "<tr>\n";
                         echo '<td class="type">', $method->modifiers(FALSE), ' ', $method->returnTypeAsString(), "</td>\n";
                         echo '<td class="description">';
                         echo '<p class="name"><a href="#', $method->name(), '()">', $method->name(), '</a>', $method->flatSignature(), '</p>';
                         if ($textTag) {
                             echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><u><em>'), '</p>';
                         }
                         echo "</td>\n";
                         echo "</tr>\n";
                     }
                     echo "</table>\n\n";
                 }
                 if ($class->superclass()) {
                     $superclass =& $rootDoc->classNamed($class->superclass());
                     if ($superclass) {
                         $isSomething = true;
                         $this->inheritMethods($superclass, $rootDoc, $package);
                     }
                 }
                 if ($isSomething) {
                     echo '<h3>Details</h3>', "\n";
                     if ($constants) {
                         foreach ($constants as $field) {
                             $textTag =& $field->tags('@text');
                             $type =& $field->type();
                             echo '<code class="signature" id="' . $field->name() . '">', $field->modifiers(), ' ', $field->typeAsString(), ' <strong>';
                             if (is_null($field->constantValue())) {
                                 echo '$';
                             }
                             echo $field->name(), '</strong>';
                             if (!is_null($field->value())) {
                                 echo ' = ', htmlspecialchars($field->value());
                             }
                             echo "</code>\n";
                             echo '<div class="details">', "\n";
                             if ($textTag) {
                                 echo $this->_processInlineTags($textTag);
                             }
                             $this->_processTags($field->tags());
                             echo "</div>\n\n";
                         }
                     }
                     if ($fields) {
                         foreach ($fields as $field) {
                             $textTag =& $field->tags('@text');
                             $type =& $field->type();
                             echo '<code class="signature" id="' . $field->name() . '">', $field->modifiers(), ' ', $field->typeAsString(), ' <strong>';
                             if (is_null($field->constantValue())) {
                                 echo '$';
                             }
                             echo $field->name(), '</strong>';
                             if (!is_null($field->value())) {
                                 echo ' = ', htmlspecialchars($field->value());
                             }
                             echo "</code>\n";
                             echo '<div class="details">', "\n";
                             if ($textTag) {
                                 echo $this->_processInlineTags($textTag);
                             }
                             $this->_processTags($field->tags());
                             echo "</div>\n\n";
                         }
                     }
                     if ($methods) {
                         foreach ($methods as $method) {
                             $textTag =& $method->tags('@text');
                             echo '<code class="signature" id="' . $method->name() . '">', $method->modifiers(), ' ', $method->returnTypeAsString(), ' <strong>';
                             echo $method->name(), '</strong>', $method->flatSignature();
                             echo "</code>\n";
                             echo '<div class="details">', "\n";
                             if ($textTag) {
                                 echo $this->_processInlineTags($textTag);
                             }
                             $this->_processTags($method->tags());
                             echo "</div>\n\n";
                         }
                     }
                 }
                 $this->_output = ob_get_contents();
                 ob_end_clean();
                 $this->_write($package->asPath() . '/' . strtolower($class->name()) . '.html', $class->name(), TRUE);
             }
         }
     }
 }
Пример #13
0
 /** Build the todo index.
  *
  * @param Doclet doclet
  */
 function todoWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $rootDoc =& $this->_doclet->rootDoc();
     $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
     $this->_sections[1] = array('title' => 'Package');
     $this->_sections[2] = array('title' => 'Class');
     //$this->_sections[3] = array('title' => 'Use');
     $this->_sections[4] = array('title' => 'Tree', 'url' => 'overview-tree.html');
     if ($doclet->includeSource()) {
         $this->_sections[5] = array('title' => 'Files', 'url' => 'overview-files.html');
     }
     $this->_sections[6] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
     $this->_sections[7] = array('title' => 'Todo', 'selected' => TRUE);
     $this->_sections[8] = array('title' => 'Index', 'url' => 'index-all.html');
     $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 "<hr>\n\n";
     echo '<h1>Todo</h1>';
     echo "<hr>\n\n";
     if ($todoClasses || $todoFields || $todoMethods || $todoGlobals || $todoFunctions) {
         echo "<h2>Contents</h2>\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) {
             $textTag =& $class->tags('@text');
             echo '<tr><td class="name"><a href="', $class->asPath(), '">', $class->qualifiedName(), '</a></td>';
             echo '<td class="description">';
             if ($textTag) {
                 echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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) {
             $textTag =& $field->tags('@text');
             echo "<tr>\n";
             echo '<td class="name"><a href="', $field->asPath(), '">', $field->qualifiedName(), "</a></td>\n";
             echo '<td class="description">';
             if ($textTag) {
                 echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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) {
             $textTag =& $method->tags('@text');
             echo "<tr>\n";
             echo '<td class="name"><a href="', $method->asPath(), '">', $method->qualifiedName(), "</a></td>\n";
             echo '<td class="description">';
             if ($textTag) {
                 echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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) {
             $textTag =& $global->tags('@text');
             echo "<tr>\n";
             echo '<td class="name"><a href="', $global->asPath(), '">', $global->qualifiedName(), "</a></td>\n";
             echo '<td class="description">';
             if ($textTag) {
                 echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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) {
             $textTag =& $function->tags('@text');
             echo "<tr>\n";
             echo '<td class="name"><a href="', $function->asPath(), '">', $function->qualifiedName(), "</a></td>\n";
             echo '<td class="description">';
             if ($textTag) {
                 echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><u><em>');
             }
             echo "</td>\n";
             echo "</tr>\n";
         }
         echo "</table>\n\n";
     }
     $this->_output = ob_get_contents();
     ob_end_clean();
     $this->_write('todo-list.html', 'Todo', TRUE);
 }
Пример #14
0
 function classWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $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) {
                 $doc = new DomDocument();
                 $doc->preserveWhiteSpace = FALSE;
                 $doc->formatOutput = TRUE;
                 $dom_class = $doc->createElement('class');
                 if ($class->isInterface()) {
                     $dom_class->setAttribute('type', 'interface');
                 } else {
                     $dom_class->setAttribute('type', 'class');
                 }
                 $dom_class->setAttribute('name', $class->name());
                 $dom_class->setAttribute('handle', strtolower($class->name()));
                 $dom_package = $doc->createElement('package');
                 $dom_package->setAttribute('name', $class->packageName());
                 $dom_package->setAttribute('handle', $class->packageName());
                 $dom_class->appendChild($dom_package);
                 $dom_location = $doc->createElement('location', $class->sourceFilename());
                 $dom_location->setAttribute('line', $class->sourceLine());
                 $dom_class->appendChild($dom_location);
                 $implements =& $class->interfaces();
                 if (count($implements) > 0) {
                     $dom_interfaces = $doc->createElement('interfaces');
                     foreach ($implements as $interface) {
                         $dom_interface = $doc->createElement('interface', $interface->name());
                         $dom_interface->setAttribute('package', $interface->packageName());
                         $dom_interfaces->appendChild($dom_interface);
                     }
                     $dom_class->appendChild($dom_interfaces);
                 }
                 $dom_modifiers = $doc->createElement('modifiers');
                 foreach (explode(' ', trim($class->modifiers())) as $modifier) {
                     $dom_modifiers->appendChild($doc->createElement('modifier', $modifier));
                 }
                 $dom_class->appendChild($dom_modifiers);
                 if ($class->superclass()) {
                     $superclass =& $rootDoc->classNamed($class->superclass());
                     if ($superclass) {
                         $dom_superclass = $doc->createElement('superclass', $superclass->name());
                     } else {
                         $dom_superclass = $doc->createElement('superclass', $class->superclass());
                     }
                     $dom_class->appendChild($dom_superclass);
                 }
                 $textTag =& $class->tags('@text');
                 if ($textTag) {
                     $dom_description = $doc->createElement('description', $this->_processInlineTags($textTag));
                     $dom_class->appendChild($dom_description);
                 }
                 $this->_processTags($class->tags(), $doc, $dom_class);
                 $constants =& $class->constants();
                 ksort($constants);
                 $fields =& $class->fields();
                 ksort($fields);
                 $methods =& $class->methods();
                 ksort($methods);
                 if ($constants) {
                     $dom_constants = $doc->createElement('constants');
                     foreach ($constants as $field) {
                         $textTag =& $field->tags('@text');
                         $dom_constant = $doc->createElement('constant');
                         $dom_modifiers = $doc->createElement('modifiers');
                         foreach (explode(' ', trim($field->modifiers())) as $modifier) {
                             $dom_modifiers->appendChild($doc->createElement('modifier', $modifier));
                         }
                         $dom_constant->appendChild($dom_modifiers);
                         $type = $field->typeAsString();
                         $type = $this->__removeTextFromMarkup($type);
                         $dom_constant->setAttribute('name', (!$field->constantValue() ? "\$" : "") . $field->name());
                         $dom_constant->setAttribute('type', $type);
                         if ($field->value()) {
                             $dom_constant->setAttribute('value', htmlspecialchars($field->value()));
                         }
                         $dom_constant_location = $doc->createElement('location', $field->sourceFilename());
                         $dom_constant_location->setAttribute('line', $field->sourceLine());
                         $dom_constant->appendChild($dom_constant_location);
                         if ($textTag) {
                             $dom_constant_description = $doc->createElement('description', $this->_processInlineTags($textTag));
                             $dom_constant->appendChild($dom_constant_description);
                         }
                         $this->_processTags($field->tags(), $doc, $dom_constant);
                         $dom_constants->appendChild($dom_constant);
                     }
                     $dom_class->appendChild($dom_constants);
                 }
                 if ($fields) {
                     $dom_fields = $doc->createElement('fields');
                     foreach ($fields as $field) {
                         $textTag =& $field->tags('@text');
                         $dom_field = $doc->createElement('field');
                         $dom_modifiers = $doc->createElement('modifiers');
                         foreach (explode(' ', trim($field->modifiers())) as $modifier) {
                             $dom_modifiers->appendChild($doc->createElement('modifier', $modifier));
                         }
                         $dom_field->appendChild($dom_modifiers);
                         $type = $field->typeAsString();
                         $type = $this->__removeTextFromMarkup($type);
                         $dom_field->setAttribute('name', (!$field->constantValue() ? "\$" : "") . $field->name());
                         $dom_field->setAttribute('type', $type);
                         if ($field->value()) {
                             $dom_field->setAttribute('value', htmlspecialchars($field->value()));
                         }
                         $dom_field_location = $doc->createElement('location', $field->sourceFilename());
                         $dom_field_location->setAttribute('line', $field->sourceLine());
                         $dom_field->appendChild($dom_field_location);
                         if ($textTag) {
                             $dom_field_description = $doc->createElement('description', $this->_processInlineTags($textTag));
                             $dom_field->appendChild($dom_field_description);
                         }
                         $this->_processTags($field->tags(), $doc, $dom_field);
                         $dom_fields->appendChild($dom_field);
                     }
                     $dom_class->appendChild($dom_fields);
                 }
                 if ($class->superclass()) {
                     $superclass =& $rootDoc->classNamed($class->superclass());
                     if ($superclass) {
                         $dom_inherited_fields = $doc->createElement('inherited-fields');
                         $this->inheritFields($superclass, $rootDoc, $package, $doc, $dom_inherited_fields);
                         $dom_class->appendChild($dom_inherited_fields);
                     }
                 }
                 if ($methods) {
                     $dom_methods = $doc->createElement('methods');
                     foreach ($methods as $method) {
                         $textTag =& $method->tags('@text');
                         $dom_method = $doc->createElement('method');
                         $dom_modifiers = $doc->createElement('modifiers');
                         foreach (explode(' ', trim($method->modifiers())) as $modifier) {
                             $dom_modifiers->appendChild($doc->createElement('modifier', $modifier));
                         }
                         $dom_method->appendChild($dom_modifiers);
                         $type = $method->returnTypeAsString();
                         $type = $this->__removeTextFromMarkup($type);
                         $dom_method->setAttribute('name', $method->name());
                         $dom_method->setAttribute('return', $type);
                         $dom_signature = $doc->createElement('parameters');
                         $this->getSignature($method, $doc, $dom_signature);
                         $dom_method->appendChild($dom_signature);
                         $dom_method_location = $doc->createElement('location', $method->sourceFilename());
                         $dom_method_location->setAttribute('line', $method->sourceLine());
                         $dom_method->appendChild($dom_method_location);
                         if ($textTag) {
                             $dom_method_description = $doc->createElement('description', $this->_processInlineTags($textTag));
                             $dom_method->appendChild($dom_method_description);
                         }
                         $this->_processTags($method->tags(), $doc, $dom_method);
                         $dom_methods->appendChild($dom_method);
                     }
                     $dom_class->appendChild($dom_methods);
                 }
                 if ($class->superclass()) {
                     $superclass =& $rootDoc->classNamed($class->superclass());
                     if ($superclass) {
                         $dom_inherited_methods = $doc->createElement('inherited-methods');
                         $this->inheritMethods($superclass, $rootDoc, $package, $doc, $dom_inherited_methods);
                         $dom_class->appendChild($dom_inherited_methods);
                     }
                 }
                 $doc->appendChild($dom_class);
                 $this->_output = $doc->saveXML();
                 $this->_write($package->asPath() . '/' . strtolower($class->name()) . '.xml', $class->name(), TRUE);
             }
         }
     }
 }
Пример #15
0
 /** Build the package summaries.
  *
  * @param Doclet doclet
  */
 function packageWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $rootDoc =& $this->_doclet->rootDoc();
     $phpdoctor =& $this->_doclet->phpdoctor();
     $displayTree = $phpdoctor->getOption('tree');
     if ($displayTree) {
         $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
         $this->_sections[1] = array('title' => 'Namespace');
         $this->_sections[2] = array('title' => 'Class');
         //$this->_sections[3] = array('title' => 'Use');
         $this->_sections[4] = array('title' => 'Tree', 'selected' => TRUE);
         if ($doclet->includeSource()) {
             $this->_sections[5] = array('title' => 'Files', 'url' => 'overview-files.html');
         }
         $this->_sections[6] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
         $this->_sections[7] = array('title' => 'Todo', 'url' => 'todo-list.html');
         $this->_sections[8] = array('title' => 'Index', 'url' => 'index-all.html');
         $this->_id = 'tree';
         $tree = array();
         $classes =& $rootDoc->classes();
         if ($classes) {
             foreach ($classes as $class) {
                 $this->_buildTree($tree, $class);
             }
         }
         ob_start();
         echo "<hr>\n\n";
         echo '<h1>Class Hierarchy</h1>';
         $this->_displayTree($tree);
         $this->_output = ob_get_contents();
         ob_end_clean();
         $this->_write('overview-tree.html', 'Overview', TRUE);
     }
     $this->_id = 'package';
     $packages =& $rootDoc->packages();
     ksort($packages);
     foreach ($packages as $packageName => $package) {
         $this->_depth = $package->depth() + 1;
         $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
         $this->_sections[1] = array('title' => 'Namespace', 'selected' => TRUE);
         $this->_sections[2] = array('title' => 'Class');
         //$this->_sections[3] = array('title' => 'Use');
         if ($displayTree) {
             $this->_sections[4] = array('title' => 'Tree', 'url' => $package->asPath() . '/package-tree.html');
         }
         if ($doclet->includeSource()) {
             $this->_sections[5] = array('title' => 'Files', 'url' => 'overview-files.html');
         }
         $this->_sections[6] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
         $this->_sections[7] = array('title' => 'Todo', 'url' => 'todo-list.html');
         $this->_sections[8] = array('title' => 'Index', 'url' => 'index-all.html');
         ob_start();
         echo "<hr>\n\n";
         echo '<h1>Namespace ', $package->name(), "</h1>\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="', str_repeat('../', $this->_depth), $classes[$name]->asPath(), '">', $classes[$name]->name(), '</a></td>';
                 echo '<td class="description">';
                 if ($textTag) {
                     echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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="', str_repeat('../', $this->_depth), $interfaces[$name]->asPath(), '">', $interfaces[$name]->name(), '</a></td>';
                 echo '<td class="description">';
                 if ($textTag) {
                     echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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="', str_repeat('../', $this->_depth), $exceptions[$name]->asPath(), '">', $exceptions[$name]->name(), '</a></td>';
                 echo '<td class="description">';
                 if ($textTag) {
                     echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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.html#', $functions[$name]->name(), '">', $functions[$name]->name(), '</a></td>';
                 echo '<td class="description">';
                 if ($textTag) {
                     echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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.html#', $globals[$name]->name(), '">', $globals[$name]->name(), '</a></td>';
                 echo '<td class="description">';
                 if ($textTag) {
                     echo strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><u><em>');
                 }
                 echo "</td></tr>\n";
             }
             echo "</table>\n\n";
         }
         $textTag =& $package->tags('@text');
         if ($textTag) {
             echo '<h1>Namespace ', $package->name(), " Description</h1>\n\n";
             echo '<div class="comment" id="overview_description">' . $this->_processInlineTags($textTag), "</div>\n\n";
         }
         echo "<hr>\n\n";
         $this->_output = ob_get_contents();
         ob_end_clean();
         $this->_write($package->asPath() . '/package-summary.html', $package->name(), TRUE);
         if ($displayTree) {
             $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
             $this->_sections[1] = array('title' => 'Namespace', 'url' => $package->asPath() . '/package-summary.html', 'relative' => TRUE);
             $this->_sections[2] = array('title' => 'Class');
             //$this->_sections[3] = array('title' => 'Use');
             $this->_sections[4] = array('title' => 'Tree', 'url' => $package->asPath() . '/package-tree.html', 'selected' => TRUE, 'relative' => TRUE);
             if ($doclet->includeSource()) {
                 $this->_sections[5] = array('title' => 'Files', 'url' => 'overview-files.html');
             }
             $this->_sections[6] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
             $this->_sections[7] = array('title' => 'Todo', 'url' => 'todo-list.html');
             $this->_sections[8] = array('title' => 'Index', 'url' => 'index-all.html');
             $this->_id = 'tree';
             $tree = array();
             $classes =& $package->ordinaryClasses();
             if ($classes) {
                 ksort($classes);
                 foreach ($classes as $class) {
                     $this->_buildTree($tree, $class);
                 }
             }
             ob_start();
             echo "<hr>\n\n";
             echo '<h1>Class Hierarchy for Package ', $package->name(), '</h1>';
             $this->_displayTree($tree);
             $this->_output = ob_get_contents();
             ob_end_clean();
             $this->_write($package->asPath() . '/package-tree.html', $package->name(), TRUE);
         }
     }
 }
Пример #16
0
 function delegateWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $rootDoc =& $this->_doclet->rootDoc();
     $phpdoctor =& $this->_doclet->phpdoctor();
     $path = $phpdoctor->_options['source_path'];
     $files = $this->getFiles($path);
     $doc = new DomDocument();
     $doc->preserveWhiteSpace = FALSE;
     $doc->formatOutput = TRUE;
     $dom_delegates = $doc->createElement('delegates');
     $all_delegates = array();
     foreach ($files as $file) {
         $source = file_get_contents($file);
         $delegates = array();
         $in_parsed_string = FALSE;
         $counter = 0;
         $lineNumber = 1;
         $commentNumber = 0;
         $tokens = token_get_all($source);
         $numOfTokens = count($tokens);
         for ($key = 0; $key < $numOfTokens; $key++) {
             $token = $tokens[$key];
             $delegate = (object) array();
             if (!$in_parsed_string && is_array($token)) {
                 $lineNumber += substr_count($token[1], "\n");
                 $delegate->location = substr($file, strlen($path) + 1);
                 $delegate->location_line = $lineNumber + 1;
                 switch ($token[0]) {
                     case T_COMMENT:
                         // read comment
                     // read comment
                     case T_ML_COMMENT:
                         // and multiline comment (deprecated in newer versions)
                     // and multiline comment (deprecated in newer versions)
                     case T_DOC_COMMENT:
                         // and catch PHP5 doc comment token too
                         $comment = $token[1];
                         if (preg_match("/@delegate/", $comment)) {
                             $delegate->params = array();
                             $tags = $this->processDocComment($comment);
                             foreach ($tags as $tag) {
                                 switch ($tag['type']) {
                                     case 'text':
                                         $delegate->description = $tag['text'];
                                         break;
                                     case '@delegate':
                                         $delegate->name = $tag['text'];
                                         break;
                                     case '@param':
                                         $param_text = '';
                                         // from paramTag()
                                         $var = '';
                                         $text = '';
                                         $explode = preg_split('/[ \\t]+/', $tag['text']);
                                         $type = array_shift($explode);
                                         if ($type) {
                                             $var = trim(array_shift($explode), '$');
                                             $text = join(' ', $explode);
                                         }
                                         if ($text != '') {
                                             $param_text = $var . '  - ' . $text;
                                             //parent::tag('@param', $this->_var.' - '.$text, $root);
                                         } else {
                                             $param_text = $var;
                                             //parent::tag('@param', NULL, $root);
                                         }
                                         // from HTMLWriter()
                                         $text = $param_text;
                                         $text = $this->__removeTextFromMarkup($text);
                                         $type_split = explode(' - ', $text);
                                         if (count($type_split) > 1) {
                                             $name = $type_split[0];
                                             array_shift($type_split);
                                             $description = join(' - ', $type_split);
                                         } else {
                                             $name = NULL;
                                             $description = $text;
                                         }
                                         $parameter = array('description' => $description, 'type' => trim($type), 'name' => trim($name));
                                         $delegate->params[] = $parameter;
                                         break;
                                 }
                             }
                             $delegates[] = $delegate;
                         }
                         break;
                 }
             }
         }
         foreach ($delegates as $delegate) {
             $dom_delegate = $doc->createElement('delegate');
             $dom_delegate->setAttribute('name', $delegate->name);
             $dom_delegate->appendChild($doc->createElement('description', $delegate->description));
             $dom_location = $doc->createElement('location', $delegate->location);
             $dom_location->setAttribute('line', $delegate->location_line);
             $dom_delegate->appendChild($dom_location);
             $dom_parameters = $doc->createElement('parameters');
             foreach ($delegate->params as $param) {
                 $dom_param = $doc->createElement('parameter', $param['description']);
                 $dom_param->setAttribute('name', $param['name']);
                 $dom_param->setAttribute('type', $param['type']);
                 $dom_parameters->appendChild($dom_param);
             }
             $dom_delegate->appendChild($dom_parameters);
             $dom_delegates->appendChild($dom_delegate);
         }
         $doc->appendChild($dom_delegates);
     }
     $this->_output = $doc->saveXML();
     $this->_write('delegates.xml', 'Delegates', TRUE);
 }
Пример #17
0
 function packageWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $rootDoc =& $this->_doclet->rootDoc();
     $phpdoctor =& $this->_doclet->phpdoctor();
     $packages =& $rootDoc->packages();
     ksort($packages);
     $doc = new DomDocument();
     $doc->preserveWhiteSpace = FALSE;
     $doc->formatOutput = TRUE;
     $dom_packages = $doc->createElement('packages');
     foreach ($packages as $packageName => $package) {
         $dom_package = $doc->createElement('package');
         $dom_package->setAttribute('name', $package->name());
         $dom_package->setAttribute('handle', strtolower($package->name()));
         $textTag =& $package->tags('@text');
         if ($textTag) {
             $dom_package->appendChild($doc->createElement('description', $this->_processInlineTags($textTag)));
         }
         $classes =& $package->ordinaryClasses();
         if ($classes) {
             ksort($classes);
             $dom_items = $doc->createElement('classes');
             /*
             A. Recursive nested tree of classes
             */
             $tree = array();
             foreach ($classes as $class) {
                 $this->_buildTree($tree, $class);
             }
             $this->_displayTree($tree, NULL, $doc, $dom_items);
             /*
             B. Non-nested list of classes
             
             foreach($classes as $name => $class) {
             	
             	$description = NULL;
             	$textTag =& $classes[$name]->tags('@text');
             	if ($textTag) $description = $this->_processInlineTags($textTag);
             	
             	$dom_item = $doc->createElement('class', $description);
             	$dom_item->setAttribute('name', $classes[$name]->name());
             	$dom_item->setAttribute('path', str_repeat('../', $this->_depth), $classes[$name]->asPath());
             	
             	$dom_items->appendChild($dom_item);
             }				
             */
             $dom_package->appendChild($dom_items);
         }
         $interfaces =& $package->interfaces();
         if ($interfaces) {
             ksort($interfaces);
             $dom_items = $doc->createElement('interfaces');
             foreach ($interfaces as $name => $interface) {
                 $description = NULL;
                 $textTag =& $interfaces[$name]->tags('@text');
                 if ($textTag) {
                     $description = $this->_processInlineTags($textTag);
                 }
                 $dom_item = $doc->createElement('interface', $description);
                 $dom_item->setAttribute('name', $interfaces[$name]->name());
                 $dom_item->setAttribute('path', str_repeat('../', $this->_depth), $interfaces[$name]->asPath());
                 $dom_items->appendChild($dom_item);
             }
             $dom_package->appendChild($dom_items);
         }
         $exceptions =& $package->exceptions();
         if ($exceptions) {
             ksort($exceptions);
             $dom_items = $doc->createElement('exceptions');
             foreach ($exceptions as $name => $exception) {
                 $description = NULL;
                 $textTag =& $exceptions[$name]->tags('@text');
                 if ($textTag) {
                     $description = $this->_processInlineTags($textTag);
                 }
                 $dom_item = $doc->createElement('exception', $description);
                 $dom_item->setAttribute('name', $exceptions[$name]->name());
                 $dom_item->setAttribute('path', str_repeat('../', $this->_depth), $exceptions[$name]->asPath());
                 $dom_items->appendChild($dom_item);
             }
             $dom_package->appendChild($dom_items);
         }
         $functions =& $package->functions();
         if ($functions) {
             ksort($functions);
             $dom_items = $doc->createElement('functions');
             foreach ($functions as $name => $function) {
                 $description = NULL;
                 $textTag =& $functions[$name]->tags('@text');
                 if ($textTag) {
                     $description = $this->_processInlineTags($textTag);
                 }
                 $dom_item = $doc->createElement('function', $description);
                 $dom_item->setAttribute('name', $functions[$name]->name());
                 $dom_item->setAttribute('path', str_repeat('../', $this->_depth), $functions[$name]->asPath());
                 $dom_items->appendChild($dom_item);
             }
             $dom_package->appendChild($dom_items);
         }
         $globals =& $package->globals();
         if ($globals) {
             ksort($globals);
             $dom_items = $doc->createElement('globals');
             foreach ($globals as $name => $global) {
                 $description = NULL;
                 $textTag =& $globals[$name]->tags('@text');
                 if ($textTag) {
                     $description = $this->_processInlineTags($textTag);
                 }
                 $dom_item = $doc->createElement('global', $description);
                 $dom_item->setAttribute('name', $globals[$name]->name());
                 $dom_item->setAttribute('path', str_repeat('../', $this->_depth), $globals[$name]->asPath());
                 $dom_items->appendChild($dom_item);
             }
             $dom_package->appendChild($dom_items);
         }
         $dom_packages->appendChild($dom_package);
     }
     $doc->appendChild($dom_packages);
     $this->_output = $doc->saveXML();
     $this->_write('packages.xml', 'Packages', FALSE);
 }
Пример #18
0
 /** Build the element index.
  *
  * @param Doclet doclet
  */
 function indexWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     //$this->_id = 'definition';
     $rootDoc =& $this->_doclet->rootDoc();
     $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
     $this->_sections[1] = array('title' => 'Namespace');
     $this->_sections[2] = array('title' => 'Class');
     //$this->_sections[3] = array('title' => 'Use');
     $this->_sections[4] = array('title' => 'Tree', 'url' => 'overview-tree.html');
     if ($doclet->includeSource()) {
         $this->_sections[5] = array('title' => 'Files', 'url' => 'overview-files.html');
     }
     $this->_sections[6] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
     $this->_sections[7] = array('title' => 'Todo', 'url' => 'todo-list.html');
     $this->_sections[8] = array('title' => 'Index', 'selected' => TRUE);
     $classes =& $rootDoc->classes();
     if ($classes == NULL) {
         $classes = array();
     }
     $methods = array();
     foreach ($classes as $class) {
         foreach ($class->methods(TRUE) as $name => $method) {
             $methods[$class->name() . '::' . $name] = $method;
         }
     }
     if ($methods == NULL) {
         $methods = array();
     }
     $functions =& $rootDoc->functions();
     if ($functions == NULL) {
         $functions = array();
     }
     $globals =& $rootDoc->globals();
     if ($globals == NULL) {
         $globals = array();
     }
     $elements = array_merge($classes, $methods, $functions, $globals);
     uasort($elements, array($this, 'compareElements'));
     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="#letter', chr($letter), '">', chr($letter), "</a>\n";
         }
     }
     echo "<hr>\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="' . $parent->asPath() . '">' . $parent->qualifiedName() . '</a>';
             } else {
                 $package =& $element->containingPackage();
                 $in = 'namespace <a href="' . $package->asPath() . '/package-summary.html">' . $package->name() . '</a>';
             }
             switch (strtolower(get_class($element))) {
                 case 'classdoc':
                     if ($element->isOrdinaryClass()) {
                         echo '<dt><a href="', $element->asPath(), '">', $element->name(), '()</a> - Class in ', $in, "</dt>\n";
                     } elseif ($element->isInterface()) {
                         echo '<dt><a href="', $element->asPath(), '">', $element->name(), '()</a> - Interface in ', $in, "</dt>\n";
                     } elseif ($element->isException()) {
                         echo '<dt><a href="', $element->asPath(), '">', $element->name(), '()</a> - Exception in ', $in, "</dt>\n";
                     }
                     break;
                 case 'methoddoc':
                     if ($element->isMethod()) {
                         echo '<dt><a href="', $element->asPath(), '">', $element->name(), '()</a> - Method in ', $in, "</dt>\n";
                     } elseif ($element->isFunction()) {
                         echo '<dt><a href="', $element->asPath(), '">', $element->name(), '()</a> - Function in ', $in, "</dt>\n";
                     }
                     break;
                 case 'fielddoc':
                     if ($element->isGlobal()) {
                         echo '<dt><a href="', $element->asPath(), '">', $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.html', 'Index', TRUE);
 }
Пример #19
0
 /** Build the class definitons.
  *
  * @param Doclet doclet
  */
 function classWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $this->_id = 'definition';
     $rootDoc =& $this->_doclet->rootDoc();
     $phpdoctor =& $this->_doclet->phpdoctor();
     $packages =& $rootDoc->packages();
     ksort($packages);
     foreach ($packages as $packageName => $package) {
         $this->_sections[0] = array('title' => 'Overview', 'url' => 'overview-summary.html');
         $this->_sections[1] = array('title' => 'Namespace', 'url' => $package->asPath() . '/package-summary.html');
         $this->_sections[2] = array('title' => 'Class', 'selected' => TRUE);
         //$this->_sections[3] = array('title' => 'Use');
         if ($phpdoctor->getOption('tree')) {
             $this->_sections[4] = array('title' => 'Tree', 'url' => $package->asPath() . '/package-tree.html');
         }
         if ($doclet->includeSource()) {
             $this->_sections[5] = array('title' => 'Files', 'url' => 'overview-files.html');
         }
         $this->_sections[6] = array('title' => 'Deprecated', 'url' => 'deprecated-list.html');
         $this->_sections[7] = array('title' => 'Todo', 'url' => 'todo-list.html');
         $this->_sections[8] = array('title' => 'Index', 'url' => 'index-all.html');
         $this->_depth = $package->depth() + 1;
         $classes =& $package->allClasses();
         if ($classes) {
             ksort($classes);
             foreach ($classes as $name => $class) {
                 ob_start();
                 echo "<hr>\n\n";
                 echo '<div class="qualifiedName">', $class->qualifiedName(), "</div>\n";
                 $this->_sourceLocation($class);
                 if ($class->isInterface()) {
                     echo '<h1>Interface ', $class->name(), "</h1>\n\n";
                 } else {
                     echo '<h1>Class ', $class->name(), "</h1>\n\n";
                 }
                 echo '<pre class="tree">';
                 $result = $this->_buildTree($rootDoc, $classes[$name]);
                 echo $result[0];
                 echo "</pre>\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="', str_repeat('../', $this->_depth), $interface->asPath(), '">';
                         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="', str_repeat('../', $this->_depth), $subclass->asPath(), '">';
                         if ($subclass->packageName() != $class->packageName()) {
                             echo $subclass->packageName(), '\\';
                         }
                         echo $subclass->name(), '</a> ';
                     }
                     echo "</dd>\n";
                     echo "</dl>\n\n";
                 }
                 echo "<hr>\n\n";
                 if ($class->isInterface()) {
                     echo '<p class="signature">', $class->modifiers(), ' interface <strong>', $class->name(), '</strong>';
                 } else {
                     echo '<p class="signature">', $class->modifiers(), ' class <strong>', $class->name(), '</strong>';
                 }
                 if ($class->superclass()) {
                     $superclass =& $rootDoc->classNamed($class->superclass());
                     if ($superclass) {
                         echo '<br>extends <a href="', str_repeat('../', $this->_depth), $superclass->asPath(), '">', $superclass->name(), "</a>\n\n";
                     } else {
                         echo '<br>extends ', $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 "<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 '<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 class="type">', $field->modifiers(FALSE), ' ', $field->typeAsString(), "</td>\n";
                         echo '<td class="description">';
                         echo '<p class="name"><a href="#', $field->name(), '">';
                         if (is_null($field->constantValue())) {
                             echo '$';
                         }
                         echo $field->name(), '</a></p>';
                         if ($textTag) {
                             echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><u><em>'), '</p>';
                         }
                         echo "</td>\n";
                         echo "</tr>\n";
                     }
                     echo "</table>\n\n";
                 }
                 if ($fields) {
                     echo '<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 class="type">', $field->modifiers(FALSE), ' ', $field->typeAsString(), "</td>\n";
                         echo '<td class="description">';
                         echo '<p class="name"><a href="#', $field->name(), '">';
                         if (is_null($field->constantValue())) {
                             echo '$';
                         }
                         echo $field->name(), '</a></p>';
                         if ($textTag) {
                             echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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 class="type">', $constructor->modifiers(FALSE), ' ', $constructor->returnTypeAsString(), "</td>\n";
                     echo '<td class="description">';
                     echo '<p class="name"><a href="#', $constructor->name(), '()">', $constructor->name(), '</a>', $constructor->flatSignature(), '</p>';
                     if ($textTag) {
                         echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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 class="type">', $method->modifiers(FALSE), ' ', $method->returnTypeAsString(), "</td>\n";
                         echo '<td class="description">';
                         echo '<p class="name"><a href="#', $method->name(), '()">', $method->name(), '</a>', $method->flatSignature(), '</p>';
                         if ($textTag) {
                             echo '<p class="description">', strip_tags($this->_processInlineTags($textTag, TRUE), '<a><b><strong><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 '<h2 id="detail_field">Constant Detail</h2>', "\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 '<code class="signature">', $field->modifiers(), ' ', $field->typeAsString(), ' <strong>';
                         if (is_null($field->constantValue())) {
                             echo '$';
                         }
                         echo $field->name(), '</strong>';
                         if (!is_null($field->value())) {
                             echo ' = ', htmlspecialchars($field->value());
                         }
                         echo "</code>\n";
                         echo '<div class="details">', "\n";
                         if ($textTag) {
                             echo $this->_processInlineTags($textTag);
                         }
                         $this->_processTags($field->tags());
                         echo "</div>\n\n";
                         echo "<hr>\n\n";
                     }
                 }
                 if ($fields) {
                     echo '<h2 id="detail_field">Field Detail</h2>', "\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 '<code class="signature">', $field->modifiers(), ' ', $field->typeAsString(), ' <strong>';
                         if (is_null($field->constantValue())) {
                             echo '$';
                         }
                         echo $field->name(), '</strong>';
                         if (!is_null($field->value())) {
                             echo ' = ', htmlspecialchars($field->value());
                         }
                         echo "</code>\n";
                         echo '<div class="details">', "\n";
                         if ($textTag) {
                             echo $this->_processInlineTags($textTag);
                         }
                         $this->_processTags($field->tags());
                         echo "</div>\n\n";
                         echo "<hr>\n\n";
                     }
                 }
                 if ($constructor) {
                     echo '<h2 id="detail_method">Constructor Detail</h2>', "\n";
                     $textTag =& $constructor->tags('@text');
                     $this->_sourceLocation($constructor);
                     echo '<h3 id="', $constructor->name(), '()">', $constructor->name(), "</h3>\n";
                     echo '<code class="signature">', $constructor->modifiers(), ' ', $constructor->returnTypeAsString(), ' <strong>';
                     echo $constructor->name(), '</strong>', $constructor->flatSignature();
                     echo "</code>\n";
                     echo '<div class="details">', "\n";
                     if ($textTag) {
                         echo $this->_processInlineTags($textTag);
                     }
                     $this->_processTags($constructor->tags());
                     echo "</div>\n\n";
                     echo "<hr>\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 '<code class="signature">', $method->modifiers(), ' ', $method->returnTypeAsString(), ' <strong>';
                         echo $method->name(), '</strong>', $method->flatSignature();
                         echo "</code>\n";
                         echo '<div class="details">', "\n";
                         if ($textTag) {
                             echo $this->_processInlineTags($textTag);
                         }
                         $this->_processTags($method->tags());
                         echo "</div>\n\n";
                         echo "<hr>\n\n";
                     }
                 }
                 $this->_output = ob_get_contents();
                 ob_end_clean();
                 $this->_write($package->asPath() . '/' . strtolower($class->name()) . '.html', $class->name(), TRUE);
             }
         }
     }
 }
Пример #20
0
 /** Build the function definitons.
  *
  * @param Doclet doclet
  */
 function delegateWriter(&$doclet)
 {
     parent::HTMLWriter($doclet);
     $this->_id = 'definition';
     $rootDoc =& $this->_doclet->rootDoc();
     $phpdoctor =& $this->_doclet->phpdoctor();
     $path = $phpdoctor->_options['source_path'];
     $files = $this->getFiles($path);
     $all_delegates = array();
     ob_start();
     foreach ($files as $file) {
         $source = file_get_contents($file);
         $delegates = array();
         $in_parsed_string = FALSE;
         $counter = 0;
         $lineNumber = 1;
         $commentNumber = 0;
         $tokens = token_get_all($source);
         $numOfTokens = count($tokens);
         for ($key = 0; $key < $numOfTokens; $key++) {
             $token = $tokens[$key];
             if (!$in_parsed_string && is_array($token)) {
                 $lineNumber += substr_count($token[1], "\n");
                 switch ($token[0]) {
                     case T_COMMENT:
                         // read comment
                     // read comment
                     case T_ML_COMMENT:
                         // and multiline comment (deprecated in newer versions)
                     // and multiline comment (deprecated in newer versions)
                     case T_DOC_COMMENT:
                         // and catch PHP5 doc comment token too
                         $comment = $token[1];
                         if (preg_match("/@delegate/", $comment)) {
                             $delegate = (object) array();
                             $delegate->params = array();
                             $tags = $this->processDocComment($comment);
                             foreach ($tags as $tag) {
                                 switch ($tag['type']) {
                                     case 'text':
                                         $delegate->description = $tag['text'];
                                         break;
                                     case '@delegate':
                                         $delegate->name = $tag['text'];
                                         break;
                                     case '@param':
                                         $delegate->params[] = $tag['text'];
                                         break;
                                 }
                             }
                             $delegates[] = $delegate;
                         }
                         break;
                 }
             }
         }
         foreach ($delegates as $delegate) {
             $all_delagates = $delegate;
             //echo $delegate;
             //echo '<br>';
         }
     }
     $this->_output = ob_get_contents();
     ob_end_clean();
     $this->_write('delegates.html', 'Delegates', TRUE);
 }