function format_debugger_doc($doc) { $doc = preg_replace('/</', '<', $doc); $doc = preg_replace('/ *(?:\\xe2\\x94\\x80|\\-){5,}(.*) ' . '(?:\\xe2\\x94\\x80|\\-){5,}/', '<h2>$1</h2>', $doc); $doc = preg_replace("/('\\[.*?')/", '<b>$1</b>', $doc); $doc = preg_replace("/(\\{.*?\\})/", '<i>$1</i>', $doc); return format_document($doc); }
$css = 'style'; // default if (isset($_GET['css'])) { $css = $_GET['css']; } echo "<link type='text/css' rel='stylesheet' href='{$css}.css' />"; $file = 'coding_guideline'; if (isset($_GET['file'])) { $file = $_GET['file']; } $doc = file_get_contents(realpath(dirname(__FILE__)) . "/{$file}"); echo '<table cellpadding=0 cellspacing=0 border=0 bgcolor="#3B5998">'; echo '<tr><td valign=top width=200>'; echo format_index($file); echo '</td><td valign=top bgcolor=white width=640>'; echo format_document($doc); echo '</td></tr></table>'; /////////////////////////////////////////////////////////////////////////////// // helpers function format_index($file) { $files = array(); exec('ls ' . realpath(dirname(__FILE__)), $files); echo '<table cellpadding=4 cellspacing=4 border=0>'; echo '<tr><td class="hphp">HipHop</td></tr>'; echo '<tr><td> </td></tr>'; foreach ($files as $f) { if (preg_match('/(~|Makefile|index\\.php|style\\.css|www\\.pid)/', $f)) { continue; } echo '<tr><td>';