Пример #1
0
 private function _process(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder, $id)
 {
     $logger = $containerBuilder->get('tubepress_internal_logger_BootLogger');
     $finderFactory = $containerBuilder->get('finder_factory');
     $bootSettings = $containerBuilder->get(tubepress_api_boot_BootSettingsInterface::_);
     $context = $containerBuilder->get(tubepress_api_options_ContextInterface::_);
     $urlFactory = $containerBuilder->get(tubepress_api_url_UrlFactoryInterface::_);
     $langUtils = $containerBuilder->get(tubepress_api_util_LangUtilsInterface::_);
     $stringUtils = $containerBuilder->get(tubepress_api_util_StringUtilsInterface::_);
     $serializer = new tubepress_internal_boot_helper_uncached_Serializer($bootSettings);
     $factory = new tubepress_internal_boot_helper_uncached_contrib_ThemeFactory($context, $urlFactory, $langUtils, $logger, $stringUtils, $finderFactory);
     $manifestFinder = new tubepress_internal_boot_helper_uncached_contrib_ManifestFinder(TUBEPRESS_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . $id, DIRECTORY_SEPARATOR . $id, 'theme.json', $logger, $bootSettings, $finderFactory);
     $manifests = $manifestFinder->find();
     $themes = array();
     foreach ($manifests as $path => $manifestData) {
         $theme = $factory->fromManifestData($path, $manifestData);
         if (is_array($theme)) {
             continue;
         }
         if ($theme->getName() === 'changeme/themename') {
             //ignore the starter theme
             continue;
         }
         $themes[] = $theme;
     }
     $bootArtifacts = $containerBuilder->getParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS);
     $bootArtifacts = array_merge($bootArtifacts, array($id => $serializer->serialize($themes)));
     $containerBuilder->setParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS, $bootArtifacts);
     $containerBuilder->set('tubepress_internal_boot_helper_uncached_contrib_ThemeFactory', $factory);
 }
 /**
  * @param tubepress_api_ioc_ContainerBuilderInterface $containerBuilder The primary service container builder.
  *
  * @api
  *
  * @since 4.0.0
  */
 public function process(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     if (!$containerBuilder->hasParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS)) {
         return;
     }
     $bootArtifacts = $containerBuilder->getParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS);
     if (!is_array($bootArtifacts) || !isset($bootArtifacts['themes'])) {
         return;
     }
     $serializedThemes = $bootArtifacts['themes'];
     $bootSettings = $containerBuilder->get(tubepress_api_boot_BootSettingsInterface::_);
     $serializer = new tubepress_internal_boot_helper_uncached_Serializer($bootSettings);
     $unserializedThemes = $serializer->unserialize($serializedThemes);
     $adjustedSystemThemes = $this->_adjustLegacySystemThemes($containerBuilder, $unserializedThemes);
     $userLegacyThemes = $this->_findUserLegacyThemes($bootSettings, $containerBuilder);
     $allLegacyThemes = array_merge($adjustedSystemThemes, $userLegacyThemes);
     $allThemes = array_merge($unserializedThemes, $allLegacyThemes);
     $serializedThemes = $serializer->serialize($allThemes);
     $bootArtifacts['themes'] = $serializedThemes;
     $containerBuilder->setParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS, $bootArtifacts);
 }