You are here

public function MinisiteArchive::filesTree in Mini site 7

Return files tree listing.

File

includes/minisite.archive.inc, line 103
Minisite archive class.

Class

MinisiteArchive
Class MinisiteArchive.

Code

public function filesTree() {
  $listing = $this
    ->filesList();
  $tree = array();
  foreach ($listing as $file_path) {
    $parts = explode('/', $file_path);

    // Files in archive end in / if a directory.
    if (substr($file_path, -1) === '/') {
      $parts = array_slice($parts, 0, -1);
      drupal_array_set_nested_value($tree, $parts, array(
        '.' => $file_path,
      ));
    }
    else {
      drupal_array_set_nested_value($tree, $parts, $file_path);
    }
  }
  return $tree;
}