Builds a flat list of extensions based on files list

@return  array
974111
public function getFlatListOfExtensions()
	{
		if (!isset($this->flatExtentions))
		{
			$this->flatExtentions = [];

			foreach ($this->getFlatListOfFiles() as $file)
			{
				$this->flatExtentions[] = $file->getExtension();
			}

			$this->flatExtentions = array_count_values($this->flatExtentions);
		}

		return $this->flatExtentions;
	}
240393
public function getExtensionsByType()
  {
    $ext = array();

    foreach ($this->Config->get('file-extensions') as $key => $value)
    {
      $ext[$key] = $value['extensions'];
    }

    return $ext;
  }
59925
public function getFileList()
    {
        $files = new Filesystem;
        return array_map(function (SplFileInfo $file) {
            return $file->getRelativePathname();
        }, $files->allFiles($this->stubDirectory));
    }
715961
public function findAllWithExtension($extensions)
	{
		$found = [];

		if (!is_array($extensions))
		{
			$extensions = [$extensions];
		}

		foreach ($this->getFlatListOfFiles() as $file)
		{
			$ext = $file->getExtension();
			if (in_array($ext, $extensions))
			{
				$found[] = $file;
			}
		}

		return $found;
	}
367736
protected function resolveExtends()
    {
        $extend = [];
        foreach ($this->_targets as $name => $target) {
            if (empty($target['extend'])) {
                continue;
            }
            $parent = $target['extend'];
            if (empty($this->_targets[$parent])) {
                throw new RuntimeException("Invalid extend in '$name'. There is no '$parent' target defined.");
            }
            $extend[] = $name;
        }

        $expander = function ($target) use (&$expander, $extend) {
            $config = $this->_targets[$target];
            $parentConfig = false;

            // Recurse through parents to collect all config.
            if (in_array($target, $extend)) {
                $parentConfig = $expander($config['extend']);
            }
            if (!$parentConfig) {
                return $config;
            }
            $config['files'] = array_merge($parentConfig['files'], $config['files']);
            $config['filters'] = array_merge($parentConfig['filters'], $config['filters']);
            $config['theme'] = $parentConfig['theme'] || $config['theme'];
            return $config;
        };

        foreach ($extend as $target) {
            $this->_targets[$target] = $expander($target);
        }
    }
529252
public function _buildFileList($files, $dir)
    {
        $list = array();

        $dir = realpath($dir);
        if (!$dir) {
            return $list;
        }
        $dir = $this->fixPath($dir);

        foreach ($files as $filename) {
            $filename = $this->makeAbsolutePath(trim($filename), $dir);
            $globResults = glob($filename); // switch slashes since old versions of glob need forward slashes
            if ($globResults) {
                foreach ($globResults as $filepath) {
                    $okay = TRUE;
                    foreach ($this->_ignore as $ignore) {
                        if (strstr($filepath, trim($ignore))) {
                            $okay = FALSE;
                        }
                    }
                    if ($okay) {
                        $list[] = realpath($filepath);
                    }
                }
            } elseif (!$this->_subdirs) {
                $this->error('Could not find file "'.$filename.'"');
            }
        }

        if ($this->_subdirs) { // recurse into subdir
            $globResults = glob($dir.'*', GLOB_ONLYDIR); // get subdirs
            if ($globResults) {
                foreach ($globResults as $dirName) {
                    $okay = TRUE;
                    foreach ($this->_ignore as $ignore) {
                        if (strstr($dirName, trim($ignore))) {
                            $okay = FALSE;
                        }
                    }
                    if ($okay && (GLOB_ONLYDIR || is_dir($dirName))) { // handle missing only dir support
                        $list = array_merge($list, $this->_buildFileList($files, $this->makeAbsolutePath($dirName, $this->_path)));
                    }
                }
            }
        }

        return $list;
    }
255078
protected function getDeltasFilesArray()
    {
        $files = [];

        $baseDir = realpath($this->dir);
        $dh = opendir($baseDir);

        if ($dh === false) {
            return $files;
        }

        $fileChangeNumberPrefix = '';
        while (($file = readdir($dh)) !== false) {
            if (preg_match('[\d+]', $file, $fileChangeNumberPrefix)) {
                $files[(int) $fileChangeNumberPrefix[0]] = $file;
            }
        }

        return $files;
    }
936196
private function buildFilters()
    {
        $filters = array();

        // file only ? or direcotry only ?
        if ($this->file_only) $filters[] = new Filter\FileOnlyFilter();
        if ($this->directory_only) $filters[] = new Filter\DirectoryOnlyFilter();

        // name match ?
        foreach ($this->names as $name) {
            $filters[] = new Filter\NameFilter($name);
        }

        return $filters;
    }
347706
public function getFileSets()
    {
        $filesets = [];
        foreach ($this->getFileSetIDs() as $fsID) {
            $fs = FileSet::getByID($fsID);
            if ($fs !== null) {
                $filesets[] = $fs;
            }
        }

        return $filesets;
    }
850920
public function files(String $path, String $extension = NULL) : Array
    {
        $list = ftp_nlist($this->connect, $path);

        if( ! empty($list) ) foreach( $list as $file )
        {
            if( $file !== '.' && $file !== '..' )
            {
                if( ! empty($extension) && $extension !== 'dir' )
                {
                    if( Filesystem::getExtension($file) === $extension )
                    {
                        $files[] = $file;
                    }
                }
                else
                {
                    if( $extension === 'dir' )
                    {
                        $extens = Filesystem::getExtension($file);

                        if( empty($extens) )
                        {
                            $files[] = $file;
                        }
                    }
                    else
                    {
                        $files[] = $file;
                    }
                }
            }
        }

        if( ! empty($files) )
        {
            return $files;
        }
        else
        {
            return [];
        }
    }
146109
public function getFiles() {
        static $files;
        if (!isset($files)) {
            $normalizeLevel = function(array $file) use (&$normalizeLevel) {
                if (isset($file['name']) && is_array($file['name'])) {
                    $properties = \array_keys($file);
                    $normalized = [];
                    foreach (\array_keys($file['name']) as $name) {
                        foreach ($properties as $property) {
                            $normalized[$name][$property] = $file[$property][$name];
                        }
                        $normalized[$name] = $normalizeLevel($normalized[$name]);
                    }
                    $file = $normalized;
                }
                return $file;
            };
            $files = [];
            if (isset($_FILES)) {
                foreach ($_FILES as $key => $file) {
                    $files[$key] = $normalizeLevel($file);
                }
            }
        }
        return $files;
    }
1212432
protected function getAcceptFileTypes()
    {
        $extensions = $this->getValidator()->getAllowedExtensions();
        if (!$extensions) {
            return [];
        }

        $accept = [];
        $mimeTypes = HTTP::config()->uninherited('MimeTypes');
        foreach ($extensions as $extension) {
            $accept[] = ".{$extension}";
            // Check for corresponding mime type
            if (isset($mimeTypes[$extension])) {
                $accept[] = $mimeTypes[$extension];
            }
        }

        return array_unique($accept);
    }
444071
public function getExtensions()
    {
        if (null == $this->extensions_unserialized && null !== $this->extensions) {
            $this->extensions_unserialized = unserialize($this->extensions);
        }

        return $this->extensions_unserialized;
    }
536426
public function actionIndex()
    {
        $extensions = Extension::find()->all();
        if (empty($extensions)) {
            echo "<empty list>";
        }
        echo"|";
        echo sprintf("%28s", "Class Name");
        echo"|";
        echo sprintf("%4s", "Enb");
        echo"|";
        echo sprintf("%4s", "Mnp");
        echo"|";
        echo sprintf("%4s", "Dft");
        echo"|";
        echo sprintf("%20s", "Create Time");
        echo"|";
        echo sprintf("%20s", "Update Time");
        echo"|";
        echo "\r\n";
        foreach ($extensions as $extension) {
            echo"|";
            echo sprintf("%28s", $extension->classname);
            echo"|";
            echo sprintf("%4d", $extension->isEnabled);
            echo"|";
            echo sprintf("%4d", $extension->monopolized);
            echo"|";
            echo sprintf("%4d", $extension->default);
            echo"|";
            echo sprintf("%20s", $extension->createdAt);
            echo"|";
            echo sprintf("%20s", $extension->updatedAt);
            echo"|";
            echo "\r\n";
        }
        return 0;
    }
770723
public function enaArchiveFiles()
    {
        $properties = $this->getProperties();
        $extString  = (!empty($properties['acceptedFiles'])) ? $properties['acceptedFiles'] : '';
        $archExts   = $this->getArchiveExtensionConstant();
        foreach ($archExts as $archExt) {
            if (strpos($extString, $archExt) === false) {
                $extString .= ','.$archExt;
            }
        }
        $extString                      = substr($extString, 1);
        $properties                     = $this->getProperties();
        $properties['acceptedFiles']    = $extString;
        $this->setProperties($properties);
        return $this;
    }
298992
public static function getAllowedExtensions()
    {
        $config = static::config()->get('allowed_extensions');

        $allowedExtensions = [];
        foreach ($config as $key => $value) {
            if (is_int($key)) {
                // Numeric indexes, example: [jpg, png, gif]
                $key = $value;
                $value = true;
            }

            // Skip disabled extensions
            if (in_array($value, [null, false], true)) {
                continue;
            }

            $allowedExtensions[] = strtolower($key);
        }
        return $allowedExtensions;
    }
816637
protected function mapPhpFiles()
    {
        $files = array();
        foreach ($_FILES as $fileName => $fileParams) {
            $files[$fileName] = array();
            foreach ($fileParams as $param => $data) {
                if (!is_array($data)) {
                    $files[$fileName][$param] = $data;
                } else {
                    foreach ($data as $i => $v) {
                        $this->mapPhpFileParam($files[$fileName], $param, $i, $v);
                    }
                }
            }
        }

        return $files;
    }