| +----------------------------------------------------------------------+ | Small hack to generate the manual for the web | +----------------------------------------------------------------------+ $Id$ */ ini_set('pcre.backtrack_limit', 150000); // Default is 100000, available since PHP 5.2.0 set_time_limit(0); $search = array( '/(]+>)/mSs', '/(<\/BODY\s*><\/HTML\s*>)/mS' ); $replace = array( '\1', '";} ?>' ); if ($dir = opendir('phpweb')) { echo "Processing the manual...\n"; while (false !== ($file = readdir($dir))) { if(substr($file, -4) == '.php') { $text = file_get_contents('phpweb/' . $file); $text = preg_replace($search, $replace, $text); $handler = fopen('phpweb/' . $file, 'w+'); fputs($handler, $text); fclose($handler); } } closedir($dir); } else { die('Could not open the specified dir!'); } ?>