Our source is open
The syntax highlighted source is automatically generated by PHP from
the plaintext script.
If you're interested in what's behind the several functions we
used, you can always take a look at the source of the following files:
Of course, if you want to see the source
of this page, we have it available.
You can also browse the SVN repository for this website on
svn.php.net.
Source of: /reST/index.php
<?php
$_SERVER['BASE_PAGE'] = 'reST/index.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$rest_dir = $_SERVER['DOCUMENT_ROOT'].'/reST/cache/';
$path = isset($_GET['rel_path']) ? $_GET['rel_path'] : "";
$PGI["this"] = array("reST/" . ($path ? $path : "index.php"), "");
$_SERVER['BASE_HREF'] = $MYSITE . $_SERVER['BASE_PAGE'];
$SIDEBAR_DATA = '<h3>File list</h3>
<ul class="simple" id="reSTlist">';
$restfiles = glob($rest_dir. "/*");
$list = $lastdir = "";
foreach($restfiles as $filename) {
$link = basename($filename, ".rest");
list($dir, $filename) = explode("_", $link, 2);
if ($dir != $lastdir) {
if ($lastdir) {
$list .= "</ul>\n";
}
$list .= "<li><h4>$dir</h4><li>\n<ul class=\"simple\">\n";
$lastdir = $dir;
}
$link[strpos($link, "_")] = "/";
if (strpos($filename, ".") !== false) {
$filename = substr($filename, strpos($filename, ".")+1);
}
$filename = str_replace(array("-", "_"), " ", $filename);
$list .= '<li><a href="/reST/' .$link.'">'.$filename.'</a></li>'."\n";
}
if ($list) {
$SIDEBAR_DATA .= "$list</ul>";
} else {
$SIDEBAR_DATA .= "<li>No files available</li>";
}
$SIDEBAR_DATA .= "</ul>";
$filename = $rest_dir. "/" .str_replace('/', '_', $path).'.rest';
if (($k = array_search($filename, $restfiles)) === false) {
site_header("reST");
if($path) {
echo '<p class="warn">Unknown file</p>';
}
echo "<p>Please select a file from the filelist on the left</p>";
} else {
site_header(basename($path));
include $restfiles[$k];
manual_notes();
}
site_footer();