| 7 | | if (strtolower($name) != 'class'): |
| | 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; |
| | 106 | if (empty($this->kodoc) OR count($docs = $this->kodoc->get()) < 1): |
| 19 | | if (isset($data['methods'])): |
| 20 | | foreach($data['methods'] as $name => $method): |
| 21 | | if (isset($method['html'])): |
| 22 | | echo $parser->set('title', $name)->set('html', $method['html'])->set('h', '6')->render(); |
| 23 | | endif; |
| 24 | | endforeach; |
| 25 | | endif; |
| 26 | | |
| 27 | | return; |
| | 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 |
| | 154 | |
| | 155 | endif; |
| | 156 | if ($method['abstract']): |
| | 157 | |
| | 158 | ?> |
| | 159 | <p class="note">This method is <tt>abstract</tt> and must be implemented in extended classes.</p> |
| | 160 | <?php |
| | 161 | |
| | 162 | endif; |
| | 163 | |
| | 164 | ?> |
| | 165 | </div> |
| | 166 | <?php |
| | 167 | |
| | 168 | endforeach; |