note 26631 added to index

From: Date: Thu, 07 Nov 2002 16:26:33 +0000
Subject: note 26631 added to index
Groups: php.notes 
Request: Send a blank email to php-notes+get-39095@lists.php.net to get a copy of this message
<?php { /* NoBloatIndex nobloatindex.php enhances your PHP manual by reducing the index to those entries you care about. You just have to provide a file with those headers that you want to have commented out in the manual. You may customize the four variables below $filename should point either to index.html or funcref.html within the PHP manual directory. $filediscard shall contain a list of lines with the function reference headers you don't care about. For example, if you don't care about Informix functions, just add a line with the text: Informix functions $signature is a text string part of the html comment disabling that entry. $nbr_backups is the max number of backups of the file about to be modified. The backup files will be named like the original file with a numerical extension. */ $filename='..\manual\index.html'; $filediscard='discard.txt'; $signature='NoBloat'; $nbr_backups=10; // you may customize the four variables above error_reporting(E_ALL); for($i=0;$i<$nbr_backups;$i++) { $filebak=sprintf($filename.'.%0'. strlen((string)($nbr_backups-1)).'d',$i); if(!file_exists($filebak)) break; } $contents=join('',file($filename)); if(!rename($filename,$filebak)) copy($filename,$filebak); $signature='--'.$signature.'--'; $contents=str_replace(array('<!'.$signature, $signature.'>'),'',$contents); foreach(file($filediscard) as $discard) { $discard=trim($discard); if(strlen($discard)==0) continue; $pattern='@(<DT\s*>[^<>]*<A[^<>]*>[^<>]*'. preg_quote($discard,'@'). '[^<>]*</A\s*></DT\s*>)@sU'; $ra=preg_split($pattern,$contents,-1, PREG_SPLIT_DELIM_CAPTURE); $i=(count($ra)-1)/2; if($i!=1) print("Warning: $i matches found for \"$discard\"\n"); $contents=array_shift($ra); for(;$i>0;$i--) $contents.='<!'.$signature. array_shift($ra).$signature.'>'.array_shift($ra); } // end foreach $fh=@fopen($filename,'wb'); if($fh) { fwrite($fh,$contents); fclose($fh); } } ?> -- http://www.php.net/manual/en/index.php http://master.php.net/manage/user-notes.php?action=edit+26631 http://master.php.net/manage/user-notes.php?action=delete+26631 http://master.php.net/manage/user-notes.php?action=reject+26631

« previous php.notes (#39095) next »