Newscoop\Service\Implementation\ThemeServiceLocalFileSystem::findAllThemesConfigPaths PHP Метод

findAllThemesConfigPaths() защищенный Метод

Finds all paths to the configurations XML files for themes, that are located in the theme folder.
protected findAllThemesConfigPaths ( ) : array
Результат array The array containing as key the id of the theme config and as a value the relative path of the theme configuration XML file in escaped form. The id of a theme is formed based on the publication path with the crec32 applied.
    protected function findAllThemesConfigPaths()
    {
        if ($this->cacheThemeConfigs === NULL) {
            $this->cacheThemeConfigs = array();
            if (strpos($this->themesFolder, 'APPLICATION_PATH') !== false) {
                $this->themesFolder = __DIR__ . str_replace('APPLICATION_PATH', '/../../..', $this->themesFolder);
            }
            if (is_dir($this->themesFolder)) {
                if ($dh = opendir($this->themesFolder)) {
                    while (($dir = readdir($dh)) !== false) {
                        $folder = $this->themesFolder . $dir;
                        if ($dir != "." && $dir != ".." && is_dir($folder)) {
                            // Reading the subdirectories which contain the themes
                            if ($subDh = opendir($folder)) {
                                while (($file = readdir($subDh)) !== false) {
                                    if ($file != "." && $file != "..") {
                                        $filePath = $dir . DIRECTORY_SEPARATOR . $file . DIRECTORY_SEPARATOR . $this->themeConfigFileName;
                                        if (@file_exists($this->themesFolder . $filePath)) {
                                            $escapedPath = $this->escapePath($filePath);
                                            $this->cacheThemeConfigs[crc32($escapedPath)] = $escapedPath;
                                        }
                                    }
                                }
                                closedir($subDh);
                            }
                        }
                    }
                    closedir($dh);
                }
            }
        }
        return $this->cacheThemeConfigs;
    }