| 3 | | if ( ! function_exists('kodoc_html')): |
| 4 | | |
| 5 | | function kodoc_html($comment) |
| 6 | | { |
| 7 | | // Create anchors |
| 8 | | $comment = preg_replace_callback('/<([^ ]+) ?([^>]+)?>/', 'kodoc_html_anchor', $comment); |
| 9 | | |
| 10 | | // Break out the comment |
| 11 | | $comment = explode("\n", $comment); |
| 12 | | |
| 13 | | foreach($comment as $key => $line) |
| 14 | | { |
| 15 | | if (strpos($line, '-') === FALSE) |
| 16 | | continue; |
| 17 | | |
| 18 | | // Definition lists |
| 19 | | if (preg_match('/([a-z_]+)\s+\-\s+(.+)/', trim($line), $matches)) |
| 20 | | { |
| 21 | | // Add a definition list item |
| 22 | | $comment[$key] = |
| 23 | | '<dt>'.$matches[1].'</dt>'."\n". |
| 24 | | '<dd>'.$matches[2].'</dd>'."\n"; |
| 25 | | |
| 26 | | if (isset($end)) |
| 27 | | { |
| 28 | | if ($line === $end) |
| 29 | | { |
| 30 | | // End the DL |
| 31 | | $comment[$key] .= '</dl>'."\n"; |
| 32 | | |
| 33 | | // Clear the list |
| 34 | | unset($end); |
| 35 | | } |
| 36 | | } |
| 37 | | else |
| 38 | | { |
| 39 | | // Start the comment |
| 40 | | $comment[$key] = '<dl>'."\n".$comment[$key]; |
| 41 | | |
| 42 | | // End of list |
| 43 | | $end = ''; |
| 44 | | } |
| 45 | | } |
| 46 | | else |
| 47 | | { |
| 48 | | if ( ! isset($paragraph)) |
| 49 | | { |
| 50 | | // Start a paragraph |
| 51 | | $paragraph = '<p>'; |
| 52 | | |
| 53 | | // End of paragraph |
| 54 | | $end = ''; |
| 55 | | } |
| 56 | | |
| 57 | | if ($line === $end) |
| 58 | | { |
| 59 | | // Set the paragraph |
| 60 | | $comment[$key] = $paragraph.'</p>'."\n"; |
| 61 | | |
| 62 | | // Clear the paragraph |
| 63 | | unset($paragraph); |
| 64 | | |
| 65 | | continue; |
| 66 | | } |
| 67 | | |
| 68 | | // Add the line to the paragraph |
| 69 | | $paragraph .= $line.' '; |
| 70 | | |
| 71 | | // Remove the comment |
| 72 | | unset($comment[$key]); |
| 73 | | } |
| 74 | | } |
| 75 | | |
| 76 | | // Re-form the comment |
| 77 | | $comment = implode("\n", $comment); |
| 78 | | |
| 79 | | // Copyright symbols |
| 80 | | $comment = str_replace('(c)', '©', $comment); |
| 81 | | |
| 82 | | return $comment; |
| 83 | | } |
| 84 | | |
| 85 | | function kodoc_html_anchor($matches) |
| 86 | | { |
| 87 | | if (strpos($matches[1], '://') === FALSE) |
| 88 | | { |
| 89 | | // Add HTTP protocol |
| 90 | | $matches[1] = 'http://'.$matches[1]; |
| 91 | | } |
| 92 | | |
| 93 | | if (empty($matches[2])) |
| 94 | | { |
| 95 | | // No title |
| 96 | | return html::anchor($matches[1]); |
| 97 | | } |
| 98 | | else |
| 99 | | { |
| 100 | | // With title |
| 101 | | return html::anchor($matches[1], $matches[2]); |
| 102 | | } |
| 103 | | } |
| 104 | | |
| 105 | | endif; |
| 130 | | if ( ! empty($class['comment']['license'])): |
| 131 | | |
| 132 | | echo kodoc_html($docs['comment']['license']); |
| 133 | | |
| 134 | | endif; |
| 135 | | if ( ! empty($class['comment']['about'])): |
| 136 | | |
| 137 | | echo kodoc_html($docs['comment']['about']); |
| 138 | | |
| 139 | | endif; |
| 140 | | foreach ($class['methods'] as $method): |
| 141 | | $sigil = ' '.(($method['static'] == TRUE) ? '::' : '->').' '; |
| 142 | | |
| 143 | | ?> |
| 144 | | <div class="method"> |
| 145 | | <h4><span class="visibility"><?php echo $method['visibility'] ?></span> <?php echo $class['name'].$sigil.$method['name'] ?></h4> |
| 146 | | <div class="method"><?php echo Kohana::debug($method['about']) ?></div> |
| 147 | | <?php |
| 148 | | |
| 149 | | if ($method['final']): |
| 150 | | |
| 151 | | ?> |
| 152 | | <p class="note">This method is <tt>final</tt> and cannot be extended.</p> |
| 153 | | <?php |
| | 27 | echo $comment['about']; |