You are here

public function ArchiverManager::getExtensions in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Archiver/ArchiverManager.php \Drupal\Core\Archiver\ArchiverManager::getExtensions()

Returns a string of supported archive extensions.

Return value

string A space-separated string of extensions suitable for use by the file validation system.

File

core/lib/Drupal/Core/Archiver/ArchiverManager.php, line 86

Class

ArchiverManager
Provides an Archiver plugin manager.

Namespace

Drupal\Core\Archiver

Code

public function getExtensions() {
  $valid_extensions = [];
  foreach ($this
    ->getDefinitions() as $archive) {
    foreach ($archive['extensions'] as $extension) {
      foreach (explode('.', $extension) as $part) {
        if (!in_array($part, $valid_extensions)) {
          $valid_extensions[] = $part;
        }
      }
    }
  }
  return implode(' ', $valid_extensions);
}