Пример #1
0
function format_debugger_doc($doc)
{
    $doc = preg_replace('/</', '&lt;', $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);
}
Пример #2
0
$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>&nbsp;</td></tr>';
    foreach ($files as $f) {
        if (preg_match('/(~|Makefile|index\\.php|style\\.css|www\\.pid)/', $f)) {
            continue;
        }
        echo '<tr><td>';