当前位置: 首页>>代码示例>>PHP>>正文


PHP ConfigResolverInterface::getParameter方法代码示例

本文整理汇总了PHP中eZ\Publish\Core\MVC\ConfigResolverInterface::getParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigResolverInterface::getParameter方法的具体用法?PHP ConfigResolverInterface::getParameter怎么用?PHP ConfigResolverInterface::getParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZ\Publish\Core\MVC\ConfigResolverInterface的用法示例。


在下文中一共展示了ConfigResolverInterface::getParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getParameter

 /**
  * Returns the parameter value from config resolver.
  *
  * @param string $parameterName
  * @param string $namespace
  * @param mixed $defaultValue
  *
  * @return mixed
  */
 protected function getParameter($parameterName, $namespace, $defaultValue = null)
 {
     if ($this->configResolver->hasParameter($parameterName, $namespace)) {
         return $this->configResolver->getParameter($parameterName, $namespace);
     }
     return $defaultValue;
 }
开发者ID:netgen,项目名称:tagsbundle,代码行数:16,代码来源:CachedValue.php

示例2: onKernelRequest

 /**
  * If user is logged-in in legacy_mode (e.g. legacy admin interface),
  * will inject currently logged-in user in the repository.
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     /** @var \eZ\Publish\Core\MVC\ConfigResolverInterface $configResolver */
     $request = $event->getRequest();
     $session = $request->getSession();
     if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST || !$this->configResolver->getParameter('legacy_mode') || !($session->isStarted() && $session->has('eZUserLoggedInID'))) {
         return;
     }
     try {
         $apiUser = $this->repository->getUserService()->loadUser($session->get('eZUserLoggedInID'));
         $this->repository->setCurrentUser($apiUser);
         $token = $this->tokenStorage->getToken();
         if ($token instanceof TokenInterface) {
             $token->setUser(new User($apiUser));
             // Don't embed if we already have a LegacyToken, to avoid nested session storage.
             if (!$token instanceof LegacyToken) {
                 $this->tokenStorage->setToken(new LegacyToken($token));
             }
         }
     } catch (NotFoundException $e) {
         // Invalid user ID, the user may have been removed => invalidate the token and the session.
         $this->tokenStorage->setToken(null);
         $session->invalidate();
     }
 }
开发者ID:emodric,项目名称:LegacyBridge,代码行数:31,代码来源:RequestListener.php

示例3: onSiteAccessMatch

 public function onSiteAccessMatch(PostSiteAccessMatchEvent $event)
 {
     $rootLocationId = $this->configResolver->getParameter('content.tree_root.location_id');
     $this->urlAliasRouter->setRootLocationId($rootLocationId);
     $this->urlAliasGenerator->setRootLocationId($rootLocationId);
     $this->urlAliasGenerator->setExcludedUriPrefixes($this->configResolver->getParameter('content.tree_root.excluded_uri_prefixes'));
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:7,代码来源:RoutingListener.php

示例4: getContentDecorator

 /**
  * @param Location $location
  * @return mixed
  */
 public function getContentDecorator(Location $location)
 {
     $mappingEntities = $this->configResolver->getParameter('class_mapping', 'ezcontentdecorator');
     $contentTypeIdentifier = $this->repository->getContentTypeService()->loadContentType($location->contentInfo->contentTypeId)->identifier;
     $className = array_key_exists($contentTypeIdentifier, $mappingEntities) ? $mappingEntities[$contentTypeIdentifier] : $this->defaultClassName;
     return new $className($this->container, $location, $contentTypeIdentifier);
 }
开发者ID:truffo,项目名称:ez-content-decorator-bundle,代码行数:11,代码来源:ContentDecoratorFactory.php

示例5: getParameter

 public function getParameter($parameterName, $defaultValue = null)
 {
     if ($this->configResolver->hasParameter($parameterName)) {
         return $this->configResolver->getParameter($parameterName);
     }
     return $defaultValue;
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:7,代码来源:CachedValue.php

示例6: matchRequest

 /**
  * Tries to match a request with a set of routes.
  *
  * If the matcher can not find information, it must throw one of the exceptions documented
  * below.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request The request to match
  *
  * @return array An array of parameters
  *
  * @throws \Symfony\Component\Routing\Exception\ResourceNotFoundException If no matching resource could be found
  */
 public function matchRequest(Request $request)
 {
     if ($this->configResolver->getParameter('routing.enable_tag_router', 'eztags') === false) {
         throw new ResourceNotFoundException('Config says to bypass TagRouter');
     }
     $requestedPath = rawurldecode($request->attributes->get('semanticPathinfo', $request->getPathInfo()));
     $pathPrefix = $this->generator->getPathPrefix();
     if (mb_stripos($requestedPath, $pathPrefix) !== 0) {
         throw new ResourceNotFoundException();
     }
     $requestedPath = $this->removePathPrefix($requestedPath, $pathPrefix);
     $requestedPath = trim($requestedPath, '/');
     if (empty($requestedPath)) {
         throw new ResourceNotFoundException();
     }
     $languages = $this->configResolver->getParameter('languages');
     $tag = $this->tagsService->sudo(function (TagsService $tagsService) use($requestedPath, $languages) {
         return $tagsService->loadTagByUrl($requestedPath, $languages);
     });
     // We specifically pass tag ID so tag view builder will reload the tag and check for permissions
     // Unfortunately, since at this point user is still anonymous (why!?), this is the best we can do
     $params = array('_route' => self::TAG_URL_ROUTE_NAME, '_controller' => static::TAG_VIEW_ACTION_CONTROLLER, 'tagId' => $tag->id);
     $request->attributes->set('tagId', $tag->id);
     if ($this->logger !== null) {
         $this->logger->info("TagRouter matched tag #{$tag->id}. Forwarding to tag view controller");
     }
     return $params;
 }
开发者ID:netgen,项目名称:tagsbundle,代码行数:40,代码来源:TagRouter.php

示例7: __construct

 public function __construct(EngineInterface $templateEngine, ConfigResolverInterface $configResolver, RequestStack $requestStack)
 {
     $this->templateEngine = $templateEngine;
     $this->legacyLayout = $configResolver->getParameter('module_default_layout', 'ezpublish_legacy');
     $this->legacyMode = $configResolver->getParameter('legacy_mode');
     $this->requestStack = $requestStack;
 }
开发者ID:emodric,项目名称:LegacyBridge,代码行数:7,代码来源:LegacyResponseManager.php

示例8: handle

 public function handle(GetResponseEvent $event)
 {
     // In legacy_mode, "remember me" must be delegated to legacy kernel.
     if ($this->configResolver->getParameter('legacy_mode')) {
         return;
     }
     parent::handle($event);
 }
开发者ID:emodric,项目名称:LegacyBridge,代码行数:8,代码来源:RememberMeListener.php

示例9: buildRepository

 /**
  * Builds the main repository, heart of eZ Publish API
  *
  * This always returns the true inner Repository, please depend on ezpublish.api.repository and not this method
  * directly to make sure you get an instance wrapped inside Signal / Cache / * functionality.
  *
  * @param \eZ\Publish\SPI\Persistence\Handler $persistenceHandler
  *
  * @return \eZ\Publish\API\Repository\Repository
  */
 public function buildRepository(PersistenceHandler $persistenceHandler)
 {
     $repository = new $this->repositoryClass($persistenceHandler, array('fieldType' => $this->fieldTypeCollectionFactory->getFieldTypes(), 'role' => array('limitationTypes' => $this->roleLimitations), 'languages' => $this->configResolver->getParameter('languages')));
     /** @var \eZ\Publish\API\Repository\Repository $repository */
     $anonymousUser = $repository->getUserService()->loadUser($this->configResolver->getParameter("anonymous_user_id"));
     $repository->setCurrentUser($anonymousUser);
     return $repository;
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:18,代码来源:RepositoryFactory.php

示例10: getForwardRequest

 protected function getForwardRequest(Location $location, Content $content, SiteAccess $previewSiteAccess)
 {
     $request = parent::getForwardRequest($location, $content, $previewSiteAccess);
     // If the preview siteaccess is configured in legacy_mode, we forward to the LegacyKernelController.
     if ($this->configResolver->getParameter('legacy_mode', 'ezsettings', $previewSiteAccess->name)) {
         $request->attributes->set('_controller', 'ezpublish_legacy.controller:indexAction');
     }
     return $request;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:9,代码来源:PreviewController.php

示例11: onSiteAccessMatch

 public function onSiteAccessMatch(PostSiteAccessMatchEvent $event)
 {
     if (!($event->getRequestType() === HttpKernelInterface::MASTER_REQUEST && isset($this->session) && !$this->session->isStarted() && $this->sessionStorage instanceof NativeSessionStorage)) {
         return;
     }
     $sessionOptions = (array) $this->configResolver->getParameter('session');
     $sessionName = isset($sessionOptions['name']) ? $sessionOptions['name'] : $this->session->getName();
     $sessionOptions['name'] = $this->getSessionName($sessionName, $event->getSiteAccess());
     $this->sessionStorage->setOptions($sessionOptions);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:10,代码来源:SessionSetDynamicNameListener.php

示例12: showShareButtons

 /**
  * Renders share buttons bar template based on user settings.
  *
  * @param \Twig_Environment $twigEnvironment
  * @param array $options
  * @param string[] $providers
  *
  * @return string
  */
 public function showShareButtons(Twig_Environment $twigEnvironment, array $options = array(), array $providers = array())
 {
     $this->shareButtonsRenderer->setTemplateEngine($twigEnvironment);
     if (isset($providers)) {
         $options['providers'] = $providers;
     }
     if (!isset($options['template'])) {
         $options['template'] = $this->configResolver->getParameter('template', 'ez_share_buttons');
     }
     return $twigEnvironment->render(sprintf('EzSystemsShareButtonsBundle::%s.html.twig', $options['template']), array('shareButtons' => $this->shareButtonsRenderer->render($options)));
 }
开发者ID:ezsystems,项目名称:EzSystemsShareButtonsBundle,代码行数:20,代码来源:ShareButtonsExtension.php

示例13: loginAction

 public function loginAction()
 {
     $session = $this->request->getSession();
     if ($this->request->attributes->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
         $error = $this->request->attributes->get(SecurityContextInterface::AUTHENTICATION_ERROR);
     } else {
         $error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
         $session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
     }
     $csrfToken = isset($this->csrfProvider) ? $this->csrfProvider->generateCsrfToken('authenticate') : null;
     return new Response($this->templateEngine->render($this->configResolver->getParameter('security.login_template'), array('last_username' => $session->get(SecurityContextInterface::LAST_USERNAME), 'error' => $error, 'csrf_token' => $csrfToken, 'layout' => $this->configResolver->getParameter('security.base_layout'))));
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:12,代码来源:SecurityController.php

示例14: displayGalleryAction

 /**
  * Displays the gallery.
  *
  * @param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function displayGalleryAction(ContentView $view, Request $request)
 {
     $languages = $this->configResolver->getParameter('languages');
     $location = $view->getLocation();
     $query = new Query();
     $query->query = $this->childrenCriteria->generateChildCriterion($location, $languages);
     $pager = new Pagerfanta(new ContentSearchAdapter($query, $this->searchService));
     $pager->setMaxPerPage($this->galleryImagesLimit);
     $pager->setCurrentPage($request->get('page', 1));
     $view->addParameters(['location' => $location, 'content' => $this->contentService->loadContentByContentInfo($view->getLocation()->getContentInfo()), 'images' => $pager]);
     return $view;
 }
开发者ID:clash82,项目名称:ezplatform-demo,代码行数:20,代码来源:GalleryController.php

示例15: yuiConfigLoaderFunction

 /**
  * Returns the YUI loader configuration.
  *
  * @param string $configObject
  *
  * @return string
  */
 public function yuiConfigLoaderFunction($configObject = '')
 {
     $modules = array_fill_keys($this->configResolver->getParameter('yui.modules', 'ez_platformui'), true);
     $yui = ['filter' => $this->configResolver->getParameter('yui.filter', 'ez_platformui'), 'modules' => []];
     $combine = $this->configResolver->getParameter('yui.combine', 'ez_platformui');
     if ($combine === true) {
         $yui['combine'] = true;
         $yui['root'] = '';
         $yui['comboBase'] = $this->router->generate('yui_combo_loader') . '?';
     }
     foreach (array_keys($modules) as $module) {
         if (!isset($yui['modules'][$module]['requires'])) {
             $yui['modules'][$module]['requires'] = [];
         }
         // Module dependencies
         if ($this->configResolver->hasParameter("yui.modules.{$module}.requires", 'ez_platformui')) {
             $yui['modules'][$module]['requires'] = array_merge($yui['modules'][$module]['requires'], $this->configResolver->getParameter("yui.modules.{$module}.requires", 'ez_platformui'));
         }
         // Reverse dependencies
         if ($this->configResolver->hasParameter("yui.modules.{$module}.dependencyOf", 'ez_platformui')) {
             foreach ($this->configResolver->getParameter("yui.modules.{$module}.dependencyOf", 'ez_platformui') as $dep) {
                 // Add reverse dependency only if referred module is declared in the modules list.
                 if (!isset($modules[$dep])) {
                     if ($this->logger) {
                         $this->logger->error("'{$module}' is declared to be a dependency of undeclared module '{$dep}'. Ignoring.");
                     }
                     continue;
                 }
                 $yui['modules'][$dep]['requires'][] = $module;
             }
         }
         if ($combine === true) {
             $yui['modules'][$module]['combine'] = true;
         }
         if ($this->configResolver->getParameter("yui.modules.{$module}.type", 'ez_platformui') === 'template') {
             $yui['modules'][$module]['requires'][] = 'template';
             $yui['modules'][$module]['requires'][] = 'handlebars';
             $yui['modules'][$module]['fullpath'] = $this->router->generate('template_yui_module', ['module' => $module]);
         } else {
             $yui['modules'][$module]['fullpath'] = $this->asset($this->configResolver->getParameter("yui.modules.{$module}.path", 'ez_platformui'));
         }
     }
     // Now ensure that all requirements are unique
     foreach ($yui['modules'] as &$moduleConfig) {
         $moduleConfig['requires'] = array_unique($moduleConfig['requires']);
     }
     $res = '';
     if ($configObject != '') {
         $res = $configObject . ' = ';
     }
     return $res . (defined('JSON_UNESCAPED_SLASHES') ? json_encode($yui, JSON_UNESCAPED_SLASHES) : json_encode($yui)) . ';';
 }
开发者ID:yed30,项目名称:PlatformUIBundle,代码行数:59,代码来源:TwigYuiExtension.php


注:本文中的eZ\Publish\Core\MVC\ConfigResolverInterface::getParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。