2 namespace TYPO3\CMS\IndexedSearch\Controller;
167 if (is_array($this->settings[
'defaultOptions'])) {
171 $this->indexerConfig = unserialize(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXT'][
'extConf'][
'indexed_search']);
172 $this->enableMetaphoneSearch = (bool)$this->indexerConfig[
'enableMetaphoneSearch'];
192 $this->searchRootPageIdList = (int)
$GLOBALS[
'TSFE']->config[
'rootLine'][0][
'uid'];
201 if ($this->settings[
'rootPidList']) {
205 $this->searchRepository->initialize($this->settings,
$searchData, $this->externalParsers, $this->searchRootPageIdList);
208 if ($hookObj = $this->
hookRequest(
'initialize_postProc')) {
209 $hookObj->initialize_postProc();
226 if ($freeIndexUid == -2) {
227 $freeIndexUid = $this->settings[
'defaultFreeIndexUidList'];
233 $resultsets = array();
234 foreach ($indexCfgs as $freeIndexUid) {
237 if ($hookObj = $this->
hookRequest(
'getResultRows')) {
238 $resultData = $hookObj->getResultRows($this->searchWords, $freeIndexUid);
240 $resultData = $this->searchRepository->doSearch($this->searchWords, $freeIndexUid);
244 if ($hookObj = $this->
hookRequest(
'getDisplayResults')) {
245 $resultsets[$freeIndexUid] = $hookObj->getDisplayResults($this->searchWords, $resultData, $freeIndexUid);
247 $resultsets[$freeIndexUid] = $this->
getDisplayResults($this->searchWords, $resultData, $freeIndexUid);
251 if (count($indexCfgs) > 1) {
252 if ($freeIndexUid > 0) {
253 $indexCfgRec = $this->
getDatabaseConnection()->exec_SELECTgetSingleRow(
'title',
'index_config',
'uid=' . (
int)$freeIndexUid .
$GLOBALS[
'TSFE']->cObj->enableFields(
'index_config'));
254 $categoryTitle = $indexCfgRec[
'title'];
258 $resultsets[$freeIndexUid][
'categoryTitle'] = $categoryTitle;
263 $this->view->assign(
'resultsets', $resultsets);
265 $this->view->assign(
'searchWords', $this->searchWords);
283 'count' => $resultData[
'count'],
289 $this->firstRow = $resultData[
'firstRow'];
291 $result[
'rows'] = $this->
compileResultRows($resultData[
'resultRows'], $freeIndexUid);
294 if ($resultData[
'count']) {
296 if ($this->searchData[
'group'] ==
'sections' && $freeIndexUid <= 0) {
297 $resultSectionsCount = count($this->resultSections);
298 $result[
'sectionText'] = sprintf(
LocalizationUtility::translate(
'result.' . ($resultSectionsCount > 1 ?
'inNsections' :
'inNsection'),
'IndexedSearch'), $resultSectionsCount);
303 if (substr($this->searchData[
'sections'], 0, 2) ===
'rl') {
319 $finalResultRows = array();
322 $newResultRows = array();
323 foreach ($resultRows as $row) {
324 $id = md5($row[
'phash_grouping']);
325 if (is_array($newResultRows[$id])) {
327 if (!$newResultRows[$id][
'show_resume'] && $row[
'show_resume']) {
329 $subrows = $newResultRows[$id][
'_sub'];
330 unset($newResultRows[$id][
'_sub']);
331 $subrows[] = $newResultRows[$id];
333 $newResultRows[$id] = $row;
334 $newResultRows[$id][
'_sub'] = $subrows;
336 $newResultRows[$id][
'_sub'][] = $row;
339 $newResultRows[$id] = $row;
342 $resultRows = $newResultRows;
343 $this->resultSections = array();
344 if ($freeIndexUid <= 0 && $this->searchData[
'group'] ==
'sections') {
345 $rl2flag = substr($this->searchData[
'sections'], 0, 2) ==
'rl';
347 foreach ($resultRows as $row) {
348 $id = $row[
'rl0'] .
'-' . $row[
'rl1'] . ($rl2flag ?
'-' . $row[
'rl2'] :
'');
349 $sections[$id][] = $row;
351 $this->resultSections = array();
352 foreach ($sections as $id => $resultRows) {
353 $rlParts = explode(
'-', $id);
355 $theId = $rlParts[2];
356 $theRLid =
'rl2_' . $rlParts[2];
358 $theId = $rlParts[1];
359 $theRLid =
'rl1_' . $rlParts[1];
361 $theId = $rlParts[0];
365 $sectionName = ltrim($sectionName,
'/');
366 if (!trim($sectionName)) {
369 $onclick =
'document.forms[\'tx_indexedsearch\'][\'tx_indexedsearch_pi2[search][_sections]\'].value=' .
GeneralUtility::quoteJSvalue($theRLid) .
';document.forms[\'tx_indexedsearch\'].submit();return false;';
370 $sectionTitleLinked =
'<a href="#" onclick="' . htmlspecialchars($onclick) .
'">' . $sectionName .
':</a>';
372 $resultRowsCount = count($resultRows);
373 $this->resultSections[$id] = array($sectionName, $resultRowsCount);
375 $finalResultRows[] = array(
376 'isSectionHeader' =>
true,
377 'numResultRows' => $resultRowsCount,
379 'sectionTitle' => $sectionTitleLinked
382 foreach ($resultRows as $row) {
388 foreach ($resultRows as $row) {
392 return $finalResultRows;
406 $resultData[
'headerOnly'] = $headerOnly;
407 $resultData[
'CSSsuffix'] = $specRowConf[
'CSSsuffix'] ?
'-' . $specRowConf[
'CSSsuffix'] :
'';
409 $dat = unserialize($row[
'cHashParams']);
410 $pp = explode(
'-', $dat[
'key']);
411 if ($pp[0] != $pp[1]) {
417 $title = $resultData[
'item_title'] . $resultData[
'titleaddition'];
418 $title =
$GLOBALS[
'TSFE']->csConvObj->crop(
'utf-8', $title, $this->settings[
'results.'][
'titleCropAfter'], $this->settings[
'results.'][
'titleCropSignifier']);
420 if ($row[
'item_type']) {
421 if ($row[
'show_resume']) {
423 $targetAttribute =
'';
424 if (
$GLOBALS[
'TSFE']->config[
'config'][
'fileTarget']) {
425 $targetAttribute =
' target="' . htmlspecialchars(
$GLOBALS[
'TSFE']->config[
'config'][
'fileTarget']) .
'"';
427 $title =
'<a href="' . htmlspecialchars($row[
'data_filename']) .
'"' . $targetAttribute .
'>' . htmlspecialchars($title) .
'</a>';
431 unset($copiedRow[
'cHashParams']);
432 $title = $this->
linkPage($row[
'page_id'], $title, $copiedRow);
437 $markUpSwParams = array();
438 if ($this->settings[
'forwardSearchWordsInResultLink'][
'_typoScriptNodeValue']) {
439 if ($this->settings[
'forwardSearchWordsInResultLink'][
'no_cache']) {
440 $markUpSwParams = array(
'no_cache' => 1);
442 foreach ($this->searchWords as $d) {
443 $markUpSwParams[
'sword_list'][] = $d[
'sword'];
446 $title = $this->
linkPage($row[
'data_page_id'], $title, $row, $markUpSwParams);
448 $resultData[
'title'] = $title;
449 $resultData[
'icon'] = $this->makeItemTypeIcon($row[
'item_type'],
'', $specRowConf);
450 $resultData[
'rating'] = $this->
makeRating($row);
453 (
bool)!($this->searchData[
'extResume'] && !$headerOnly),
454 $this->settings[
'results.'][
'summaryCropAfter']
456 $resultData[
'language'] = $this->makeLanguageIndication($row);
458 $resultData[
'created'] = $row[
'item_crdate'];
459 $resultData[
'modified'] = $row[
'item_mtime'];
460 $pI = parse_url($row[
'data_filename']);
462 $targetAttribute =
'';
463 if (
$GLOBALS[
'TSFE']->config[
'config'][
'fileTarget']) {
464 $targetAttribute =
' target="' . htmlspecialchars(
$GLOBALS[
'TSFE']->config[
'config'][
'fileTarget']) .
'"';
466 $resultData[
'path'] =
'<a href="' . htmlspecialchars($row[
'data_filename']) .
'"' . $targetAttribute .
'>' . htmlspecialchars($row[
'data_filename']) .
'</a>';
468 $pathId = $row[
'data_page_id'] ?: $row[
'page_id'];
469 $pathMP = $row[
'data_page_id'] ? $row[
'data_page_mp'] :
'';
471 $resultData[
'path'] = $this->
linkPage($pathId, $pathStr, array(
472 'cHashParams' => $row[
'cHashParams'],
473 'data_page_type' => $row[
'data_page_type'],
474 'data_page_mp' => $pathMP,
475 'sys_language_uid' => $row[
'sys_language_uid']
478 if (is_array($this->requiredFrontendUsergroups[$pathId]) && !empty($this->requiredFrontendUsergroups[$pathId])) {
479 $resultData[
'access'] =
'<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath(
'indexed_search')
480 .
'Resources/Public/Icons/FileTypes/locked.gif" width="12" height="15" vspace="5" title="'
481 . sprintf(
LocalizationUtility::translate(
'result.memberGroups',
'IndexedSearch'), implode(
',', array_unique($this->requiredFrontendUsergroups[$pathId])))
487 if (is_array($row[
'_sub'])) {
488 $resultData[
'subresults'] = array();
491 foreach ($row[
'_sub'] as $subRow) {
511 $pathId = $row[
'data_page_id'] ?: $row[
'page_id'];
512 $pathMP = $row[
'data_page_id'] ? $row[
'data_page_mp'] :
'';
513 $rl =
$GLOBALS[
'TSFE']->sys_page->getRootLine($pathId, $pathMP);
514 $specConf = $this->settings[
'specialConfiguration'][
'0'];
516 foreach ($rl as $dat) {
517 if (is_array($this->settings[
'specialConfiguration'][$dat[
'uid']])) {
518 $specConf = $this->settings[
'specialConfiguration'][$dat[
'uid']];
519 $specConf[
'_pid'] = $dat[
'uid'];
536 switch ((
string)$this->searchData[
'sortOrder']) {
544 if ($this->firstRow[
'order_val2']) {
546 $base = $row[
'order_val1'] * 256;
548 $freqNumber = $row[
'order_val2'] / $this->firstRow[
'order_val2'] * pow(2, 12);
550 return ceil(log($total) / log(32767) * 100) .
'%';
556 return ceil(log($total) / log($max) * 100) .
'%';
559 return $GLOBALS[
'TSFE']->cObj->calcAge(
$GLOBALS[
'EXEC_TIME'] - $row[
'item_crdate'], 0);
562 return $GLOBALS[
'TSFE']->cObj->calcAge(
$GLOBALS[
'EXEC_TIME'] - $row[
'item_mtime'], 0);
575 protected function makeLanguageIndication($row)
579 if ((
string)$row[
'item_type'] ===
'0') {
581 if (is_array($this->settings[
'flagRendering'])) {
584 $cObj->setCurrentVal($row[
'sys_language_uid']);
585 $typoScriptArray = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings[
'flagRendering']);
586 $output = $cObj->cObjGetSingle($this->settings[
'flagRendering'][
'_typoScriptNodeValue'], $typoScriptArray);
600 public function makeItemTypeIcon($imageType, $alt, $specRowConf)
604 if ($imageType ===
'0' && $specRowConf[
'_pid'] && is_array($specRowConf[
'pageIcon']) && !is_array($this->settings[
'iconRendering'])) {
605 $imageType .=
':' . $specRowConf[
'_pid'];
607 if (!isset($this->iconFileNameCache[$imageType])) {
608 $this->iconFileNameCache[$imageType] =
'';
610 if (is_array($this->settings[
'iconRendering'])) {
613 $cObj->setCurrentVal($imageType);
614 $typoScriptArray = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings[
'iconRendering']);
615 $this->iconFileNameCache[$imageType] = $cObj->cObjGetSingle($this->settings[
'iconRendering'][
'_typoScriptNodeValue'], $typoScriptArray);
619 if ($imageType ===
'0' || substr($imageType, 0, 2) ==
'0:') {
620 if (is_array($specRowConf[
'pageIcon'])) {
621 $this->iconFileNameCache[$imageType] =
$GLOBALS[
'TSFE']->cObj->cObjGetSingle(
'IMAGE', $specRowConf[
'pageIcon']);
623 $icon =
'EXT:indexed_search/Resources/Public/Icons/FileTypes/pages.gif';
625 }
elseif ($this->externalParsers[$imageType]) {
626 $icon = $this->externalParsers[$imageType]->getIcon($imageType);
631 $info = @getimagesize($fullPath);
632 $iconPath = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($fullPath);
633 $this->iconFileNameCache[$imageType] = is_array($info) ?
'<img src="' . $iconPath .
'" ' . $info[3] .
' title="' . htmlspecialchars($alt) .
'" alt="" />' :
'';
638 return $this->iconFileNameCache[$imageType];
652 if ($row[
'show_resume']) {
655 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'*',
'index_fulltext',
'phash=' . (
int)$row[
'phash']);
658 $content = preg_replace(
'/(http:\\/\\/[^ ]{' . $this->settings[
'results.'][
'hrefInSummaryCropAfter'] .
'})([^ ]+)/i',
'$1...', $ftdrow[
'fulltextdata']);
663 if (!trim($markedSW)) {
664 $outputStr =
$GLOBALS[
'TSFE']->csConvObj->crop(
'utf-8', $row[
'item_description'], $length, $this->settings[
'results.'][
'summaryCropSignifier']);
665 $outputStr = htmlspecialchars($outputStr);
667 $output = $outputStr ?: $markedSW;
668 $output =
$GLOBALS[
'TSFE']->csConv($output,
'utf-8');
685 $str = str_replace(
' ',
' ', $htmlParser->bidir_htmlspecialchars($str, -1));
686 $str = preg_replace(
'/\\s\\s+/',
' ', $str);
689 foreach ($this->searchWords as $d) {
690 $swForReg[] = preg_quote($d[
'sword'],
'/');
692 $regExString =
'(' . implode(
'|', $swForReg) .
')';
694 $parts = preg_split(
'/' . $regExString .
'/i',
' ' . $str .
' ', 20000, PREG_SPLIT_DELIM_CAPTURE);
696 $summaryMax = $this->settings[
'results.'][
'markupSW_summaryMax'];
697 $postPreLgd = $this->settings[
'results.'][
'markupSW_postPreLgd'];
698 $postPreLgd_offset = $this->settings[
'results.'][
'markupSW_postPreLgd_offset'];
699 $divider = $this->settings[
'results.'][
'markupSW_divider'];
700 $occurencies = (count($parts) - 1) / 2;
708 foreach ($parts as $k => $strP) {
711 $strLen =
$GLOBALS[
'TSFE']->csConvObj->strlen(
'utf-8', $parts[$k]);
712 $output[$k] = $parts[$k];
716 if ($strLen > $postPreLgd) {
717 $output[$k] = $divider . preg_replace(
'/^[^[:space:]]+[[:space:]]/',
'',
$GLOBALS[
'TSFE']->csConvObj->crop(
'utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset)));
719 }
elseif ($summaryLgd > $summaryMax || !isset($parts[($k + 1)])) {
721 if ($strLen > $postPreLgd) {
722 $output[$k] = preg_replace(
'/[[:space:]][^[:space:]]+$/',
'',
$GLOBALS[
'TSFE']->csConvObj->crop(
'utf-8', $parts[$k], ($postPreLgd - $postPreLgd_offset))) . $divider;
725 if ($strLen > $postPreLgd * 2) {
726 $output[$k] = preg_replace(
'/[[:space:]][^[:space:]]+$/',
'',
$GLOBALS[
'TSFE']->csConvObj->crop(
'utf-8', $parts[$k], ($postPreLgd - $postPreLgd_offset))) . $divider . preg_replace(
'/^[^[:space:]]+[[:space:]]/',
'',
$GLOBALS[
'TSFE']->csConvObj->crop(
'utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset)));
729 $summaryLgd +=
$GLOBALS[
'TSFE']->csConvObj->strlen(
'utf-8', $output[$k]);
731 $output[$k] = htmlspecialchars($output[$k]);
733 if ($summaryLgd > $summaryMax) {
737 $summaryLgd +=
$GLOBALS[
'TSFE']->csConvObj->strlen(
'utf-8', $strP);
738 $output[$k] =
'<strong class="tx-indexedsearch-redMarkup">' . htmlspecialchars($parts[$k]) .
'</strong>';
742 return implode(
'', $output);
756 $insertFields = array(
757 'searchstring' => $this->sword,
758 'searchoptions' => serialize(array($searchParams,
$searchWords, $pt)),
759 'feuser_id' => (
int)
$GLOBALS[
'TSFE']->fe_user->user[
'uid'],
761 'cookie' =>
$GLOBALS[
'TSFE']->fe_user->id,
765 'hits' => (
int)$count,
773 $insertFields = array(
774 'word' => $val[
'sword'],
775 'index_stat_search_id' => $newId,
811 if ($hookObj = $this->
hookRequest(
'getSearchWords')) {
812 $sWordArray = $hookObj->getSearchWords_splitSWords(
$searchWords, $defaultOperator);
815 if ($this->searchData[
'searchType'] == 20) {
825 $operatorTranslateTable = array(
828 array(
'-',
'AND NOT'),
835 $swordArray = \TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::getExplodedSearchString(
$searchWords, $defaultOperator == 1 ?
'OR' :
'AND', $operatorTranslateTable);
836 if (is_array($swordArray)) {
853 $newSearchWords = array();
855 $lexerObjRef =
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'indexed_search'][
'lexer'] ?: \TYPO3\CMS\IndexedSearch\Lexer::class;
860 if (strpos($wordDef[
'sword'],
' ') ===
false) {
862 $res = $this->lexerObj->split2Words($wordDef[
'sword']);
864 foreach ($res as $word) {
865 $newSearchWords[] = array(
867 'oper' => $wordDef[
'oper']
871 $newSearchWords[] = $wordDef;
874 return $newSearchWords;
888 $this->view->assign(
'sword', $this->sword);
890 $showAdditionalKeywordSearch = $this->settings[
'clearSearchBox'] && $this->settings[
'clearSearchBox'][
'enableSubSearchCheckBox'];
891 if ($showAdditionalKeywordSearch) {
892 $this->view->assign(
'previousSearchWord', $this->settings[
'clearSearchBox'] ?
'' : $this->sword);
894 $this->view->assign(
'showAdditionalKeywordSearch', $showAdditionalKeywordSearch);
896 if ($search[
'extendedSearch']) {
899 $this->view->assign(
'allSearchTypes', $allSearchTypes);
901 $this->view->assign(
'allDefaultOperands', $allDefaultOperands);
902 $showTypeSearch = !empty($allSearchTypes) || !empty($allDefaultOperands);
903 $this->view->assign(
'showTypeSearch', $showTypeSearch);
906 $this->view->assign(
'allMediaTypes', $allMediaTypes);
908 $this->view->assign(
'allLanguageUids', $allLanguageUids);
909 $showMediaAndLanguageSearch = !empty($allMediaTypes) || !empty($allLanguageUids);
910 $this->view->assign(
'showMediaAndLanguageSearch', $showMediaAndLanguageSearch);
913 $this->view->assign(
'allSections', $allSections);
916 $this->view->assign(
'allIndexConfigurations', $allIndexConfigurations);
919 $this->view->assign(
'allSortOrders', $allSortOrders);
921 $this->view->assign(
'allSortDescendings', $allSortDescendings);
922 $showSortOrders = !empty($allSortOrders) || !empty($allSortDescendings);
923 $this->view->assign(
'showSortOrders', $showSortOrders);
926 $this->view->assign(
'allNumberOfResults', $allNumberOfResults);
928 $this->view->assign(
'allGroups', $allGroups);
943 $allOptions = array();
944 $types = array(0, 1, 2, 3, 10, 20);
945 $blindSettings = $this->settings[
'blind'];
946 if (!$blindSettings[
'searchType']) {
947 foreach ($types as $typeNum) {
952 if (!$this->enableMetaphoneSearch) {
953 unset($allOptions[10]);
967 $allOptions = array();
968 $blindSettings = $this->settings[
'blind'];
969 if (!$blindSettings[
'defaultOperand']) {
987 $allOptions = array();
988 $mediaTypes = array(-1, 0, -2);
989 $blindSettings = $this->settings[
'blind'];
990 if (!$blindSettings[
'mediaType']) {
991 foreach ($mediaTypes as $mediaType) {
995 $additionalMedia = trim($this->settings[
'mediaList']);
996 if ($additionalMedia !==
'') {
999 $additionalMedia = array();
1001 foreach ($this->externalParsers as $extension => $obj) {
1003 if (!empty($additionalMedia) && !in_array($extension, $additionalMedia)) {
1006 if ($name = $obj->searchTypeMediaTitle($extension)) {
1008 $allOptions[$extension] = $translatedName ?: $name;
1024 $allOptions = array(
1028 $blindSettings = $this->settings[
'blind'];
1029 if (!$blindSettings[
'languageUid']) {
1034 $allOptions[
$lang[
'uid']] = $lang[
'title'];
1040 $allOptions = array();
1056 $allOptions = array();
1057 $sections = array(0, -1, -2, -3);
1058 $blindSettings = $this->settings[
'blind'];
1059 if (!$blindSettings[
'sections']) {
1060 foreach ($sections as $section) {
1066 if ($this->settings[
'displayLevel1Sections']) {
1067 $firstLevelMenu = $this->
getMenuOfPages($this->searchRootPageIdList);
1070 foreach ($firstLevelMenu as $firstLevelKey => $menuItem) {
1071 if (!$menuItem[
'nav_hide']) {
1072 $allOptions[
'rl1_' . $menuItem[
'uid']] = trim($labelLevel1 .
' ' . $menuItem[
'title']);
1073 if ($this->settings[
'displayLevel2Sections']) {
1075 foreach ($secondLevelMenu as $secondLevelKey => $menuItemLevel2) {
1076 if (!$menuItemLevel2[
'nav_hide']) {
1077 $allOptions[
'rl2_' . $menuItemLevel2[
'uid']] = trim($labelLevel2 .
' ' . $menuItemLevel2[
'title']);
1079 unset($secondLevelMenu[$secondLevelKey]);
1085 unset($firstLevelMenu[$firstLevelKey]);
1102 $allOptions = array(
1107 $blindSettings = $this->settings[
'blind'];
1108 if (!$blindSettings[
'indexingConfigurations']) {
1110 if ($this->settings[
'defaultFreeIndexUidList']) {
1112 $indexCfgRecords = $this->
getDatabaseConnection()->exec_SELECTgetRows(
'uid,title',
'index_config',
'uid IN (' . implode(
',', $uidList) .
')' .
$GLOBALS[
'TSFE']->cObj->enableFields(
'index_config'),
'',
'',
'',
'uid');
1113 foreach ($uidList as $uidValue) {
1114 if (is_array($indexCfgRecords[$uidValue])) {
1115 $allOptions[$uidValue] = $indexCfgRecords[$uidValue][
'title'];
1122 $allOptions = array();
1138 $allOptions = array();
1139 $sortOrders = array(
'rank_flag',
'rank_freq',
'rank_first',
'rank_count',
'mtime',
'title',
'crdate');
1140 $blindSettings = $this->settings[
'blind'];
1141 if (!$blindSettings[
'sortOrder']) {
1142 foreach ($sortOrders as $order) {
1158 $allOptions = array();
1159 $blindSettings = $this->settings[
'blind'];
1160 if (!$blindSettings[
'groupBy']) {
1161 $allOptions = array(
1178 $allOptions = array();
1179 $blindSettings = $this->settings[
'blind'];
1180 if (!$blindSettings[
'descending']) {
1181 $allOptions = array(
1198 $allOptions = array();
1199 $blindSettings = $this->settings[
'blind'];
1200 if (!$blindSettings[
'numberOfResults']) {
1201 $allOptions = array(
1222 if (is_array($blindOptions)) {
1223 foreach ($blindOptions as $key => $val) {
1225 unset($allOptions[$key]);
1242 protected function linkPage($pageUid, $linkText, $row = array(), $markUpSwParams = array())
1245 $urlParameters = (array)unserialize($row[
'cHashParams']);
1247 if ($row[
'data_page_mp']) {
1248 $urlParameters[
'MP'] = $row[
'data_page_mp'];
1250 if ($row[
'sys_language_uid']) {
1251 $urlParameters[
'L'] = $row[
'sys_language_uid'];
1254 $urlParameters = array_merge($urlParameters, $markUpSwParams);
1257 if (!is_array($this->domainRecords[$pageUid])) {
1262 if (!empty($this->domainRecords[$pageUid])) {
1264 $firstDomain = reset($this->domainRecords[$pageUid]);
1265 $additionalParams =
'';
1266 if (is_array($urlParameters) && !empty($urlParameters)) {
1269 $uri = $scheme . $firstDomain .
'/index.php?id=' . $pageUid . $additionalParams;
1270 if ($target = $this->settings[
'detectDomainRecords.'][
'target']) {
1271 $target =
' target="' . $target .
'"';
1274 $uriBuilder = $this->controllerContext->getUriBuilder();
1275 $uri =
$uriBuilder->setTargetPageUid($pageUid)->setTargetPageType($row[
'data_page_type'])->setUseCacheHash(
true)->setArguments($urlParameters)->build();
1277 return '<a href="' . htmlspecialchars($uri) .
'"' . $target .
'>' . htmlspecialchars($linkText) .
'</a>';
1288 if ($this->settings[
'displayLevelxAllTypes']) {
1290 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'title,uid',
'pages',
'pid=' . (
int)$pageUid .
$GLOBALS[
'TSFE']->cObj->enableFields(
'pages'),
'',
'sorting');
1292 $menu[$row[
'uid']] =
$GLOBALS[
'TSFE']->sys_page->getPageOverlay($row);
1296 $menu =
$GLOBALS[
'TSFE']->sys_page->getMenu($pageUid);
1310 $identStr = $id .
'|' . $pathMP;
1311 if (!isset($this->pathCache[$identStr])) {
1312 $this->requiredFrontendUsergroups[$id] = array();
1313 $this->domainRecords[$id] = array();
1314 $rl =
$GLOBALS[
'TSFE']->sys_page->getRootLine($id, $pathMP);
1316 $pageCount = count($rl);
1317 if (is_array($rl) && !empty($rl)) {
1318 $breadcrumbWrap = isset($this->settings[
'breadcrumbWrap']) ? $this->settings[
'breadcrumbWrap'] :
'/';
1319 $breadcrumbWraps =
$GLOBALS[
'TSFE']->tmpl->splitConfArray(array(
'wrap' => $breadcrumbWrap), $pageCount);
1320 foreach ($rl as $k => $v) {
1322 if ($v[
'fe_group'] && ($v[
'uid'] == $id || $v[
'extendToSubpages'])) {
1323 $this->requiredFrontendUsergroups[$id][] = $v[
'fe_group'];
1326 if ($this->settings[
'detectDomainRcords']) {
1329 $this->domainRecords[$id][] = $domainName;
1331 $path = $domainName . $path;
1336 if ($v[
'uid'] ==
$GLOBALS[
'TSFE']->config[
'rootLine'][0][
'uid']) {
1337 array_pop($breadcrumbWraps);
1340 $path =
$GLOBALS[
'TSFE']->cObj->wrap(htmlspecialchars($v[
'title']), array_pop($breadcrumbWraps)[
'wrap']) . $path;
1343 $this->pathCache[$identStr] = $path;
1345 return $this->pathCache[$identStr];
1356 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'domainName',
'sys_domain',
'pid=' . (
int)$id .
$GLOBALS[
'TSFE']->cObj->enableFields(
'sys_domain'),
'',
'sorting');
1358 return rtrim($row[
'domainName'],
'/');
1370 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'indexed_search'][
'external_parsers'])) {
1371 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'indexed_search'][
'external_parsers'] as $extension => $_objRef) {
1374 if (!$this->externalParsers[$extension]->softInit($extension)) {
1375 unset($this->externalParsers[$extension]);
1390 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'indexed_search'][
'pi1_hooks'][$functionName]) {
1392 if (method_exists($hookObj, $functionName)) {
1393 $hookObj->pObj = $this;
1408 return is_object($this->externalParsers[$item_type]) && $this->externalParsers[$item_type]->isMultiplePageExtension($item_type);
1427 if (!is_array($this->settings[
'results.'])) {
1428 $this->settings[
'results.'] = array();
1430 $typoScriptArray = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings[
'results']);
1433 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'summaryCropAfter'], $typoScriptArray[
'summaryCropAfter.']),
1436 $this->settings[
'results.'][
'summaryCropSignifier'] =
$GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'summaryCropSignifier'], $typoScriptArray[
'summaryCropSignifier.']);
1438 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'titleCropAfter'], $typoScriptArray[
'titleCropAfter.']),
1441 $this->settings[
'results.'][
'titleCropSignifier'] =
$GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'titleCropSignifier'], $typoScriptArray[
'titleCropSignifier.']);
1443 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'markupSW_summaryMax'], $typoScriptArray[
'markupSW_summaryMax.']),
1447 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'markupSW_postPreLgd'], $typoScriptArray[
'markupSW_postPreLgd.']),
1451 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'markupSW_postPreLgd_offset'], $typoScriptArray[
'markupSW_postPreLgd_offset.']),
1454 $this->settings[
'results.'][
'markupSW_divider'] =
$GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'markupSW_divider'], $typoScriptArray[
'markupSW_divider.']);
1456 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'hrefInSummaryCropAfter'], $typoScriptArray[
'hrefInSummaryCropAfter.']),
1459 $this->settings[
'results.'][
'hrefInSummaryCropSignifier'] =
$GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'hrefInSummaryCropSignifier'], $typoScriptArray[
'hrefInSummaryCropSignifier.']);