Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 94438fa

Browse files
author
mattpass
committed
Skip dirs in multiple results, close dir handle when done
1 parent ae008e5 commit 94438fa

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/multiple-results.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
const spansArray = parent.ICEcoder.filesFrame.contentWindow.document.getElementsByTagName('span');
9393
for (let i = 0; i < spansArray.length; i++) {
9494
let foundInSelected = false;
95+
const targetURLElem = spansArray[i];
9596
const targetURL = spansArray[i].id.replace(/\|/g, "/").toLowerCase();
9697
const targetURLDisplay = spansArray[i].id.replace(/\|/g, "/"); // Original filename incl casing
9798
const targetName = targetURL.substring(targetURL.lastIndexOf("/") + 1);
@@ -118,6 +119,10 @@
118119
}
119120
}
120121
if (-1 < userTarget.indexOf("all") || (-1 < userTarget.indexOf("selected") && foundInSelected)) {
122+
// Skip displaying directories
123+
if (-1 < targetURLElem.parentNode.parentNode.className.indexOf('pft-directory')) {
124+
continue;
125+
}
121126
resultsDisplay +=
122127
'<a href="javascript:parent.ICEcoder.openFile(\'<?php echo $docRoot;?>' +
123128
targetURLDisplay.replace(/\|/g, "/").replace(/_perms/g,"") +
@@ -165,15 +170,15 @@ function phpGrep($q, $path, $base) {
165170
} else if(stristr(toUTF8noBOM(getData($fullPath), false), $q)) {
166171
$bFile = false;
167172
$foundInSelFile = false;
168-
// Exclude banned files
173+
// Exclude banned dirs/files (string in path name)
169174
for ($i = 0; $i < count($ICEcoder['bannedFiles']); $i++) {
170-
if (false !== strpos($f, str_replace("*", "", $ICEcoder['bannedFiles'][$i]))) {
175+
if (false !== strpos($fullPath, str_replace("*", "", $ICEcoder['bannedFiles'][$i]))) {
171176
$bFile = true;
172177
};
173178
}
174-
// Exclude the dirs & files we wish to exclude from find & replace tasks
179+
// Exclude the dirs/files we wish to exclude from find & replace tasks (string in path name)
175180
for ($i = 0; $i < count($ICEcoder['findFilesExclude']); $i++) {
176-
if (false !== strpos($f, str_replace("*", "", $ICEcoder['findFilesExclude'][$i]))) {
181+
if (false !== strpos($fullpath, str_replace("*", "", $ICEcoder['findFilesExclude'][$i]))) {
177182
$bFile = true;
178183
};
179184
}
@@ -203,6 +208,7 @@ function phpGrep($q, $path, $base) {
203208
}
204209
}
205210
}
211+
closedir($fp);
206212
return $ret;
207213
}
208214

0 commit comments

Comments
 (0)