本文整理汇总了PHP中TYPO3\Neos\Domain\Repository\SiteRepository::findFirstOnline方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteRepository::findFirstOnline方法的具体用法?PHP SiteRepository::findFirstOnline怎么用?PHP SiteRepository::findFirstOnline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Neos\Domain\Repository\SiteRepository
的用法示例。
在下文中一共展示了SiteRepository::findFirstOnline方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareContextProperties
/**
* Additionally add the current site and domain to the Context properties.
*
* {@inheritdoc}
*/
protected function prepareContextProperties($workspaceName, \TYPO3\Flow\Property\PropertyMappingConfigurationInterface $configuration = null, array $dimensions = null)
{
$contextProperties = parent::prepareContextProperties($workspaceName, $configuration, $dimensions);
$currentDomain = $this->domainRepository->findOneByActiveRequest();
if ($currentDomain !== null) {
$contextProperties['currentSite'] = $currentDomain->getSite();
$contextProperties['currentDomain'] = $currentDomain;
} else {
$contextProperties['currentSite'] = $this->siteRepository->findFirstOnline();
}
return $contextProperties;
}
示例2: indexAction
/**
* Default action, displays the login screen
*
* @param string $username Optional: A username to pre-fill into the username field
* @param boolean $unauthorized
* @return void
*/
public function indexAction($username = null, $unauthorized = false)
{
if ($this->securityContext->getInterceptedRequest() || $unauthorized) {
$this->response->setStatus(401);
}
if ($this->authenticationManager->isAuthenticated()) {
$this->redirect('index', 'Backend\\Backend');
}
$currentDomain = $this->domainRepository->findOneByActiveRequest();
$currentSite = $currentDomain !== null ? $currentDomain->getSite() : $this->siteRepository->findFirstOnline();
$this->view->assignMultiple(array('username' => $username, 'site' => $currentSite));
}
示例3: createContentContext
/**
* Create a ContentContext based on the given workspace name
*
* @param string $workspaceName Name of the workspace to set for the context
* @param array $dimensions Optional list of dimensions and their values which should be set
* @return \TYPO3\Neos\Domain\Service\ContentContext
*/
protected function createContentContext($workspaceName, array $dimensions = array())
{
$contextProperties = array('workspaceName' => $workspaceName, 'invisibleContentShown' => true, 'inaccessibleContentShown' => true);
if ($dimensions !== array()) {
$contextProperties['dimensions'] = $dimensions;
$contextProperties['targetDimensions'] = array_map(function ($dimensionValues) {
return array_shift($dimensionValues);
}, $dimensions);
}
$currentDomain = $this->_domainRepository->findOneByActiveRequest();
if ($currentDomain !== null) {
$contextProperties['currentSite'] = $currentDomain->getSite();
$contextProperties['currentDomain'] = $currentDomain;
} else {
$contextProperties['currentSite'] = $this->_siteRepository->findFirstOnline();
}
return $this->_contextFactory->create($contextProperties);
}
示例4: getNodes
/**
* @param ACLCheckerDto $dto
* @return array
*/
protected function getNodes(ACLCheckerDto $dto)
{
$context = $this->createContext();
$site = $this->siteRepository->findFirstOnline();
$startNode = $context->getNode('/sites/' . $site->getNodeName());
$roles = $this->getRolesByDto($dto);
$nodes = [];
$this->getChildNodeData($nodes, $startNode, $roles, $dto->getNodeTreeLoadingDepth());
return $nodes;
}
示例5: setDefaultSiteAndDomainFromCurrentRequest
/**
* Determines the current domain and site from the request and sets the resulting values as
* as defaults.
*
* @param array $defaultContextProperties
* @return array
*/
protected function setDefaultSiteAndDomainFromCurrentRequest(array $defaultContextProperties)
{
$currentDomain = $this->domainRepository->findOneByActiveRequest();
if ($currentDomain !== null) {
$defaultContextProperties['currentSite'] = $currentDomain->getSite();
$defaultContextProperties['currentDomain'] = $currentDomain;
} else {
$defaultContextProperties['currentSite'] = $this->siteRepository->findFirstOnline();
}
return $defaultContextProperties;
}
示例6: buildContextFromWorkspaceNameAndDimensions
/**
* Sets context properties like "invisibleContentShown" according to the workspace (live or not) and returns a
* ContentContext object.
*
* @param string $workspaceName Name of the workspace to use in the context
* @param array $dimensionsAndDimensionValues An array of dimension names (index) and their values (array of strings). See also: ContextFactory
* @return ContentContext
*/
protected function buildContextFromWorkspaceNameAndDimensions($workspaceName, array $dimensionsAndDimensionValues)
{
$contextProperties = array('workspaceName' => $workspaceName, 'invisibleContentShown' => $workspaceName !== 'live', 'inaccessibleContentShown' => $workspaceName !== 'live', 'dimensions' => $dimensionsAndDimensionValues);
$currentDomain = $this->domainRepository->findOneByActiveRequest();
if ($currentDomain !== NULL) {
$contextProperties['currentSite'] = $currentDomain->getSite();
$contextProperties['currentDomain'] = $currentDomain;
} else {
$contextProperties['currentSite'] = $this->siteRepository->findFirstOnline();
}
return $this->contextFactory->create($contextProperties);
}
示例7: createContext
/**
* Create a ContentContext to be used for the backend redirects.
*
* @param string $workspaceName
* @return ContentContext
*/
protected function createContext($workspaceName)
{
$contextProperties = array('workspaceName' => $workspaceName, 'invisibleContentShown' => true, 'inaccessibleContentShown' => true);
$currentDomain = $this->domainRepository->findOneByActiveRequest();
if ($currentDomain !== null) {
$contextProperties['currentSite'] = $currentDomain->getSite();
$contextProperties['currentDomain'] = $currentDomain;
} else {
$contextProperties['currentSite'] = $this->siteRepository->findFirstOnline();
}
return $this->contextFactory->create($contextProperties);
}
示例8: createContext
/**
* Creates a new content context based on the given workspace and the NodeData object and additionally takes
* the current site and current domain into account.
*
* @param Workspace $workspace Workspace for the new context
* @param array $dimensionValues The dimension values for the new context
* @param array $contextProperties Additional pre-defined context properties
* @return Context
*/
protected function createContext(Workspace $workspace, array $dimensionValues, array $contextProperties = array())
{
if ($this->currentDomain === false) {
$this->currentDomain = $this->domainRepository->findOneByActiveRequest();
}
if ($this->currentDomain !== null) {
$contextProperties['currentSite'] = $this->currentDomain->getSite();
$contextProperties['currentDomain'] = $this->currentDomain;
} else {
if ($this->currentSite === false) {
$this->currentSite = $this->siteRepository->findFirstOnline();
}
$contextProperties['currentSite'] = $this->currentSite;
}
return parent::createContext($workspace, $dimensionValues, $contextProperties);
}
示例9: isNodeTypeInAllowedSite
/**
* @param NodeType $nodetype
* @return boolean
*/
private function isNodeTypeInAllowedSite(NodeType $nodetype)
{
// dont restrict abstract nodes
if ($nodetype->isAbstract()) {
return true;
}
$deniedWilcard = false;
$allowedSites = $nodetype->getConfiguration('allowedSites');
if ($allowedSites) {
$currentDomain = $this->domainRepository->findOneByActiveRequest();
if ($currentDomain !== null) {
$currentSite = $currentDomain->getSite();
} else {
$currentSite = $this->siteRepository->findFirstOnline();
}
if (!$currentSite) {
return true;
}
foreach ($allowedSites as $siteName => $allowed) {
if ($allowed == TRUE && $siteName == '*' | $currentSite->getSiteResourcesPackageKey() == $siteName) {
return true;
}
if ($allowed == FALSE && $currentSite->getSiteResourcesPackageKey() == $siteName) {
return false;
}
if ($allowed == TRUE && $siteName == '*') {
$deniedWilcard = false;
}
if ($allowed == FALSE && $siteName == '*') {
$deniedWilcard = true;
}
}
if ($deniedWilcard == true) {
return false;
}
}
return true;
}
示例10: createContentContext
/**
* @return void
*/
protected function createContentContext()
{
$domain = $this->domainRepository->findOneByActiveRequest();
$this->contentContext = new ContentContext('live', new \DateTime(), [], [], false, false, false, $domain ? $domain->getSite() : $this->siteRepository->findFirstOnline(), $domain);
}