Ejemplo n.º 1
0
 public function preMap(array $config, ContextualizerInterface $contextualizer)
 {
     $scopes = array_merge([ConfigResolver::SCOPE_DEFAULT, ConfigResolver::SCOPE_GLOBAL], $config['siteaccess']['list'], array_keys($config['siteaccess']['groups']));
     foreach ($scopes as $scope) {
         if (!isset($config[$contextualizer->getSiteAccessNodeName()][$scope][static::NODE_KEY])) {
             continue;
         }
         $locationViewConfig =& $config[$contextualizer->getSiteAccessNodeName()][$scope][static::NODE_KEY];
         $contentViewConfig =& $config[$contextualizer->getSiteAccessNodeName()][$scope][ContentView::NODE_KEY];
         // view rules without a custom controller are moved from $locationViewConfig to $contentViewConfig
         foreach ($locationViewConfig as $viewIdentifier => $viewRules) {
             foreach ($viewRules as $viewRuleIdentifier => $viewRule) {
                 if (!isset($viewRule['controller'])) {
                     $contentViewConfig[$viewIdentifier][$viewRuleIdentifier] = $locationViewConfig[$viewIdentifier][$viewRuleIdentifier];
                     unset($locationViewConfig[$viewIdentifier][$viewRuleIdentifier]);
                 }
             }
             if (count($locationViewConfig[$viewIdentifier]) === 0) {
                 unset($locationViewConfig[$viewIdentifier]);
             }
         }
     }
     parent::preMap($config, $contextualizer);
     $contextualizer->mapConfigArray(ContentView::NODE_KEY, $config, ContextualizerInterface::MERGE_FROM_SECOND_LEVEL);
 }
Ejemplo n.º 2
0
 public function postMap(array $config, ContextualizerInterface $contextualizer)
 {
     $contextualizer->mapConfigArray('fieldtypes.ezxml.custom_xsl', $config);
     $contextualizer->mapConfigArray('fieldtypes.ezrichtext.output_custom_xsl', $config);
     $contextualizer->mapConfigArray('fieldtypes.ezrichtext.edit_custom_xsl', $config);
     $contextualizer->mapConfigArray('fieldtypes.ezrichtext.input_custom_xsl', $config);
 }
Ejemplo n.º 3
0
 /**
  * Post process configuration to add io_root_dir and io_prefix.
  */
 public function postMap(array $config, ContextualizerInterface $contextualizer)
 {
     $container = $contextualizer->getContainer();
     // complex parameters dependencies
     foreach (array_merge($config['siteaccess']['list'], array_keys($config['siteaccess']['groups'])) as $scope) {
         $this->addComplexParametersDependencies('io.url_prefix', $scope, $container);
         $this->addComplexParametersDependencies('io.legacy_url_prefix', $scope, $container);
         $this->addComplexParametersDependencies('io.root_dir', $scope, $container);
     }
     // we should only write for default, and for sa/sa groups/global IF they have a declared value
     $scopes = array_merge(array('default'), $config['siteaccess']['list'], array_keys($config['siteaccess']['groups']));
     foreach ($scopes as $scope) {
         // post process io.url_prefix for complex settings
         $postProcessedValue = $this->postProcessComplexSetting('io.url_prefix', $scope, $container);
         if (is_string($postProcessedValue)) {
             $contextualizer->setContextualParameter('io.url_prefix', $scope, $postProcessedValue);
         }
         // post process io.legacy_url_prefix for complex settings
         $postProcessedValue = $this->postProcessComplexSetting('io.legacy_url_prefix', $scope, $container);
         if (is_string($postProcessedValue)) {
             $contextualizer->setContextualParameter('io.legacy_url_prefix', $scope, $postProcessedValue);
         }
         // post process io.root_dir for complex settings
         $postProcessedValue = $this->postProcessComplexSetting('io.root_dir', $scope, $container);
         if (is_string($postProcessedValue)) {
             $contextualizer->setContextualParameter('io.root_dir', $scope, $postProcessedValue);
         }
     }
 }
Ejemplo n.º 4
0
 public function preMap(array $config, ContextualizerInterface $contextualizer)
 {
     foreach ($config['siteaccess']['groups'] as $group => $saArray) {
         if (isset($config['system'][$group][static::NODE_KEY])) {
             $contextualizer->setContextualParameter(static::NODE_KEY, $group, $config[$contextualizer->getSiteAccessNodeName()][$group][static::NODE_KEY]);
         }
     }
     $contextualizer->mapConfigArray(static::NODE_KEY, $config);
 }
Ejemplo n.º 5
0
 public function postMap(array $config, ContextualizerInterface $contextualizer)
 {
     $contextualizer->mapConfigArray('yui.modules', $config, ContextualizerInterface::UNIQUE);
     foreach (array_unique($this->allModules) as $moduleName) {
         $contextualizer->mapConfigArray("yui.modules.{$moduleName}.requires", $config, ContextualizerInterface::UNIQUE);
         $contextualizer->mapConfigArray("yui.modules.{$moduleName}.dependencyOf", $config, ContextualizerInterface::UNIQUE);
     }
     $contextualizer->mapConfigArray('css.files', $config, ContextualizerInterface::UNIQUE);
 }
Ejemplo n.º 6
0
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (isset($scopeSettings['imagemagick']['pre_parameters'])) {
         $contextualizer->setContextualParameter('imagemagick.pre_parameters', $currentScope, $scopeSettings['imagemagick']['pre_parameters']);
     }
     if (isset($scopeSettings['imagemagick']['post_parameters'])) {
         $contextualizer->setContextualParameter('imagemagick.post_parameters', $currentScope, $scopeSettings['imagemagick']['post_parameters']);
     }
 }
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (empty($scopeSettings['user_registration'])) {
         return;
     }
     $settings = $scopeSettings['user_registration'];
     if (!empty($settings['group_id'])) {
         $contextualizer->setContextualParameter('user_registration.group_id', $currentScope, $settings['group_id']);
     }
     if (!empty($settings['templates']['form'])) {
         $contextualizer->setContextualParameter('user_registration.templates.form', $currentScope, $settings['templates']['form']);
     }
     if (!empty($settings['templates']['confirmation'])) {
         $contextualizer->setContextualParameter('user_registration.templates.confirmation', $currentScope, $settings['templates']['confirmation']);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     // Common settings
     if (isset($scopeSettings['server_uri'])) {
         $contextualizer->setContextualParameter('server_uri', $currentScope, $scopeSettings['server_uri']);
     }
     if (isset($scopeSettings['yoochoose']['customer_id'])) {
         $contextualizer->setContextualParameter('yoochoose.customer_id', $currentScope, $scopeSettings['yoochoose']['customer_id']);
     }
     if (isset($scopeSettings['yoochoose']['license_key'])) {
         $contextualizer->setContextualParameter('yoochoose.license_key', $currentScope, $scopeSettings['yoochoose']['license_key']);
     }
     if (isset($scopeSettings['recommender']['included_content_types'])) {
         $contextualizer->setContextualParameter('recommender.included_content_types', $currentScope, $scopeSettings['recommender']['included_content_types']);
     }
 }
Ejemplo n.º 9
0
 public function preMap(array $config, ContextualizerInterface $contextualizer)
 {
     $container = $contextualizer->getContainer();
     $defaultConfig = array('layouts' => $container->getParameter('ezpublish.ezpage.layouts'), 'blocks' => $container->getParameter('ezpublish.ezpage.blocks'), 'enabledLayouts' => $container->getParameter('ezpublish.ezpage.enabledLayouts'), 'enabledBlocks' => $container->getParameter('ezpublish.ezpage.enabledBlocks'));
     $container->setParameter('ezsettings.' . ConfigResolver::SCOPE_DEFAULT . '.ezpage', $defaultConfig);
     $contextualizer->mapConfigArray('ezpage', $config, ContextualizerInterface::MERGE_FROM_SECOND_LEVEL);
     // filters blocks and layouts for each siteaccess to keep only
     // the enabled ones for this sa
     foreach ($config['siteaccess']['list'] as $sa) {
         $ezpageSettings = $container->getParameter("ezsettings.{$sa}.ezpage");
         foreach (array('layouts', 'blocks') as $type) {
             $enabledKey = 'enabled' . ucfirst($type);
             if (empty($ezpageSettings[$enabledKey])) {
                 $ezpageSettings[$type] = array();
                 continue;
             }
             $ezpageSettings[$type] = array_intersect_key($ezpageSettings[$type], array_flip($ezpageSettings[$enabledKey]));
             $ezpageSettings[$enabledKey] = array_unique($ezpageSettings[$enabledKey]);
         }
         $container->setParameter("ezsettings.{$sa}.ezpage", $ezpageSettings);
     }
 }
Ejemplo n.º 10
0
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (!empty($scopeSettings['content'])) {
         $contextualizer->setContextualParameter('content.view_cache', $currentScope, $scopeSettings['content']['view_cache']);
         $contextualizer->setContextualParameter('content.ttl_cache', $currentScope, $scopeSettings['content']['ttl_cache']);
         $contextualizer->setContextualParameter('content.default_ttl', $currentScope, $scopeSettings['content']['default_ttl']);
         if (isset($scopeSettings['content']['tree_root'])) {
             $contextualizer->setContextualParameter('content.tree_root.location_id', $currentScope, $scopeSettings['content']['tree_root']['location_id']);
             if (isset($scopeSettings['content']['tree_root']['excluded_uri_prefixes'])) {
                 $contextualizer->setContextualParameter('content.tree_root.excluded_uri_prefixes', $currentScope, $scopeSettings['content']['tree_root']['excluded_uri_prefixes']);
             }
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     // common settings
     if (isset($scopeSettings['providers'])) {
         $contextualizer->setContextualParameter('providers', $currentScope, $scopeSettings['providers']);
     }
     if (isset($scopeSettings['template'])) {
         $contextualizer->setContextualParameter('template', $currentScope, $scopeSettings['template']);
     }
     // Facebook like settings
     if (isset($scopeSettings['facebook_like.layout'])) {
         $contextualizer->setContextualParameter('facebook_like.layout', $currentScope, $scopeSettings['facebook_like.layout']);
     }
     if (isset($scopeSettings['facebook_like.width'])) {
         $contextualizer->setContextualParameter('facebook_like.width', $currentScope, $scopeSettings['facebook_like.width']);
     }
     if (isset($scopeSettings['facebook_like.show_faces'])) {
         $contextualizer->setContextualParameter('facebook_like.show_faces', $currentScope, $scopeSettings['facebook_like.show_faces']);
     }
     if (isset($scopeSettings['facebook_like.share'])) {
         $contextualizer->setContextualParameter('facebook_like.share', $currentScope, $scopeSettings['facebook_like.share']);
     }
     // Facebook recommend settings
     if (isset($scopeSettings['facebook_recommend.layout'])) {
         $contextualizer->setContextualParameter('facebook_recommend.layout', $currentScope, $scopeSettings['facebook_recommend.layout']);
     }
     if (isset($scopeSettings['facebook_recommend.width'])) {
         $contextualizer->setContextualParameter('facebook_recommend.width', $currentScope, $scopeSettings['facebook_recommend.width']);
     }
     if (isset($scopeSettings['facebook_recommend.show_faces'])) {
         $contextualizer->setContextualParameter('facebook_recommend.show_faces', $currentScope, $scopeSettings['facebook_recommend.show_faces']);
     }
     if (isset($scopeSettings['facebook_recommend.share'])) {
         $contextualizer->setContextualParameter('facebook_recommend.share', $currentScope, $scopeSettings['facebook_recommend.share']);
     }
     // Twitter settings
     if (isset($scopeSettings['twitter.show_username'])) {
         $contextualizer->setContextualParameter('twitter.show_username', $currentScope, $scopeSettings['twitter.show_username']);
     }
     if (isset($scopeSettings['twitter.large_button'])) {
         $contextualizer->setContextualParameter('twitter.large_button', $currentScope, $scopeSettings['twitter.large_button']);
     }
     if (isset($scopeSettings['twitter.language'])) {
         $contextualizer->setContextualParameter('twitter.language', $currentScope, $scopeSettings['twitter.language']);
     }
     // LinkedIn settings
     if (isset($scopeSettings['linkedin.count_mode'])) {
         $contextualizer->setContextualParameter('linkedin.count_mode', $currentScope, $scopeSettings['linkedin.count_mode']);
     }
     if (isset($scopeSettings['linkedin.language'])) {
         $contextualizer->setContextualParameter('linkedin.language', $currentScope, $scopeSettings['linkedin.language']);
     }
     // Google Plus settings
     if (isset($scopeSettings['google_plus.size'])) {
         $contextualizer->setContextualParameter('google_plus.size', $currentScope, $scopeSettings['google_plus.size']);
     }
     if (isset($scopeSettings['google_plus.annotation'])) {
         $contextualizer->setContextualParameter('google_plus.annotation', $currentScope, $scopeSettings['google_plus.annotation']);
     }
     if (isset($scopeSettings['google_plus.width'])) {
         $contextualizer->setContextualParameter('google_plus.width', $currentScope, $scopeSettings['google_plus.width']);
     }
     if (isset($scopeSettings['google_plus.language'])) {
         $contextualizer->setContextualParameter('google_plus.language', $currentScope, $scopeSettings['google_plus.language']);
     }
 }
Ejemplo n.º 12
0
 public function preMap(array $config, ContextualizerInterface $contextualizer)
 {
     $contextualizer->mapConfigArray('image_variations', $config);
 }
Ejemplo n.º 13
0
 public function postMap( array $config, ContextualizerInterface $contextualizer )
 {
     $contextualizer->mapConfigArray( 'content_comments', $config, ContextualizerInterface::MERGE_FROM_SECOND_LEVEL );
 }
 /**
  * Proxy to `Contextualizer::mapConfigArray()`.
  *
  * @see ContextualizerInterface::mapConfigArray()
  *
  * @param string $id Id of the setting array to map.
  * @param array $config Full semantic configuration array for current bundle.
  * @param int $options Bit mask of options (See constants of `ContextualizerInterface`)
  */
 public function mapConfigArray($id, array $config, $options = 0)
 {
     $this->contextualizer->mapConfigArray($id, $config, $options);
 }
Ejemplo n.º 15
0
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (isset($scopeSettings['database'])) {
         $this->addDatabaseConfigSuggestion($currentScope, $scopeSettings['database']);
     }
     if (isset($scopeSettings['repository'])) {
         $contextualizer->setContextualParameter('repository', $currentScope, $scopeSettings['repository']);
     }
     if (isset($scopeSettings['legacy_mode'])) {
         $contextualizer->setContextualParameter('legacy_mode', $currentScope, $scopeSettings['legacy_mode']);
         $contextualizer->setContextualParameter('url_alias_router', $currentScope, !$scopeSettings['legacy_mode']);
     }
     if (isset($scopeSettings['cache_pool_name'])) {
         $contextualizer->setContextualParameter('cache_pool_name', $currentScope, $scopeSettings['cache_pool_name']);
     }
     if (isset($scopeSettings['var_dir'])) {
         $contextualizer->setContextualParameter('var_dir', $currentScope, $scopeSettings['var_dir']);
     }
     if (isset($scopeSettings['storage_dir'])) {
         $contextualizer->setContextualParameter('storage_dir', $currentScope, $scopeSettings['storage_dir']);
     }
     if (isset($scopeSettings['binary_dir'])) {
         $contextualizer->setContextualParameter('binary_dir', $currentScope, $scopeSettings['binary_dir']);
     }
     // session_name setting is deprecated in favor of session.name
     $container = $contextualizer->getContainer();
     $sessionOptions = $container->hasParameter("ezsettings.{$currentScope}.session") ? $container->getParameter("ezsettings.{$currentScope}.session") : array();
     if (isset($sessionOptions['name'])) {
         $contextualizer->setContextualParameter('session_name', $currentScope, $sessionOptions['name']);
     }
     // @deprecated session_name is deprecated, but if present, in addition to session.name, consider it instead (BC).
     if (isset($scopeSettings['session_name'])) {
         $sessionOptions['name'] = $scopeSettings['session_name'];
         $contextualizer->setContextualParameter('session_name', $currentScope, $scopeSettings['session_name']);
         $contextualizer->setContextualParameter('session', $currentScope, $sessionOptions);
     }
     if (isset($scopeSettings['http_cache']['purge_servers'])) {
         $contextualizer->setContextualParameter('http_cache.purge_servers', $currentScope, $scopeSettings['http_cache']['purge_servers']);
     }
     if (isset($scopeSettings['anonymous_user_id'])) {
         $contextualizer->setContextualParameter('anonymous_user_id', $currentScope, $scopeSettings['anonymous_user_id']);
     }
     if (isset($scopeSettings['user']['layout'])) {
         $contextualizer->setContextualParameter('security.base_layout', $currentScope, $scopeSettings['user']['layout']);
     }
     if (isset($scopeSettings['user']['login_template'])) {
         $contextualizer->setContextualParameter('security.login_template', $currentScope, $scopeSettings['user']['login_template']);
     }
     if (isset($scopeSettings['index_page'])) {
         $contextualizer->setContextualParameter('index_page', $currentScope, $scopeSettings['index_page']);
     }
     if (isset($scopeSettings['default_page'])) {
         $contextualizer->setContextualParameter('default_page', $currentScope, '/' . ltrim($scopeSettings['default_page'], '/'));
     }
 }
Ejemplo n.º 16
0
 public function preMap(array $config, ContextualizerInterface $contextualizer)
 {
     $contextualizer->mapConfigArray(static::NODE_KEY, $config, ContextualizerInterface::MERGE_FROM_SECOND_LEVEL);
 }
Ejemplo n.º 17
0
 public function postMap(array $config, ContextualizerInterface $contextualizer)
 {
     $contextualizer->getContainer()->setParameter('ezpublish.siteaccesses_by_language', $this->siteAccessesByLanguages);
 }
Ejemplo n.º 18
0
 public function postMap(array $config, ContextualizerInterface $contextualizer)
 {
     $contextualizer->mapConfigArray('fieldtypes.ezxml.custom_xsl', $config);
 }