cvs: phpweb / quickref.php

From: Date: Wed, 19 Mar 2008 12:20:52 +0000
Subject: cvs: phpweb / quickref.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-1320@lists.php.net to get a copy of this message
bjori Wed Mar 19 12:20:52 2008 UTC Modified files: /phpweb quickref.php Log: Fixed bug#44054 (partial function name search returns incomplete result) http://cvs.php.net/viewvc.cgi/phpweb/quickref.php?r1=1.35&r2=1.36&diff_format=u Index: phpweb/quickref.php diff -u phpweb/quickref.php:1.35 phpweb/quickref.php:1.36 --- phpweb/quickref.php:1.35 Tue Aug 3 21:14:05 2004 +++ phpweb/quickref.php Wed Mar 19 12:20:52 2008 @@ -1,6 +1,6 @@ <?php -// $Id: quickref.php,v 1.35 2004/08/03 21:14:05 goba Exp $ +// $Id: quickref.php,v 1.36 2008/03/19 12:20:52 bjori Exp $ /* @@ -31,7 +31,7 @@ // Print out the table of found (or all) functions. The HTML comments are // needed to support MyCroft search (Mozilla browser family and Sherlock for MacOSX) -function quickref_table($functions) +function quickref_table($functions, $sort = true) { global $LANG; @@ -42,7 +42,9 @@ // Prepare the data $i = 0; $limit = ceil(count($functions) / COLUMNS); - asort($functions); + if ($sort) { + asort($functions); + } // Print out all rows foreach ($functions as $file => $name) { @@ -82,6 +84,12 @@ // Compute similarity of the name to the requested one if (function_exists('similar_text') && !empty($notfound)) { similar_text($funcname, $notfound, $p); + + // If $notfound is a substring of $funcname then overwrite the score + // similar_text() gave it. + if ($p < 70 && ($pos = strpos($funcname, $notfound)) !== FALSE) { + $p = 90 - $pos; + } $temp[$entry] = $p; } } @@ -133,7 +141,7 @@ (really good matches are in bold). Perhaps you were looking for one of these: </p> -<?php quickref_table($maybe); ?> +<?php quickref_table($maybe, false); ?> <p> If you want to search the entire PHP website for the string

« previous php.webmaster (#1320) next »