Source of: /quickref.php
<?php
$_SERVER['BASE_PAGE'] = 'quickref.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/errors.inc';
define("COLUMNS", 3);
define("SHOW_CLOSE", 20);
if (!isset($notfound)) {
$notfound = '';
}
function quickref_table($functions, $sort = true)
{
global $LANG;
echo "<!-- result list start -->\n";
echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr valign=\"top\"><td>\n";
$i = 0;
$limit = ceil(count($functions) / COLUMNS);
if ($sort) {
asort($functions);
}
foreach ($functions as $file => $name) {
if ($i > 0 && $i % $limit==0) {
echo "</td><td>\n";
}
echo "<a href=\"/manual/$LANG/$file\">$name</a><br />\n";
$i++;
}
echo "</td></tr></table>\n";
echo "<!-- result list end -->\n";
}
$dirh = @opendir($_SERVER['DOCUMENT_ROOT'] . "/manual/$LANG");
if (!$dirh) {
error_noservice();
}
$functions = $maybe = $temp = $parts = array();
$p = 0;
while (($entry = readdir($dirh)) !== FALSE) {
if (substr($entry, 0, 1) == ".") { continue; }
if (preg_match('!(function|class)\.(.+)\.php!', $entry, $parts)) {
$funcname = str_replace('-', '_', $parts[2]);
$functions[$entry] = $funcname;
if (function_exists('similar_text') && !empty($notfound)) {
similar_text($funcname, $notfound, $p);
if ($p < 70 && ($pos = strpos($funcname, $notfound)) !== FALSE) {
$p = 90 - $pos;
}
$temp[$entry] = $p;
}
}
}
closedir($dirh);
if (count($temp) > 0) {
arsort($temp);
foreach ($temp as $file => $p) {
if (count($maybe) >= SHOW_CLOSE) { break; }
if ($p >= 70 || (strpos($functions[$file], $notfound) !== FALSE)) {
$maybe[$file] = '<b>' . $functions[$file] . '</b>';
}
else {
$maybe[$file] = $functions[$file];
}
}
unset($matches, $temp);
}
if (count($maybe) > 0) { $head_options = array("noindex"); }
else { $head_options = array(); }
site_header("Manual Quick Reference", $head_options);
?>
<h1>PHP Function List</h1>
<?php if (!empty($notfound) && count($maybe) > 0) { ?>
<p>
Sorry, but the function <b><?php echo htmlspecialchars($notfound); ?></b>
is not in the online manual. Perhaps you misspelled it, or it is a relatively
new function that hasn't made it into the online documentation yet. The
following are the <?php echo count($maybe); ?> functions which seem to be
closest in spelling to <b><?php echo htmlspecialchars($notfound); ?></b>
(really good matches are in bold). Perhaps you were looking for one of these:
</p>
<?php quickref_table($maybe, false); ?>
<p>
If you want to search the entire PHP website for the string
"<b><?php echo htmlspecialchars($notfound); ?></b>", then
<?php
print_link('search.php?show=wholesite&pattern=' .
urlencode(htmlspecialchars($notfound)),
'click here');
?>.
</p>
<p>
For a quick overview over all documented PHP functions,
<?php print_link('quickref.php', 'click here'); ?>.
</p>
<?php
site_footer();
exit;
}
?>
<p>
Here is a list of all the documented PHP functions.
Click on any one of them to jump to that page in the
manual.
</p>
<?php
quickref_table($functions);
site_footer();
?>