Test against converted UTF8 no BOM content

Convert content to UTF8 with no BOM before testing matches against it
This commit is contained in:
Matt Pass
2013-05-22 13:00:19 +01:00
parent 3710fa9e79
commit fabfcbd742

View File

@@ -121,7 +121,7 @@ if (startTab!=top.ICEcoder.selectedTab) {
$fullPath = $path.$slash.$f;
if(is_dir($fullPath)) {
$ret .= phpGrep($q, $fullPath, $base);
} else if(stristr(file_get_contents($fullPath), $q)) {
} else if(stristr(toUTF8noBOM(file_get_contents($fullPath),false), $q)) {
$bFile = false;
$foundInSelFile = false;
for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) {
@@ -136,7 +136,7 @@ if (startTab!=top.ICEcoder.selectedTab) {
}
if (!$bFile && (count($selectedFiles)==0 || count($selectedFiles)>0 && $foundInSelFile)) {
$ret .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'))\\\">";
$ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">Found ".substr_count(strtolower(file_get_contents($fullPath)),$q)." times</div>";
$ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">Found ".substr_count(strtolower(toUTF8noBOM(file_get_contents($fullPath),false)),$q)." times</div>";
if (isset($_GET['replace'])) {
$ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle('".$fullPath."');this.style.display=\'none\'\\\">replace</div>";
};