"; //do it! $fArray = scandir($dir); if ($fArray === false) { exit("unable to open directory $dir"); } //run from lang/ directory foreach ($fArray as $fileName) { if (!preg_match("%^(ai-|ug-|ui-)\w+\.php$%i",$fileName)) { continue; } //language files only if ($f == 'list') { echo '- '.$fileName.'
'; } else { $string = file_get_contents($dir.$fileName); $files++; if(substr($string,0,3) == pack('CCC',0xef,0xbb,0xbf)) { //hex representation of BOM file_put_contents($dir.$fileName,substr($string,3)); //remove BOM $boms++; } } } if ($f != 'list') { //display results if ($files) { echo "Number of files processed: ".$files."
Number of BOMs removed: ".$boms; } else { echo "No language files found."; } } else { echo "
End of list."; } } else { if (file_exists($f)) { header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=$f"); readfile($f); //send dl } else { echo "File ".$f." not present"; } } ?>