Example #1
0
///////////////////////////////////////////////////////////////////////////////
// main
$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>';
echo '<tr><td valign=top width=200>';
echo format_index($file);
echo '</td><td valign=top bgcolor=white width=640>';
if (preg_match('/^debugger\\./', $file)) {
    echo format_debugger_doc($doc);
} else {
    echo format_document($doc);
}
echo '</td></tr></table>';
///////////////////////////////////////////////////////////////////////////////
// helpers
function format_index($file)
{
    global $topics;
    $found_files = array();
    exec('find . -type f', $found_files);
    $files = array();
Example #2
0
<?php

$topics = array('Compiler' => array('Command line options' => 'command.compiler', 'Configurable options' => 'options.compiler'), 'Compiled Program' => array('Command line options' => 'command.compiled', 'Configurable options' => 'options.compiled', 'Administrative commands' => 'command.admin_server', 'Server Status' => 'server.status', 'Server Statistics' => 'server.stats'), 'Debugger' => array('Getting Started' => 'debugger.start', 'All Commands' => 'debugger.cmds', 'Command A-Z' => 'debugger.refs'), 'HTTP Server' => array('Rewrite Rules' => 'server.rewrite_rules', 'SSL Setup' => 'server.ssl'), 'Inconsistencies' => array('PHP vs. HipHop' => 'inconsistencies', 'HipHop Compiler vs. Interpreter' => 'inconsistencies.hphpi'), 'New Features' => array('New functions' => 'extension.new_functions', 'yield and generator' => 'extension.yield', 'Richer type hints' => 'extension.type_hints', 'Parallel execution' => 'threading', 'Server documents' => 'server.documents', 'RPC server' => 'server.rpc_server', 'Xbox server' => 'server.xbox_server', 'Dangling server' => 'server.dangling_server'), 'Foreign Function Interfaces' => array('C++' => 'ffi.c++', 'Java' => 'ffi.java', 'Python' => 'ffi.python'), 'Debugging' => array('Server' => 'debug.server', 'CPU Profiling' => 'debug.profile', 'Memory leak detection' => 'debug.leak', 'Mutex contention' => 'debug.mutex', 'Useful gdb commands' => 'debug.gdb', 'Useful Linux commands' => 'debug.linux'), 'Development' => array('Coding guidelines' => 'coding_guideline', 'Type system' => 'runtime.type_system', 'Memory model' => 'runtime.memory_model', 'Writing new extensions' => 'extension.development', 'Useful commands' => 'command.project'), 'References' => array('Configuration file format' => 'hdf'));
///////////////////////////////////////////////////////////////////////////////
// main
echo "<link type='text/css' rel='stylesheet' href='style.css' />";
$file = 'coding_guideline';
if (isset($_GET['file'])) {
    $file = $_GET['file'];
}
$title = find_topics($topics, $file);
echo '<title>' . htmlspecialchars($title ? $title : 'Invalid topic') . '</title>';
echo '<table cellpadding=0 cellspacing=0 border=0>';
echo '<tr><td valign=top width=200>';
format_index($topics, $file);
echo '</td><td valign=top bgcolor=white width=640>';
if (!$title) {
    echo 'Topic does not exist.';
} else {
    $doc = file_get_contents(realpath(dirname(__FILE__)) . "/{$file}");
    if (preg_match('/^debugger\\./', $file)) {
        echo format_debugger_doc($doc);
    } else {
        echo format_document($doc);
    }
}
echo '</td></tr></table>';
///////////////////////////////////////////////////////////////////////////////
// helpers
function find_topics(&$topics, $file)
{