diff --git a/quickref.php b/quickref.php
index aef6a98a6..12181352a 100644
--- a/quickref.php
+++ b/quickref.php
@@ -1,110 +1,148 @@
';
- echo '
| ';
- $i = 0;
- $limit = ceil(count($array)/$NUMACROSS);
- asort($array);
- while (list($file,$name)=each($array)) {
- if ($i>0 && $i%$limit==0) {
- echo " | \n";
- }
- echo "".$name." \n";
- $i++;
- }
- echo ' |
';
+// Constant values for the display
+define("COLUMNS", 3);
+define("SHOW_CLOSE", 20);
+
+// Print out the table of found (or all) functions
+function quickref_table($functions)
+{
+ global $LANG;
+
+ echo '';
+ echo '| ';
+
+ // Prepare the data
+ $i = 0;
+ $limit = ceil(count($functions) / COLUMNS);
+ asort($functions);
+
+ // Print out all rows
+ foreach ($functions as $file => $name) {
+
+ // Start a new column
+ if ($i > 0 && $i % $limit==0) {
+ echo " | \n";
+ }
+ echo "$name \n";
+ $i++;
+ }
+ echo ' |
';
}
-$d = dir("$DOCUMENT_ROOT/manual/en");
-$functions = $maybe = $temp = array();
+$dirh = opendir($_SERVER['DOCUMENT_ROOT'] . "/manual/$LANG");
+$functions = $maybe = $temp = $parts = array();
$p = 0;
-while ( $entry=$d->read() ) {
- if (substr($entry, 0, 1) == ".") {
- continue;
- }
- if (ereg('(function|class)\.(.+)\.php',$entry,$x)) {
- $funcname = str_replace('-', '_', $x[2]);
- $functions[$entry] = $funcname;
+// Get all file names from the directory
+while (($entry = readdir($dirh)) !== FALSE) {
+
+ // Skip names starting with a dot
+ if (substr($entry, 0, 1) == ".") { continue; }
+
+ // For function and class pages, get the name out
+ if (preg_match('!(function|class)\.(.+)\.php!', $entry, $parts)) {
+ $funcname = str_replace('-', '_', $parts[2]);
+ $functions[$entry] = $funcname;
- if (function_exists('similar_text') && $notfound) {
- similar_text($funcname, $notfound, $p);
- $temp[$entry] = $p;
- }
-
- }
+ // Compute similarity of the name to the requested one
+ if (function_exists('similar_text') && $notfound) {
+ similar_text($funcname, $notfound, $p);
+ $temp[$entry] = $p;
+ }
+ }
}
-$d->close();
-arsort($temp);
+closedir($dirh);
-$i = 0;
-while (list($file,$p)=each($temp)) {
- $funcname = $functions[$file];
- $maybe[$file] = $funcname;
- if ($p>=70 || stristr($funcname,$notfound)) {
- $maybe[$file] = '' . $functions[$file] . '';
- }
- if ($i++ > $SHOW_CLOSE) {
- break;
- }
+// We have found file names
+if (count($temp) > 0) {
+
+ // Sort names by percentage
+ arsort($temp);
+
+ // Collect SHOW_CLOSE number of names from the top
+ foreach ($temp as $file => $p) {
+
+ // Stop, if we found enough matches
+ if (count($maybe) >= SHOW_CLOSE) { break; }
+
+ // If the two are more then 70% similar or $notfound is a substring
+ // of $funcname, then the match is a very similar one
+ if ($p >= 70 || (strpos($functions[$file], $notfound) !== FALSE)) {
+ $maybe[$file] = '' . $functions[$file] . '';
+ }
+ // Otherwise it is just similar
+ else {
+ $maybe[$file] = $functions[$file];
+ }
+ }
+ unset($matches, $temp);
}
-
-commonHeader("PHP Manual Quick Reference");
+commonHeader("Manual Quick Reference");
?>
PHP Function List
-
+ 0) { ?>
-Sorry, but the function 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
- functions which seem to be closest in spelling
-to (really good matches are in bold). Perhaps
-you were looking for one of these:
+ Sorry, but the function
+ 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 functions which seem to be
+ closest in spelling to
+ (really good matches are in bold). Perhaps you were looking for one of these:
-
+
-If you want to search the entire PHP website for the string
-"", then
-.
+ If you want to search the entire PHP website for the string
+ "", then
+.
-For a quick overview over all PHP functions,
-.
+ For a quick overview over all documented PHP functions,
+ .
-Here is a list of all the PHP functions. Click on any one of them to
-jump to that page in the manual.
+ Here is a list of all the documented PHP functions.
+ Click on any one of them to jump to that page in the
+ manual.
-
-
-
-
-
-
+
\ No newline at end of file