5 return sprintf("<blockquote>%s</blockquote>\n", highlight_string($m[1], true));
10 '/\/\* *\{\{\{ *proto (.*?)(\n|$)(.*?)PHP_(?:FUNCTION|METHOD)\((.*?)\)/s',
11 file_get_contents($f), $m);
15 $t = preg_replace('/^ \* /m', '', trim($t, "*/ \n"));
16 $t = preg_replace_callback('/(\<\?php.*?\?\>)/s', 'hl', $t);
17 $t = nl2br(preg_replace('/\n *\* */', "\n", $t));
18 $t = preg_replace('/(\<br \/\>\n)+\<pre\>(\<br \/\>\n)+/', '</p><pre>', $t);
19 $t = preg_replace('/(\<br \/\>\n)+\<\/pre\>(\<br \/\>\n)+/', '</pre><p>', $t);
20 return sprintf('<p>%s</p>', ltrim($t, ' *'));
25 array_unshift($a, STDERR
);
26 call_user_func_array('fprintf', $a);
29 $preface = <<<_PREFACE
32 <title>Function Summary of ext/%s</title>
36 font-family: sans-serif;
63 border: 1px solid #ccc;
81 <p><b>Generated at: %s</b></p>
87 if ($_SERVER['argc'] < 2) {
88 die("Usage: {$_SERVER['argv'][0]} <file>[ <file> ...]\n");
91 printf($preface, basename(getcwd()));
93 foreach (array_slice($_SERVER['argv'], 1) as $fp) {
94 foreach (glob($fp) as $f) {
97 e("\nAnalyzing %s\n", basename($f));
98 printf("<h1>%s</h1>\n", basename($f));
99 foreach ($m[1] as $i => $p) {
100 e("Documenting $p\n");
101 if ($o = preg_match('/^(.*), (.*)$/', $m[4][$i], $n)) {
102 if ($n[2] == '__construct') {
103 printf("<h2 id=\"%s\" class=\"o\">%s</h2>\n", $n[1], $n[1]);
106 printf("<h%d id=\"%s\">%s</h%d>\n%s\n",
107 $o?3:2, $o?$n[1].'_'.$n[2]:$m[4][$i], $p, $o?3:2, ff($m[3][$i]));
109 print "<hr noshade>\n";
114 printf($footer, date('r'));