From f03cfcb0e3981e16dc8c2beeff50cb685402809a Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sun, 24 Feb 2013 13:43:04 +0000 Subject: [PATCH] Only create full tree if treeType is 'full' No need to do any of this if not, so wrapped in an if condition to exclude otherwise --- files.php | 73 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/files.php b/files.php index 6dbb5a7..3f4180a 100644 --- a/files.php +++ b/files.php @@ -48,46 +48,49 @@ class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator { } } -// Get a full list of dirs & files and begin sorting using above class & function -$objectList = new SortingIterator(new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($docRoot.$iceRoot), RecursiveIteratorIterator::SELF_FIRST), 'alphasort'); +if ($ICEcoder['treeType']=="full") { -// With that done, create arrays for out final ordered list and a temp container of files -$finalArray = $tempArray = array(); + // Get a full list of dirs & files and begin sorting using above class & function + $objectList = new SortingIterator(new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($docRoot.$iceRoot), RecursiveIteratorIterator::SELF_FIRST), 'alphasort'); -// To start, push folders from object into finalArray, files into tempArray -foreach ($objectList as $objectRef) { - $fileFolderName = substr($objectRef->getPathname(), strlen($docRoot.$iceRoot)); - $canAdd = true; - for ($i=0;$igetFilename()!="." && $objectRef->getFilename()!=".." && $fileFolderName[strlen($fileFolderName)-1]!="/" && $canAdd) { - $fileFolderName!="/" && is_dir($docRoot.$iceRoot.$fileFolderName) - ? array_push($finalArray,$fileFolderName) - : array_push($tempArray,$fileFolderName); - } -} + // With that done, create arrays for out final ordered list and a temp container of files + $finalArray = $tempArray = array(); -// Now push root files onto the end of finalArray and splice from the temp, leaving only files that reside in subdirs -for ($i=0;$igetPathname(), strlen($docRoot.$iceRoot)); + $canAdd = true; + for ($i=0;$igetFilename()!="." && $objectRef->getFilename()!=".." && $fileFolderName[strlen($fileFolderName)-1]!="/" && $canAdd) { + $fileFolderName!="/" && is_dir($docRoot.$iceRoot.$fileFolderName) + ? array_push($finalArray,$fileFolderName) + : array_push($tempArray,$fileFolderName); } } - array_splice($finalArray, $insertAt, 0, $tempArray[$i]); + + // Now push root files onto the end of finalArray and splice from the temp, leaving only files that reside in subdirs + for ($i=0;$i