getPathname(), $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;
}
}
// Get a full list of dirs & files and begin sorting using above class & function
$objectList = new SortingIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($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;$igetFilename()!="." && $objectRef->getFilename()!=".." && $fileFolderName[strlen($fileFolderName)-1]!="/" && $canAdd) {
$fileFolderName!="/" && is_dir($docRoot.$iceRoot.$fileFolderName)
? array_push($finalArray,$fileFolderName)
: array_push($tempArray,$fileFolderName);
}
}
// 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'.$chmodInfo.'';
}
?>
-
/
$lastDepth) {echo "\n";}
if ($thisDepth < $lastDepth) {
for ($j=$lastDepth;$j>$thisDepth;$j--) {
echo "
\n";
}
}
if ($serverType=="Linux") {
$chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3);
$fileAtts = ''.$chmodInfo.'';
}
$type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext);
echo "- ".basename($fileFolderName)." ".$fileAtts."\n";
if ($i\n";}
$lastPath = $fileFolderName;
}
echo "
\n\n";
// Output the JS vars
echo "";
?>