本文整理汇总了PHP中ApacheSolrForTypo3\Solr\Util::initializeTsfe方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::initializeTsfe方法的具体用法?PHP Util::initializeTsfe怎么用?PHP Util::initializeTsfe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApacheSolrForTypo3\Solr\Util
的用法示例。
在下文中一共展示了Util::initializeTsfe方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
Util::initializeTsfe('1');
$GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
$GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['targetPage'] = '0';
$GLOBALS['TSFE']->tmpl->setup['config.']['tx_realurl_enable'] = '0';
// setup up ts objects
$GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['detailPage'] = 5050;
$GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['renderObjects.'] = array('testContent' => 'TEXT', 'testContent.' => array('field' => 'argument_0'), 'testContent2' => 'TEXT', 'testContent2.' => array('field' => 'argument_1', 'stripHtml' => 1));
$this->fixtures = array('argument content', '<span>argument content with html</span>', 'third argument content');
$this->viewHelper = new Ts();
}
示例2: setUp
public function setUp()
{
Util::initializeTsfe('1');
$GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
$GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['targetPage'] = '0';
$GLOBALS['TSFE']->tmpl->setup['config.']['tx_realurl_enable'] = '0';
$facetName = 'TestFacet';
$facetOptions = array('testoption' => 1);
$facetConfiguration = array('selectingSelectedFacetOptionRemovesFilter' => 0, 'renderingInstruction');
$parentPlugin = GeneralUtility::makeInstance('Tx_Solr_PiResults_Results');
$parentPlugin->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$parentPlugin->main('', array());
$query = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Query', array('test'));
$this->facetRenderer = GeneralUtility::makeInstance('Tx_Solr_Facet_SimpleFacetRenderer', $facetName, $facetOptions, $facetConfiguration, $parentPlugin->getTemplate(), $query);
$this->facetRenderer->setLinkTargetPageId($parentPlugin->getLinkTargetPageId());
}
示例3: getSysLanguageMode
/**
* Gets the site's config.sys_language_mode setting
*
* @return string The site's config.sys_language_mode
*/
public function getSysLanguageMode()
{
if (is_null($this->sysLanguageMode)) {
Util::initializeTsfe($this->getRootPageId());
$this->sysLanguageMode = $GLOBALS['TSFE']->sys_language_mode;
}
return $this->sysLanguageMode;
}
示例4: getFullItemRecord
/**
* Gets the full item record.
*
* This general record indexer simply gets the record from the item. Other
* more specialized indexers may provide more data for their specific item
* types.
*
* @param Item $item The item to be indexed
* @param integer $language Language Id (sys_language.uid)
* @return array|NULL The full record with fields of data to be used for indexing or NULL to prevent an item from being indexed
*/
protected function getFullItemRecord(Item $item, $language = 0)
{
$rootPageUid = $item->getRootPageUid();
$overlayIdentifier = $rootPageUid . '|' . $language;
if (!isset($this->sysLanguageOverlay[$overlayIdentifier])) {
Util::initializeTsfe($rootPageUid, $language);
$this->sysLanguageOverlay[$overlayIdentifier] = $GLOBALS['TSFE']->sys_language_contentOL;
}
$itemRecord = $item->getRecord();
if ($language > 0) {
$page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$page->init(FALSE);
$itemRecord = $page->getRecordOverlay($item->getType(), $itemRecord, $language, $this->sysLanguageOverlay[$rootPageUid . '|' . $language]);
}
if (!$itemRecord) {
$itemRecord = NULL;
}
/*
* Skip disabled records. This happens if the default language record
* is hidden but a certain translation isn't. Then the default language
* document appears here but must not be indexed.
*/
if (!empty($GLOBALS['TCA'][$item->getType()]['ctrl']['enablecolumns']['disabled']) && $itemRecord[$GLOBALS['TCA'][$item->getType()]['ctrl']['enablecolumns']['disabled']]) {
$itemRecord = NULL;
}
/*
* Skip translation mismatching records. Sometimes the requested language
* doesn't fit the returned language. This might happen with content fallback
* and is perfectly fine in general.
* But if the requested language doesn't match the returned language and
* the given record has no translation parent, the indexqueue_item most
* probably pointed to a non-translated language record that is dedicated
* to a very specific language. Now we have to avoid indexing this record
* into all language cores.
*/
$translationOriginalPointerField = 'l10n_parent';
if (!empty($GLOBALS['TCA'][$item->getType()]['ctrl']['transOrigPointerField'])) {
$translationOriginalPointerField = $GLOBALS['TCA'][$item->getType()]['ctrl']['transOrigPointerField'];
}
$languageField = $GLOBALS['TCA'][$item->getType()]['ctrl']['languageField'];
if ($itemRecord[$translationOriginalPointerField] == 0 && $this->sysLanguageOverlay[$overlayIdentifier] != 1 && !empty($languageField) && $itemRecord[$languageField] != $language && $itemRecord[$languageField] != '-1') {
$itemRecord = NULL;
}
if (!is_null($itemRecord)) {
$itemRecord['__solr_index_language'] = $language;
}
return $itemRecord;
}
示例5: getConfigIndexEnableStatus
/**
* Checks whether config.index_enable is set to 1, otherwise indexing will
* not work.
*
* @return NULL|Status An error status is returned for each site root page config.index_enable = 0.
*/
protected function getConfigIndexEnableStatus()
{
$status = null;
$rootPages = $this->getRootPages();
$rootPagesWithIndexingOff = array();
foreach ($rootPages as $rootPage) {
try {
Util::initializeTsfe($rootPage['uid']);
if (!$GLOBALS['TSFE']->config['config']['index_enable']) {
$rootPagesWithIndexingOff[] = $rootPage;
}
} catch (\RuntimeException $rte) {
$rootPagesWithIndexingOff[] = $rootPage;
} catch (ServiceUnavailableException $sue) {
if ($sue->getCode() == 1294587218) {
// No TypoScript template found, continue with next site
$rootPagesWithIndexingOff[] = $rootPage;
continue;
}
}
}
if (!empty($rootPagesWithIndexingOff)) {
foreach ($rootPagesWithIndexingOff as $key => $rootPageWithIndexingOff) {
$rootPagesWithIndexingOff[$key] = '[' . $rootPageWithIndexingOff['uid'] . '] ' . $rootPageWithIndexingOff['title'];
}
$status = GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', 'Page Indexing', 'Indexing is disabled', 'You need to set config.index_enable = 1 to allow page indexing.
The following sites were found with indexing disabled:
<ul><li>' . implode('</li><li>', $rootPagesWithIndexingOff) . '</li></ul>', Status::ERROR);
}
return $status;
}