diff --git a/files.php b/files.php index a72f9f8..8b3b631 100644 --- a/files.php +++ b/files.php @@ -14,85 +14,6 @@
getPathname()), str_replace($specialChars,"\\",$b->getPathname())); -} - -// Class to put forward the values for sorting -class SortingIterator implements IteratorAggregate { - private $iterator = null; - public function __construct(Traversable $iterator, $callback) { - $array = iterator_to_array($iterator); - usort($array, $callback); - $this->iterator = new ArrayIterator($array); - } - public function getIterator() { - return $this->iterator; - } -} - -class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator { - function getChildren() { - try { - if (!isset($GLOBALS['ICEcoder']['bannedPaths']) || - !in_array($this->key(), $GLOBALS['ICEcoder']['bannedPaths'])) { - return parent::getChildren(); - } else { - return new RecursiveArrayIterator(array()); - } - } catch(UnexpectedValueException $e) { - return new RecursiveArrayIterator(array()); - } - } -} - -if ($ICEcoder['treeType']=="full") { - - // 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'); - - // With that done, create arrays for out final ordered list and a temp container of files - $finalArray = $tempArray = array(); - - // 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;$i