本文整理汇总了PHP中ApacheSolrForTypo3\Solr\Site::getSiteByPageId方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::getSiteByPageId方法的具体用法?PHP Site::getSiteByPageId怎么用?PHP Site::getSiteByPageId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApacheSolrForTypo3\Solr\Site
的用法示例。
在下文中一共展示了Site::getSiteByPageId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPageToMountingSiteIndexQueue
/**
* Adds a page to the Index Queue of a site mounting the page.
*
* @param integer $mountedPageId ID (uid) of the mounted page.
* @param array $mountProperties Array of mount point properties mountPageSource, mountPageDestination, and mountPageOverlayed
*/
protected function addPageToMountingSiteIndexQueue($mountedPageId, array $mountProperties)
{
$mountingSite = Site::getSiteByPageId($mountProperties['mountPageDestination']);
$pageInitializer = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\IndexQueue\\Initializer\\Page');
$pageInitializer->setSite($mountingSite);
$pageInitializer->initializeMountedPage($mountProperties, $mountedPageId);
}
示例2: resolveSiteHashAllowedSites
/**
* Resolves magic keywords in allowed sites configuration.
* Supported keywords:
* __solr_current_site - The domain of the site the query has been started from
* __current_site - Same as __solr_current_site
* __all - Adds all domains as allowed sites
* * - Same as __all
*
* @param integer $pageId A page ID that is then resolved to the site it belongs to
* @param string $allowedSitesConfiguration TypoScript setting for allowed sites
* @return string List of allowed sites/domains, magic keywords resolved
*/
public static function resolveSiteHashAllowedSites($pageId, $allowedSitesConfiguration)
{
if ($allowedSitesConfiguration == '*' || $allowedSitesConfiguration == '__all') {
$sites = Site::getAvailableSites();
$domains = array();
foreach ($sites as $site) {
$domains[] = $site->getDomain();
}
$allowedSites = implode(',', $domains);
} else {
$allowedSites = str_replace(array('__solr_current_site', '__current_site'), Site::getSiteByPageId($pageId)->getDomain(), $allowedSitesConfiguration);
}
return $allowedSites;
}
示例3: getSiteHashFilterForTSFE
/**
* Retrieves the value that should be used for the SiteHash filter.
*
* @param TypoScriptFrontendController $TSFE
* @return string
*/
protected function getSiteHashFilterForTSFE(TypoScriptFrontendController $TSFE)
{
return Site::getSiteByPageId($TSFE->id)->getDomain();
}
示例4: getPageDocument
/**
* Builds the Solr document for the current page.
*
* @return \Apache_Solr_Document A document representing the page
*/
protected function getPageDocument()
{
$document = GeneralUtility::makeInstance('\\Apache_Solr_Document');
/* @var $document \Apache_Solr_Document */
$site = Site::getSiteByPageId($this->page->id);
$pageRecord = $this->page->page;
self::$pageSolrDocumentId = $documentId = Util::getPageDocumentId($this->page->id, $this->page->type, $this->page->sys_language_uid, $this->getDocumentIdGroups());
$document->setField('id', $documentId);
$document->setField('site', $site->getDomain());
$document->setField('siteHash', $site->getSiteHash());
$document->setField('appKey', 'EXT:solr');
$document->setField('type', 'pages');
// system fields
$document->setField('uid', $this->page->id);
$document->setField('pid', $pageRecord['pid']);
$document->setField('typeNum', $this->page->type);
$document->setField('created', $pageRecord['crdate']);
$document->setField('changed', $pageRecord['tstamp']);
$document->setField('rootline', $this->page->id);
// access
$document->setField('access', (string) $this->pageAccessRootline);
if ($this->page->page['endtime']) {
$document->setField('endtime', $pageRecord['endtime']);
}
// content
$document->setField('title', $this->contentExtractor->getPageTitle());
$document->setField('subTitle', $pageRecord['subtitle']);
$document->setField('navTitle', $pageRecord['nav_title']);
$document->setField('author', $pageRecord['author']);
$document->setField('description', $pageRecord['description']);
$document->setField('abstract', $pageRecord['abstract']);
$document->setField('content', $this->contentExtractor->getIndexableContent());
$document->setField('url', $this->pageUrl);
// keywords, multi valued
$keywords = array_unique(GeneralUtility::trimExplode(',', $pageRecord['keywords'], TRUE));
foreach ($keywords as $keyword) {
$document->addField('keywords', $keyword);
}
// content from several tags like headers, anchors, ...
$tagContent = $this->contentExtractor->getTagContent();
foreach ($tagContent as $fieldName => $fieldValue) {
$document->setField($fieldName, $fieldValue);
}
return $document;
}
示例5: setSiteAction
/**
* Sets the site to work with
*
* @param integer $site Site root page id
* @return void
*/
public function setSiteAction($site)
{
$site = Site::getSiteByPageId((int) $site);
$this->setSiteAndResetCore($site);
$this->forwardHome();
}
示例6: getTranslationOverlaysForPage
/**
* Finds the alternative page language overlay records for a page based on
* the sys_language_mode.
*
* Possible Language Modes:
* 1) content_fallback --> all languages
* 2) strict --> available languages with page overlay
* 3) ignore --> available languages with page overlay
* 4) unknown mode or blank --> all languages
*
* @param integer $pageId Page ID.
* @return array An array of translation overlays (or fake overlays) found for the given page.
*/
protected function getTranslationOverlaysForPage($pageId)
{
$translationOverlays = array();
$pageId = intval($pageId);
$site = Site::getSiteByPageId($pageId);
$languageModes = array('content_fallback', 'strict', 'ignore');
$hasOverlayMode = in_array($site->getSysLanguageMode(), $languageModes, TRUE);
$isContentFallbackMode = $site->getSysLanguageMode() === 'content_fallback';
if ($hasOverlayMode && !$isContentFallbackMode) {
$translationOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pid, sys_language_uid', 'pages_language_overlay', 'pid = ' . $pageId . BackendUtility::deleteClause('pages_language_overlay') . BackendUtility::BEenableFields('pages_language_overlay'));
} else {
// ! If no sys_language_mode is configured, all languages will be indexed !
$languages = BackendUtility::getSystemLanguages();
// remove default language (L = 0)
array_shift($languages);
foreach ($languages as $language) {
$translationOverlays[] = array('pid' => $pageId, 'sys_language_uid' => $language[1]);
}
}
return $translationOverlays;
}
示例7: resolveMountPageTree
/**
* Gets all the pages from a mounted page tree.
*
* @param integer $mountPageSourceId
* @return array An array of page IDs in the mounted page tree
*/
protected function resolveMountPageTree($mountPageSourceId)
{
$mountedSite = Site::getSiteByPageId($mountPageSourceId);
return $mountedSite->getPages($mountPageSourceId);
}
示例8: getIndexDocuments
/**
* Queries Solr for the current page's documents.
*
* @return array An array of Apache_Solr_Document objects
*/
protected function getIndexDocuments()
{
/* @var Query $query */
$query = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Query', '');
$query->setQueryType('standard');
$query->useRawQueryString(true);
$query->setQueryString('*:*');
$query->addFilter('(type:pages AND uid:' . $this->pageId . ') OR (*:* AND pid:' . $this->pageId . ' NOT type:pages)');
$query->addFilter('siteHash:' . Site::getSiteByPageId($this->pageId)->getSiteHash());
$query->setFieldList('*');
$query->setSorting('type asc, title asc');
$this->search->search($query, 0, 10000);
return $this->search->getResultDocumentsEscaped();
}
示例9: initializeAction
/**
* Initializes resources commonly needed for several actions
*
* @return void
*/
protected function initializeAction()
{
try {
$site = $this->request->getArgument('site');
if (is_numeric($site)) {
$siteRootPageId = $this->request->getArgument('site');
$this->site = Site::getSiteByPageId($siteRootPageId);
} else {
if ($site instanceof Site) {
$this->site = $site;
}
}
} catch (NoSuchArgumentException $nsae) {
$sites = Site::getAvailableSites();
$site = array_shift($sites);
$this->site = $site;
}
$this->request->setArgument('site', $this->site);
$moduleData = $this->moduleDataStorageService->loadModuleData();
$moduleData->setSite($this->site);
$this->moduleDataStorageService->persistModuleData($moduleData);
}
示例10: setSiteAction
/**
* Sets the site to work with
*
* @param integer $site Site root page id
* @return void
*/
public function setSiteAction($site)
{
$site = Site::getSiteByPageId((int) $site);
$this->moduleData->setSite($site);
// when switching the site, reset the core
$this->moduleData->setCore('');
$this->moduleDataStorageService->persistModuleData($this->moduleData);
$this->forwardHome();
}