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


PHP SiteRepository::findOnline方法代码示例

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


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

示例1: searchForNodeAction

 /**
  * @param string $searchWord
  * @param Site $selectedSite
  * @return void
  */
 public function searchForNodeAction($searchWord, Site $selectedSite = NULL)
 {
     $documentNodeTypes = $this->nodeTypeManager->getSubNodeTypes('TYPO3.Neos:Document');
     $shortcutNodeType = $this->nodeTypeManager->getNodeType('TYPO3.Neos:Shortcut');
     $nodeTypes = array_diff($documentNodeTypes, array($shortcutNodeType));
     $sites = array();
     $activeSites = $this->siteRepository->findOnline();
     foreach ($selectedSite ? array($selectedSite) : $activeSites as $site) {
         /** @var Site $site */
         $contextProperties = array('workspaceName' => 'live', 'currentSite' => $site);
         $contentDimensionPresets = $this->contentDimensionPresetSource->getAllPresets();
         if (count($contentDimensionPresets) > 0) {
             $mergedContentDimensions = array();
             foreach ($contentDimensionPresets as $contentDimensionIdentifier => $contentDimension) {
                 $mergedContentDimensions[$contentDimensionIdentifier] = array($contentDimension['default']);
                 foreach ($contentDimension['presets'] as $contentDimensionPreset) {
                     $mergedContentDimensions[$contentDimensionIdentifier] = array_merge($mergedContentDimensions[$contentDimensionIdentifier], $contentDimensionPreset['values']);
                 }
                 $mergedContentDimensions[$contentDimensionIdentifier] = array_values(array_unique($mergedContentDimensions[$contentDimensionIdentifier]));
             }
             $contextProperties['dimensions'] = $mergedContentDimensions;
         }
         /** @var ContentContext $liveContext */
         $liveContext = $this->contextFactory->create($contextProperties);
         $firstActiveDomain = $site->getFirstActiveDomain();
         $nodes = $this->nodeSearchService->findByProperties($searchWord, $nodeTypes, $liveContext, $liveContext->getCurrentSiteNode());
         if (count($nodes) > 0) {
             $sites[$site->getNodeName()] = array('site' => $site, 'domain' => $firstActiveDomain ? $firstActiveDomain->getHostPattern() : $this->request->getHttpRequest()->getUri()->getHost(), 'nodes' => $nodes);
         }
     }
     $this->view->assignMultiple(array('searchWord' => $searchWord, 'protocol' => $this->request->getHttpRequest()->getUri()->getScheme(), 'selectedSite' => $selectedSite, 'sites' => $sites, 'activeSites' => $activeSites));
 }
开发者ID:christophlehmann,项目名称:MOC.Varnish,代码行数:37,代码来源:VarnishCacheController.php

示例2: buildSiteList

 /**
  * Build a list of sites
  *
  * @param ControllerContext $controllerContext
  * @return array
  */
 public function buildSiteList(ControllerContext $controllerContext)
 {
     $requestUriHost = $controllerContext->getRequest()->getHttpRequest()->getUri()->getHost();
     $domainsFound = false;
     $sites = array();
     foreach ($this->siteRepository->findOnline() as $site) {
         $uri = null;
         $active = false;
         /** @var $site Site */
         if ($site->hasActiveDomains()) {
             $activeHostPatterns = $site->getActiveDomains()->map(function ($domain) {
                 return $domain->getHostPattern();
             })->toArray();
             $active = in_array($requestUriHost, $activeHostPatterns, true);
             if ($active) {
                 $uri = $controllerContext->getUriBuilder()->reset()->setCreateAbsoluteUri(true)->uriFor('index', array(), 'Backend\\Backend', 'TYPO3.Neos');
             } else {
                 $uri = $controllerContext->getUriBuilder()->reset()->uriFor('switchSite', array('site' => $site), 'Backend\\Backend', 'TYPO3.Neos');
             }
             $domainsFound = true;
         }
         $sites[] = array('name' => $site->getName(), 'nodeName' => $site->getNodeName(), 'uri' => $uri, 'active' => $active);
     }
     if ($domainsFound === false) {
         $uri = $controllerContext->getUriBuilder()->reset()->setCreateAbsoluteUri(true)->uriFor('index', array(), 'Backend\\Backend', 'TYPO3.Neos');
         $sites[0]['uri'] = $uri;
     }
     return $sites;
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:35,代码来源:MenuHelper.php

示例3: buildSiteList

 /**
  * Build a list of sites
  *
  * @param \TYPO3\Flow\Mvc\Controller\ControllerContext $controllerContext
  * @return array
  */
 public function buildSiteList(ControllerContext $controllerContext)
 {
     $requestUri = $controllerContext->getRequest()->getHttpRequest()->getUri();
     $baseUri = $controllerContext->getRequest()->getHttpRequest()->getBaseUri();
     $domainsFound = FALSE;
     $sites = array();
     foreach ($this->siteRepository->findOnline() as $site) {
         $uri = NULL;
         /** @var $site \TYPO3\Neos\Domain\Model\Site */
         if ($site->hasActiveDomains()) {
             $uri = $controllerContext->getUriBuilder()->reset()->uriFor('index', array(), 'Backend\\Backend', 'TYPO3.Neos');
             $uri = sprintf('%s://%s%s%s', $requestUri->getScheme(), $site->getFirstActiveDomain()->getHostPattern(), rtrim($baseUri->getPath(), '/'), $uri);
             $domainsFound = TRUE;
         }
         $sites[] = array('name' => $site->getName(), 'nodeName' => $site->getNodeName(), 'uri' => $uri, 'active' => parse_url($uri, PHP_URL_HOST) === $requestUri->getHost() ? TRUE : FALSE);
     }
     if ($domainsFound === FALSE) {
         $uri = $controllerContext->getUriBuilder()->reset()->setCreateAbsoluteUri(TRUE)->uriFor('index', array(), 'Backend\\Backend', 'TYPO3.Neos');
         $sites[0]['uri'] = $uri;
     }
     return $sites;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:28,代码来源:MenuHelper.php


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