cvs: phpweb / quickref.php

From: Date: Wed, 14 Mar 2001 17:17:30 +0000
Subject: cvs: phpweb / quickref.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-4465@lists.php.net to get a copy of this message
cmv Wed Mar 14 09:17:30 2001 EDT Modified files: /phpweb quickref.php Log: make the quickref more useful ... Index: phpweb/quickref.php diff -u phpweb/quickref.php:1.6 phpweb/quickref.php:1.7 --- phpweb/quickref.php:1.6 Thu Mar 8 14:28:10 2001 +++ phpweb/quickref.php Wed Mar 14 09:17:29 2001 @@ -2,37 +2,62 @@ require_once 'prepend.inc'; $NUMACROSS=2; +$SHOW_CLOSE=10; + +function makeTable($array) { + global $NUMACROSS; + + echo '<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0" WIDTH="580">'; + echo '<TR VALIGN="top"><TD WIDTH="50%">'; + $i=0; + $limit = ceil(count($array)/$NUMACROSS); + asort($array); + while (list($file,$name)=each($array)) { + if ($i>0 && $i%$limit==0) { + echo "</TD><TD WIDTH=\"50%\">\n"; + } + echo "<A HREF=\"/manual/".$file."\">".$name."</A><BR>\n"; + $i++; + } + echo '</TD></TR></TABLE>'; +} + + + $d = dir("$DOCUMENT_ROOT/manual/en"); +$functions = $maybe = $temp = 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; + + if (function_exists('similar_text') && $notfound) { + similar_text($funcname, $notfound, &$p); + $temp[$entry] = $p; + } + } - if (ereg('(function|class)\.(.+)\.php',$entry,$x)): - $functions[$entry]=ereg_replace("-","_",$x[2]); - endif; } $d->close(); -asort($functions); +arsort($temp); -function makeTable($array) { - global $NUMACROSS,$FONTFACE; - $i=0; - $c=count($array); - $limit=intval($c/$NUMACROSS)+1; - echo "<TABLE BORDER=\"0\" CELLPADDING=\"5\" CELLSPACING=\"0\">\n"; - echo "<TR VALIGN=\"top\">\n"; - echo "<TD>\n"; - while (list($file,$name)=each($array)): - if ($i%$limit==0): - echo "</TD><TD>\n"; - endif; - echo "<A HREF=\"/manual/".$file."\">".$name."</A><BR>\n"; - $i++; - endwhile; - echo "</TD>\n"; - echo "</TR>\n"; - echo "</TABLE>\n"; -}; +$i = 0; +while (list($file,$p)=each($temp)) { + $funcname = $functions[$file]; + $maybe[$file] = $funcname; + if ($p>=70 || stristr($funcname,$notfound)) { + $maybe[$file] = '<b>' . $functions[$file] . '</b>'; + } + if ($i++ > $SHOW_CLOSE) { + break; + } +} + commonHeader("PHP Manual Quick Reference"); ?> @@ -44,18 +69,27 @@ <P> Sorry, but the function <B><? echo $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. +into the online documentation yet. The following are the <? echo $SHOW_CLOSE;?> +functions which seem to be closest in spelling to <B><? echo $notfound;?></B> (really +good matches are in bold). Perhaps you were looking for one of these: </P> + +<? makeTable($maybe); ?> + <P> -If you want to search the entire PHP website for <B><? echo $notfound; ?></B>, then -<? print_link('search.php?show=nosource&pattern='.urlencode($notfound), 'click here'); ?>. +If you want to search the entire PHP website for the string &quot;<B><? echo $notfound; ?></B>&quot;, +then <? print_link('search.php?show=nosource&pattern='.urlencode($notfound), 'click here'); ?>. <? } ?> <P> Here is a list of all the PHP functions. Click on any one of them to jump to that page in the manual. </P> +<? makeTable($functions); ?> + +</TD></TR> +</TABLE> + <? -makeTable($functions); -commonFooter(); +commonFooter(); ?>

« previous php.mirrors (#4465) next »