Get all configurations for this site package

@param string $sitePackageKey
975355
public function configurationAction($sitePackageKey = null)
    {
        $sitePackageKey = $sitePackageKey ?: $this->getDefaultSitePackageKey();

        $value = [];
        $value['sitePackage'] = $sitePackageKey;
        $value['ui'] = [
            'sitePackages' =>  $this->getSitePackages(),
            'viewportPresets' => $this->configurationService->getSiteConfiguration($sitePackageKey, 'ui.viewportPresets'),
            'localePresets' => $this->configurationService->getSiteConfiguration($sitePackageKey, 'ui.localePresets'),
            'hotkeys' => $this->configurationService->getSiteConfiguration($sitePackageKey, 'ui.hotkeys'),
            'preview' => $this->configurationService->getSiteConfiguration($sitePackageKey, 'preview')
        ];
        $value['styleguideObjects'] = $this->getStyleguideObjects($sitePackageKey);

        $this->view->assign('value', $value);
    }
149765
protected function parseNamespacedSegments($key)
    {
        list($namespace, $item) = explode('::', $key);

        // If the namespace is registered as a package, we will just assume the group
        // is equal to the namespace since all packages cascade in this way having
        // a single file per package, otherwise we'll just parse them as normal.
        if (array_key_exists($namespace, $this->packages)) {
            return $this->parsePackageSegments($key, $namespace, $item);
        }

        return parent::parseNamespacedSegments($key);
    }
1130582
public function getConfigStruct(string $configKey): ConfigStruct
    {
        if (!$this->hasConfigStruct($configKey)) {
            throw ConfigException::noConfigStruct($configKey);
        }

        return $this->configStructs[$configKey];
    }
861824
public function getContents($cacheKey)
    {
        $cacheInfo = $this->getCache($cacheKey);
        if (!$cacheInfo) {
            throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name'=>$cacheKey]));
        }

        $this->localPath = $cacheInfo['path'];
        $this->storagePath = storage_path('cms/combiner/assets');

        /*
         * Analyse cache information
         */
        $lastModifiedTime = gmdate("D, d M Y H:i:s \G\M\T", array_get($cacheInfo, 'lastMod'));
        $etag = array_get($cacheInfo, 'etag');
        $mime = (array_get($cacheInfo, 'extension') == 'css')
            ? 'text/css'
            : 'application/javascript';

        /*
         * Set 304 Not Modified header, if necessary
         */
        header_remove();
        $response = Response::make();
        $response->header('Content-Type', $mime);
        $response->header('Cache-Control', 'private, max-age=604800');
        $response->setLastModified(new DateTime($lastModifiedTime));
        $response->setEtag($etag);
        $response->setPublic();
        $modified = !$response->isNotModified(App::make('request'));

        /*
         * Request says response is cached, no code evaluation needed
         */
        if ($modified) {
            $this->setHashOnCombinerFilters($cacheKey);
            $combiner = $this->prepareCombiner($cacheInfo['files']);
            $contents = $combiner->dump();
            $response->setContent($contents);
        }

        return $response;
    }
505823
public function getPackages( $keys = null )
    {
        $packages = array();

        if ( empty( $keys ) )
        {
            foreach ( $this as $subPackages )
            {
                $packages = array_merge(
                    $packages,
                    array_values( $subPackages )
                );
            }
        }
        else if ( is_array( $keys ) )
        {
            foreach ( $keys as $key )
            {
                $key = (string) $key;

                if ( ! empty( $this[$key] ) )
                {
                    $packages = array_merge(
                        $packages,
                        array_values( $this[$key] )
                    );
                }
            }
        }
        else
        {
            $packages = $this[(string) $keys];
        }

        return array_unique( array_map( 'strtolower', $packages ) );
    }
916506
protected function generateAdditionalFolders($packageKey)
    {
        $resourcesPath = $this->packageManager->getPackage($packageKey)->getResourcesPath();
        $publicResourcesPath = Files::concatenatePaths([$resourcesPath, 'Public']);

        foreach (['Images', 'JavaScript', 'Styles'] as $publicResourceFolder) {
            Files::createDirectoryRecursively(Files::concatenatePaths([$publicResourcesPath, $publicResourceFolder]));
        }
    }
390205
public function documentationCommand($packageKey)
    {
        $this->validatePackageKey($packageKey);
        if (!$this->packageManager->isPackageAvailable($packageKey)) {
            $this->outputLine('Package "%s" is not available.', [$packageKey]);
            exit(2);
        }

        $generatedFiles = $this->generatorService->generateDocumentation($packageKey);

        $this->outputLine(implode(PHP_EOL, $generatedFiles));
    }
849537
protected function getConfigFiles()
    {
        $file = new Filesystem();

        $projectFiles = $file->glob(app_path('honeycomb/config.json'));
        $packageFiles = $file->glob(__DIR__ . '/../../../../*/*/*/*/honeycomb/config.json');

        return array_merge($packageFiles, $projectFiles);
    }
334479
public function getConfig($configKey = null)
    {
        $default = clone $this->config->configs->default;

        if (null !== $configKey) {
            $default->merge(clone $this->config->configs->{$configKey});
        }

        return $default->toArray();
    }
314449
public function generateLayout($packageKey, $layoutName, $overwrite = false)
    {
        $layoutName = ucfirst($layoutName);

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/View/' . $layoutName . 'Layout.html';

        $contextVariables = [];
        $contextVariables['packageKey'] = $packageKey;

        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);

        $layoutFilename = $layoutName . '.html';
        $viewPath = 'resource://' . $packageKey . '/Private/Layouts/';
        $targetPathAndFilename = $viewPath . $layoutFilename;

        $this->generateFile($targetPathAndFilename, $fileContent, $overwrite);

        return $this->generatedFiles;
    }
489286
public function getConfigDefinition(string $configKey): ConfigDefinitionInterface
    {
        if (!$this->hasConfigDefinition($configKey)) {
            throw ConfigDefinitionException::noConfigDefinition($configKey);
        }

        return $this->configDefinitions[$configKey];
    }
863310
public function importSiteAction($packageKey)
    {
        try {
            $this->siteImportService->importFromPackage($packageKey);
            $this->addFlashMessage('The site has been imported.', '', null, [], 1412372266);
        } catch (\Exception $exception) {
            $logMessage = $this->throwableStorage->logThrowable($exception);
            $this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__));
            $this->addFlashMessage('Error: During the import of the "Sites.xml" from the package "%s" an exception occurred: %s', 'Import error', Message::SEVERITY_ERROR, [htmlspecialchars($packageKey), htmlspecialchars($exception->getMessage())], 1412372375);
        }
        $this->unsetLastVisitedNodeAndRedirect('index');
    }
999303
protected function getCleanAdditionalConfiguration($extensionKey)
    {
        $newLines = [];

        // Load content and search for the include
        if (($content = GeneralUtility::getUrl($this->getConfigurationManager()->getAdditionalConfigurationFileLocation())) !== false)
        {
            $currentLines = explode(LF, $content);

            // Delete the php marker line
            array_shift($currentLines);

            //
            $startFound = false;
            $endFound = false;

            foreach ($currentLines as $line)
            {
                if (($startFound) && (!$endFound)) {
                    $endFound = (strpos($line, '}') !== false);
                } elseif ((!$startFound) && (strpos($line, $extensionKey) !== false)) {
                    $startFound = true;
                    $endFound = false;
                } else {
                    $newLines[] = $line;
                }
            }
        }

        // Remove blank lines at the end
        $revLines = array_reverse($newLines);
        $newLines = [];
        $lineFound = false;

        foreach ($revLines as $line)
        {
            if ($lineFound || !empty(trim($line))) {
                $newLines[] = $line;
                $lineFound = true;
            }
        }

        return array_reverse($newLines);
    }
630839
public function generateTranslation($packageKey, $sourceLanguageKey, array $targetLanguageKeys = [])
    {
        $translationPath = 'resource://' . $packageKey . '/Private/Translations';
        $contextVariables = [];
        $contextVariables['packageKey'] = $packageKey;
        $contextVariables['sourceLanguageKey'] = $sourceLanguageKey;

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/SourceLanguageTemplate.xlf.tmpl';
        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
        $sourceLanguageFile = Files::concatenatePaths([$translationPath, $sourceLanguageKey, 'Main.xlf']);
        $this->generateFile($sourceLanguageFile, $fileContent);

        if ($targetLanguageKeys) {
            $xliffParser = new XliffParser();
            $parsedXliffArray = $xliffParser->getParsedData($sourceLanguageFile);
            foreach ($targetLanguageKeys as $targetLanguageKey) {
                $contextVariables['targetLanguageKey'] = $targetLanguageKey;
                $contextVariables['translationUnits'] = $parsedXliffArray['translationUnits'];

                $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Translations/TargetLanguageTemplate.xlf.tmpl';
                $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
                $targetPathAndFilename = Files::concatenatePaths([$translationPath, $targetLanguageKey, 'Main.xlf']);
                $this->generateFile($targetPathAndFilename, $fileContent);
            }
        }

        return $this->generatedFiles;
    }
12133
public function generateDocumentation($packageKey)
    {
        $documentationPath = Files::concatenatePaths([$this->packageManager->getPackage($packageKey)->getPackagePath(), 'Documentation']);
        $contextVariables = [];
        $contextVariables['packageKey'] = $packageKey;

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/conf.py';
        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
        $targetPathAndFilename = $documentationPath . '/conf.py';
        $this->generateFile($targetPathAndFilename, $fileContent);

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/Makefile';
        $fileContent = file_get_contents($templatePathAndFilename);
        $targetPathAndFilename = $documentationPath . '/Makefile';
        $this->generateFile($targetPathAndFilename, $fileContent);

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/index.rst';
        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
        $targetPathAndFilename = $documentationPath . '/index.rst';
        $this->generateFile($targetPathAndFilename, $fileContent);

        $targetPathAndFilename = $documentationPath . '/_build/.gitignore';
        $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10));
        $targetPathAndFilename = $documentationPath . '/_static/.gitignore';
        $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10));
        $targetPathAndFilename = $documentationPath . '/_templates/.gitignore';
        $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10));

        return $this->generatedFiles;
    }
1041194
public function getCacheFile($cacheKey)
    {
        do_action("before_theme_get_cache_file", $cacheKey);

        $filename = md5($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "-" . $cacheKey);

        do_action("after_theme_get_cache_file", $filename);

        return $this->cachePath . $filename;
    }
875918
protected function getActiveSitePackageKeys()
    {
        $sitePackages = $this->packageManager->getFilteredPackages('available', null, 'neos-site');
        $result = [];
        foreach ($sitePackages as $sitePackage) {
            $packageKey = $sitePackage->getPackageKey();
            $result[] = $packageKey;
        }
        return $result;
    }