本文整理汇总了PHP中eZ\Publish\Core\MVC\ConfigResolverInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ConfigResolverInterface类的具体用法?PHP ConfigResolverInterface怎么用?PHP ConfigResolverInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigResolverInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->ioServiceMock = $this->getMock('eZ\\Publish\\Core\\IO\\IOServiceInterface');
$this->configResolverMock = $this->getMock('eZ\\Publish\\Core\\MVC\\ConfigResolverInterface');
$this->configResolverMock->expects($this->any())->method('getParameter')->with('io.url_prefix')->will($this->returnValue($this->ioUriPrefix));
$this->eventListener = new StreamFileListener($this->ioServiceMock, $this->configResolverMock);
}
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:7,代码来源:StreamFileListenerTest.php
示例2: __construct
/**
* @param \eZ\Publish\Core\MVC\Symfony\Matcher\MatcherFactoryInterface $matcherFactory
* @param \eZ\Publish\Core\MVC\ConfigResolverInterface $configResolver
* @param \eZ\Publish\API\Repository\ContentService $contentService
* @param ProviderInterface[] Comments providers, indexed by their label.
* @param string|null $defaultProvider Label of provider to use by default. If not provided, the first entry in $providers will be used.
*/
public function __construct(MatcherFactoryInterface $matcherFactory, ConfigResolverInterface $configResolver, ContentService $contentService, array $providers = array(), $defaultProvider = null)
{
$this->matcherFactory = $matcherFactory;
$this->providers = $providers;
$this->setDefaultProviderLabel($defaultProvider ?: $configResolver->getParameter('default_provider', 'ez_comments'));
$this->contentService = $contentService;
}
开发者ID:michalpipa,项目名称:CommentsBundle,代码行数:14,代码来源:CommentsRenderer.php
示例3: __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
示例4: setConfigResolver
/**
* Injects the ConfigResolver to potentially override default_target_path for redirections after authentication success.
*
* @param ConfigResolverInterface $configResolver
*/
public function setConfigResolver(ConfigResolverInterface $configResolver)
{
$defaultPage = $configResolver->getParameter('default_page');
if ($defaultPage !== null) {
$this->options['default_target_path'] = $defaultPage;
}
}
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:12,代码来源:DefaultAuthenticationSuccessHandler.php
示例5: 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
示例6: setUp
public function setUp()
{
$this->configResolver = $this->getMockBuilder('\\eZ\\Publish\\Core\\MVC\\ConfigResolverInterface')->getMock();
$this->configResolver->method('getParameter')->willReturn('Tests/fixtures/template_module.js');
$this->templating = $this->getMockBuilder('\\Symfony\\Component\\Templating\\EngineInterface')->getMock();
$this->templating->method('render')->willReturn('template');
$this->comboLoader = new ComboLoader($this->configResolver, $this->templating, '/yui/', 'Tests/fixtures');
}
开发者ID:yed30,项目名称:PlatformUIBundle,代码行数:8,代码来源:ComboLoaderTest.php
示例7: buildService
/**
* Builds the page service.
*
* @param string $serviceClass the class of the page service
* @param ConfigResolverInterface $resolver
* @param \eZ\Publish\Core\FieldType\Page\PageStorage\Gateway $storageGateway
* @param \eZ\Publish\API\Repository\ContentService $contentService
*
* @return \eZ\Publish\Core\FieldType\Page\PageService
*/
public function buildService($serviceClass, ConfigResolverInterface $resolver, PageGateway $storageGateway, ContentService $contentService)
{
$pageSettings = $resolver->getParameter('ezpage');
/** @var $pageService \eZ\Publish\Core\FieldType\Page\PageService */
$pageService = new $serviceClass($contentService, $pageSettings['layouts'], $pageSettings['blocks']);
$pageService->setStorageGateway($storageGateway);
return $pageService;
}
开发者ID:ezsystems,项目名称:ezplatform-page-fieldtype,代码行数:18,代码来源:PageServiceFactory.php
示例8: __construct
public function __construct(\Closure $kernelClosure, ConfigResolverInterface $configResolver, URIHelper $uriHelper, LegacyResponseManager $legacyResponseManager, LegacyHelper $legacyHelper, RouterInterface $router)
{
$this->kernelClosure = $kernelClosure;
$this->legacyLayout = $configResolver->getParameter('module_default_layout', 'ezpublish_legacy');
$this->configResolver = $configResolver;
$this->uriHelper = $uriHelper;
$this->legacyResponseManager = $legacyResponseManager;
$this->legacyHelper = $legacyHelper;
$this->router = $router;
}
开发者ID:mclone,项目名称:ez5-project-bootstrap,代码行数:10,代码来源:LegacyKernelController.php
示例9: 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();
if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST || !$this->configResolver->getParameter('legacy_mode') || !$request->getSession()->has('eZUserLoggedInID')) {
return;
}
$apiUser = $this->repository->getUserService()->loadUser($request->getSession()->get('eZUserLoggedInID'));
$this->repository->setCurrentUser($apiUser);
$token = $this->securityContext->getToken();
if ($token instanceof TokenInterface) {
$token->setUser(new User($apiUser));
$token->setAuthenticated(true);
}
}
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:21,代码来源:RequestListener.php
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: 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
示例15: 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
示例16: 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
示例17: 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
示例18: 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
示例19: testMatchRequestRegularPathinfo
public function testMatchRequestRegularPathinfo()
{
$matchedParameters = array('_controller' => 'AcmeBundle:myAction');
$pathinfo = '/siteaccess/foo/bar';
$request = Request::create($pathinfo);
$this->configResolver->expects($this->never())->method('getParameter');
/** @var \PHPUnit_Framework_MockObject_MockObject|DefaultRouter $router */
$router = $this->generateRouter(array('match'));
$router->expects($this->once())->method('match')->with($pathinfo)->will($this->returnValue($matchedParameters));
$this->assertSame($matchedParameters, $router->matchRequest($request));
}
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:11,代码来源:DefaultRouterTest.php
示例20: 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
注:本文中的eZ\Publish\Core\MVC\ConfigResolverInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论