diff --git a/ChangeLog b/ChangeLog index f6573df3..373e2ecd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Version 2.0.0 IMPORTANT: This version has breaking changes: Marker based templatating has been removed completely, support for TYPO 4.5 has been dropped! - feature: add fluid based templating. - task: remove "wrap" option for filter rendering, this can be done in the fluid template. +- task: raise minimun requirement to TYPO3 version 6.2 +- task: remove all checks for TYPO3 version. Version 1.10.2 - bugfix: add langDisable in flexform, https://forge.typo3.org/issues/64579 diff --git a/Classes/Backend/class.tx_kesearch_classes_flexform.php b/Classes/Backend/class.tx_kesearch_classes_flexform.php index 70641bc6..267ff042 100644 --- a/Classes/Backend/class.tx_kesearch_classes_flexform.php +++ b/Classes/Backend/class.tx_kesearch_classes_flexform.php @@ -6,17 +6,7 @@ class tx_kesearch_classes_flexform { var $lang; public function init() { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $this->lang = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService'); - } else if (TYPO3_VERSION_INTEGER >= 6002000) { - $this->lang = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('language'); - } else { - $this->lang = t3lib_div::makeInstance('language'); - } - - if (TYPO3_VERSION_INTEGER < 6001000) { - t3lib_div::loadTCA('tx_kesearch_index'); - } + $this->lang = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService'); } function listAvailableOrderingsForFrontend(&$config) { @@ -30,12 +20,7 @@ function listAvailableOrderingsForFrontend(&$config) { $res = $GLOBALS['TYPO3_DB']->sql_query('SHOW COLUMNS FROM tx_kesearch_index'); while($col = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($notAllowedFields, $col['Field']); - } else { - $isInList = t3lib_div::inList($notAllowedFields, $col['Field']); - } - + $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($notAllowedFields, $col['Field']); if(!$isInList) { $file = $GLOBALS['TCA']['tx_kesearch_index']['columns'][$col['Field']]['label']; $fieldLabel = $this->lang->sL($file); @@ -58,12 +43,7 @@ function listAvailableOrderingsForAdmin(&$config) { $res = $GLOBALS['TYPO3_DB']->sql_query('SHOW COLUMNS FROM tx_kesearch_index'); while($col = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($notAllowedFields, $col['Field']); - } else { - $isInList = t3lib_div::inList($notAllowedFields, $col['Field']); - } - + $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($notAllowedFields, $col['Field']); if(!$isInList) { $file = $GLOBALS['TCA']['tx_kesearch_index']['columns'][$col['Field']]['label']; $fieldLabel = $this->lang->sL($file); diff --git a/Classes/Backend/class.user_filterlist.php b/Classes/Backend/class.user_filterlist.php index 0ab2a4ca..0c1067de 100644 --- a/Classes/Backend/class.user_filterlist.php +++ b/Classes/Backend/class.user_filterlist.php @@ -51,13 +51,8 @@ function getListOfAvailableFiltersForFlexforms(&$config) { $fields = '*'; $table = 'tx_kesearch_filters'; $where = 'pid IN('.$intString.') '; - if (TYPO3_VERSION_INTEGER > 7000000) { - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table,$inv=0); - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table,$inv=0); - } else { - $where .= t3lib_befunc::BEenableFields($table,$inv=0); - $where .= t3lib_befunc::deleteClause($table,$inv=0); - } + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table,$inv=0); + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table,$inv=0); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields,$table,$where,$groupBy='',$orderBy='',$limit=''); $anz = $GLOBALS['TYPO3_DB']->sql_num_rows($res); while ($row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { @@ -76,11 +71,7 @@ function getListOfAvailableFiltersForTCA(&$config) { } // get the page TSconfig - if (TYPO3_VERSION_INTEGER > 7000000) { - $this->pageTSconfig=\TYPO3\CMS\Backend\Utility\BackendUtility::GetPagesTSconfig($currentPid); - } else { - $this->pageTSconfig=t3lib_BEfunc::GetPagesTSconfig($currentPid); - } + $this->pageTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::GetPagesTSconfig($currentPid); $this->modTSconfig=$this->pageTSconfig['ke_search.']; // get filters @@ -96,13 +87,8 @@ function getListOfAvailableFiltersForTCA(&$config) { $where = '1=1 '; } - if (TYPO3_VERSION_INTEGER > 7000000) { - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table,$inv=0); - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table,$inv=0); - } else { - $where .= t3lib_befunc::BEenableFields($table,$inv=0); - $where .= t3lib_befunc::deleteClause($table,$inv=0); - } + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table,$inv=0); + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table,$inv=0); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields,$table,$where,$groupBy='',$orderBy='',$limit=''); $anz = $GLOBALS['TYPO3_DB']->sql_num_rows($res); @@ -112,13 +98,8 @@ function getListOfAvailableFiltersForTCA(&$config) { $fields2 = '*'; $table2 = 'tx_kesearch_filteroptions'; $where2 = 'uid in ('.$row['options'].')'; - if (TYPO3_VERSION_INTEGER > 7000000) { - $where2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table2); - $where2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table2); - } else { - $where2 .= t3lib_befunc::BEenableFields($table2); - $where2 .= t3lib_befunc::deleteClause($table2); - } + $where2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table2); + $where2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table2); $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields2,$table2,$where2); while($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2)) { @@ -148,14 +129,8 @@ function getListOfAvailableFilteroptionsForFlexforms(&$config) { $fields = '*'; $table = 'tx_kesearch_filters'; $where = 'pid IN('.$intString.') '; - - if (TYPO3_VERSION_INTEGER > 7000000) { - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table,$inv=0); - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table,$inv=0); - } else { - $where .= t3lib_befunc::BEenableFields($table,$inv=0); - $where .= t3lib_befunc::deleteClause($table,$inv=0); - } + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table,$inv=0); + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table,$inv=0); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields,$table,$where,$groupBy='',$orderBy='',$limit=''); while ($rowFilter=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { @@ -165,14 +140,8 @@ function getListOfAvailableFilteroptionsForFlexforms(&$config) { $fieldsOpts = '*'; $tableOpts = 'tx_kesearch_filteroptions'; $whereOpts = 'uid in ('.$rowFilter['options'].')'; - - if (TYPO3_VERSION_INTEGER > 7000000) { - $whereOpts .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($tableOpts,$inv=0); - $whereOpts .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($tableOpts,$inv=0); - } else { - $whereOpts .= t3lib_befunc::BEenableFields($tableOpts,$inv=0); - $whereOpts .= t3lib_befunc::deleteClause($tableOpts,$inv=0); - } + $whereOpts .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($tableOpts,$inv=0); + $whereOpts .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($tableOpts,$inv=0); $resOpts = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fieldsOpts,$tableOpts,$whereOpts,$groupBy='',$orderBy='',$limit=''); while ($rowOpts=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($resOpts)) { diff --git a/Classes/Scheduler/class.tx_kesearch_indexertask.php b/Classes/Scheduler/class.tx_kesearch_indexertask.php index ab7bd68b..e2e5d962 100644 --- a/Classes/Scheduler/class.tx_kesearch_indexertask.php +++ b/Classes/Scheduler/class.tx_kesearch_indexertask.php @@ -25,16 +25,10 @@ -// include indexer class and create a "baseclass" (only for backwards compatibility) -if (TYPO3_VERSION_INTEGER >= 6002000) { - require_once(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search') . 'Classes/indexer/class.tx_kesearch_indexer.php'); - abstract class tx_kesearch_indexertask_baseclass extends \TYPO3\CMS\Scheduler\Task\AbstractTask { } -} else { - require_once(t3lib_extMgm::extPath('ke_search') . 'Classes/indexer/class.tx_kesearch_indexer.php'); - abstract class tx_kesearch_indexertask_baseclass extends tx_scheduler_Task { } -} +// include indexer class +require_once(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search') . 'Classes/indexer/class.tx_kesearch_indexer.php'); -class tx_kesearch_indexertask extends tx_kesearch_indexertask_baseclass { +class tx_kesearch_indexertask extends \TYPO3\CMS\Scheduler\Task\AbstractTask { public function execute() { @@ -42,22 +36,15 @@ public function execute() { $this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ke_search']); // make indexer instance - if (TYPO3_VERSION_INTEGER >= 6002000) { - $indexer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_indexer'); - } else { - $indexer = t3lib_div::makeInstance('tx_kesearch_indexer'); - } + $indexer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_indexer'); // process - $response = $indexer->startIndexing(true, $this->extConf, 'CLI'); + $indexer->startIndexing(true, $this->extConf, 'CLI'); return true; - } - } if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/ke_search/Classes/Scheduler/class.tx_kesearch_indexertask.php']) { include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/ke_search/Classes/Scheduler/class.tx_kesearch_indexertask.php']); -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/Classes/indexer/class.tx_kesearch_indexer.php b/Classes/indexer/class.tx_kesearch_indexer.php index 1adbf63f..3c762dcc 100644 --- a/Classes/indexer/class.tx_kesearch_indexer.php +++ b/Classes/indexer/class.tx_kesearch_indexer.php @@ -69,20 +69,9 @@ public function __construct() { // get extension configuration array $this->extConf = tx_kesearch_helper::getExtConf(); $this->extConfPremium = tx_kesearch_helper::getExtConfPremium(); - - if (TYPO3_VERSION_INTEGER >= 7000000) { - $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry'); - } else if (TYPO3_VERSION_INTEGER >= 6002000) { - $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_Registry'); - } else { - $this->registry = t3lib_div::makeInstance('t3lib_Registry'); - } + $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry'); // fetch the list of the default indexers which come with ke_search - // load TCA definition first (only necessary in TYPO3 below 6.1) - if (TYPO3_VERSION_INTEGER < 6001000) { - t3lib_div::loadTCA('tx_kesearch_indexerconfig'); - } foreach ($GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['type']['config']['items'] as $indexerType) { $this->defaultIndexerTypes[] = $indexerType[1]; } @@ -127,11 +116,7 @@ function startIndexing($verbose=true, $extConf, $mode='') { // register additional fields which should be written to DB if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerAdditionalFields'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerAdditionalFields'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->registerAdditionalFields($this->additionalFields); } } @@ -144,18 +129,10 @@ function startIndexing($verbose=true, $extConf, $mode='') { // run default indexers shipped with ke_search if (in_array($this->indexerConfig['type'], $this->defaultIndexerTypes)) { - if (TYPO3_VERSION_INTEGER < 6002000) { - $path = t3lib_extMgm::extPath('ke_search') . 'Classes/indexer/types/class.tx_kesearch_indexer_types_' . $this->indexerConfig['type'] . '.php'; - } else { - $path = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search') . 'Classes/indexer/types/class.tx_kesearch_indexer_types_' . $this->indexerConfig['type'] . '.php'; - } + $path = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search') . 'Classes/indexer/types/class.tx_kesearch_indexer_types_' . $this->indexerConfig['type'] . '.php'; if(is_file($path)) { require_once($path); - if (TYPO3_VERSION_INTEGER >= 6002000) { - $searchObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_indexer_types_' . $this->indexerConfig['type'], $this); - } else { - $searchObj = t3lib_div::makeInstance('tx_kesearch_indexer_types_' . $this->indexerConfig['type'], $this); - } + $searchObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_indexer_types_' . $this->indexerConfig['type'], $this); $content .= $searchObj->startIndexing(); } else { $content = '
For file indexing from content elements you need at least TYPO3 6.0.0!
'; - } - $content .= $this->showErrors(); $content .= $this->showTime(); @@ -252,18 +236,9 @@ public function addLocalizedPagesToCache($pageRow) { // create entry in cachedPageRecods for additional languages, skip default language 0 foreach ($this->sysLanguages as $sysLang) { if ($sysLang[1] > 0) { - - if (TYPO3_VERSION_INTEGER >= 7000000) { - list($pageOverlay) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $pageRow['uid'], 'AND sys_language_uid=' . intval($sysLang[1])); - } else { - list($pageOverlay) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $pageRow['uid'], 'AND sys_language_uid=' . intval($sysLang[1])); - } + list($pageOverlay) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $pageRow['uid'], 'AND sys_language_uid=' . intval($sysLang[1])); if ($pageOverlay) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $this->cachedPageRecords[$sysLang[1]][$pageRow['uid']] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($pageRow, $pageOverlay); - } else { - $this->cachedPageRecords[$sysLang[1]][$pageRow['uid']] = t3lib_div::array_merge($pageRow, $pageOverlay); - } + $this->cachedPageRecords[$sysLang[1]][$pageRow['uid']] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($pageRow, $pageOverlay); } } } @@ -349,13 +324,8 @@ public function getPageContent($uid) { $table = 'tt_content'; $where = 'pid = ' . intval($uid); $where .= ' AND (' . $this->whereClauseForCType . ')'; - if (TYPO3_VERSION_INTEGER >= 7000000) { - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table); - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); - } else { - $where .= t3lib_BEfunc::BEenableFields($table); - $where .= t3lib_BEfunc::deleteClause($table); - } + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table); + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); // Get access restrictions for this page, this access restrictians apply to all // content elements of this pages. Individuel access restrictions @@ -428,11 +398,7 @@ public function getPageContent($uid) { // hook for custom modifications of the indexed data, e. g. the tags if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyPagesIndexEntry'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyPagesIndexEntry'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyPagesIndexEntry( $uid, $pageContent, $tags, $this->cachedPageRecords, $additionalFields, $indexerConfig, $indexEntryDefaultValues ); @@ -548,13 +514,8 @@ public function getCombinedFeGroupsForContentElement($feGroupsPages, $feGroupsCo } if ($feGroupsPages && $feGroupsContentElement && $feGroupsPages != '-1' && $feGroupsContentElement != '-1') { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $feGroupsContentElementArray = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $feGroupsContentElement); - $feGroupsPagesArray = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $feGroupsPages); - } else { - $feGroupsContentElementArray = t3lib_div::intExplode(',', $feGroupsContentElement); - $feGroupsPagesArray = t3lib_div::intExplode(',', $feGroupsPages); - } + $feGroupsContentElementArray = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $feGroupsContentElement); + $feGroupsPagesArray = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $feGroupsPages); $feGroups = implode(',', array_intersect($feGroupsContentElementArray,$feGroupsContentElementArray)); } @@ -588,12 +549,7 @@ public function indexFiles($fileObjects, $ttContentRow, $feGroupsPages, $tags) { if (count($fileObjects) && $feGroups != DONOTINDEX) { // loop through files foreach ($fileObjects as $fileObject) { - - if (TYPO3_VERSION_INTEGER >= 7000000) { - $isInList = \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->indexerConfig['fileext'], $fileObject->getExtension()); - } else { - $isInList = t3lib_div::inList($this->indexerConfig['fileext'], $fileObject->getExtension()); - } + $isInList = \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->indexerConfig['fileext'], $fileObject->getExtension()); // check if the file extension fits in the list of extensions // to index defined in the indexer configuration @@ -603,13 +559,8 @@ public function indexFiles($fileObjects, $ttContentRow, $feGroupsPages, $tags) { $fileUri = $fileObject->getStorage()->getPublicUrl($fileObject); $filePath = $fileObject->getForLocalProcessing(FALSE); - if (TYPO3_VERSION_INTEGER >= 6002000) { - /* @var $fileIndexerObject tx_kesearch_indexer_types_file */ - $fileIndexerObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_indexer_types_file', $this->pObj); - } else { - /* @var $fileIndexerObject tx_kesearch_indexer_types_file */ - $fileIndexerObject = t3lib_div::makeInstance('tx_kesearch_indexer_types_file', $this->pObj); - } + /* @var $fileIndexerObject tx_kesearch_indexer_types_file */ + $fileIndexerObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_indexer_types_file', $this->pObj); // add tags from linking page to this index record? if (!$this->indexerConfig['index_use_page_tags_for_files']) { @@ -648,12 +599,8 @@ public function indexFiles($fileObjects, $ttContentRow, $feGroupsPages, $tags) { * @return array */ public function findAttachedFiles($ttContentRow) { - if (TYPO3_VERSION_INTEGER >= 6000000) { - // get files attached to the content element - $fileReferenceObjects = $this->fileRepository->findByRelation('tt_content', 'media', $ttContentRow['uid']); - } else { - $fileReferenceObjects = array(); - } + // get files attached to the content element + $fileReferenceObjects = $this->fileRepository->findByRelation('tt_content', 'media', $ttContentRow['uid']); return $fileReferenceObjects; } @@ -670,27 +617,25 @@ public function findAttachedFiles($ttContentRow) { public function findLinkedFilesInRte($ttContentRow) { $fileObjects = array(); // check if there are links to files in the rte text - if (TYPO3_VERSION_INTEGER >= 6002000) { - /* @var $rteHtmlParser \TYPO3\CMS\Core\Html\RteHtmlParser */ - $rteHtmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\RteHtmlParser'); - - $blockSplit = $rteHtmlParser->splitIntoBlock('link', $ttContentRow['bodytext'], 1); - foreach ($blockSplit as $k => $v) { - if ($k % 2) { - $tagCode = \TYPO3\CMS\Core\Utility\GeneralUtility::unQuoteFilenames(trim(substr($rteHtmlParser->getFirstTag($v), 0, -1)), TRUE); - $link_param = $tagCode[1]; - - // Check for FAL link-handler keyword - list($linkHandlerKeyword, $linkHandlerValue) = explode(':', trim($link_param), 2); - if ($linkHandlerKeyword === 'file') { - try { - $fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject(rawurldecode($linkHandlerValue)); - if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\FileInterface) { - $fileObjects[] = $fileOrFolderObject; - } - } catch (\TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException $resourceDoesNotExistException) { - $this->addError('Could not index file with FAL uid #' . $linkHandlerValue . ' (the indentifier inserted in the RTE is already gone).'); + /* @var $rteHtmlParser \TYPO3\CMS\Core\Html\RteHtmlParser */ + $rteHtmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\RteHtmlParser'); + + $blockSplit = $rteHtmlParser->splitIntoBlock('link', $ttContentRow['bodytext'], 1); + foreach ($blockSplit as $k => $v) { + if ($k % 2) { + $tagCode = \TYPO3\CMS\Core\Utility\GeneralUtility::unQuoteFilenames(trim(substr($rteHtmlParser->getFirstTag($v), 0, -1)), TRUE); + $link_param = $tagCode[1]; + + // Check for FAL link-handler keyword + list($linkHandlerKeyword, $linkHandlerValue) = explode(':', trim($link_param), 2); + if ($linkHandlerKeyword === 'file') { + try { + $fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject(rawurldecode($linkHandlerValue)); + if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\FileInterface) { + $fileObjects[] = $fileOrFolderObject; } + } catch (\TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException $resourceDoesNotExistException) { + $this->addError('Could not index file with FAL uid #' . $linkHandlerValue . ' (the indentifier inserted in the RTE is already gone).'); } } } @@ -716,18 +661,10 @@ public function storeFileContentToIndex($fileObject, $content, $fileIndexerObjec // get metadata if ($fileObject instanceof TYPO3\CMS\Core\Resource\FileReference) { $orig_uid = $fileObject->getOriginalFile()->getUid(); - if (TYPO3_VERSION_INTEGER >= 6002000) { - $metadata = $fileObject->getOriginalFile()->_getMetaData(); - } else { - $metadata = array(); - } + $metadata = $fileObject->getOriginalFile()->_getMetaData(); } else { $orig_uid = $fileObject->getUid(); - if (TYPO3_VERSION_INTEGER >= 6002000) { - $metadata = $fileObject->_getMetaData(); - } else { - $metadata = array(); - } + $metadata = $fileObject->_getMetaData(); } // assign categories as tags @@ -762,11 +699,7 @@ public function storeFileContentToIndex($fileObject, $content, $fileIndexerObjec //hook for custom modifications of the indexed data, e. g. the tags if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFileIndexEntryFromContentIndexer'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFileIndexEntryFromContentIndexer'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyFileIndexEntryFromContentIndexer($fileObject, $content, $fileIndexerObject, $feGroups, $ttContentRow, $storagePid, $title, $tags, $abstract, $additionalFields); } } diff --git a/Classes/indexer/types/class.tx_kesearch_indexer_types_t3s_content.php b/Classes/indexer/types/class.tx_kesearch_indexer_types_t3s_content.php index 87e78511..fea15b69 100644 --- a/Classes/indexer/types/class.tx_kesearch_indexer_types_t3s_content.php +++ b/Classes/indexer/types/class.tx_kesearch_indexer_types_t3s_content.php @@ -81,20 +81,12 @@ public function getTtContentRecordsWithT3sPlugin() { ); if($rows) { foreach($rows as $key => $row) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $xml = TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($row['pi_flexform']); - } else { - $xml = t3lib_div::xml2array($row['pi_flexform']); - } + $xml = TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($row['pi_flexform']); $config = $xml['data']['general']['lDEF']; $ttContentUids[] = $config['contentElements']['vDEF']; } $ttContentUids = implode(',', $ttContentUids); - if (TYPO3_VERSION_INTEGER >= 7000000) { - $ttContentUids = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($ttContentUids); - } else { - $ttContentUids = t3lib_div::uniqueList($ttContentUids); - } + $ttContentUids = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($ttContentUids); $ttContentRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( '*', 'tt_content', diff --git a/Classes/indexer/types/class.tx_kesearch_indexer_types_templavoila.php b/Classes/indexer/types/class.tx_kesearch_indexer_types_templavoila.php index c5689a44..e778c30c 100644 --- a/Classes/indexer/types/class.tx_kesearch_indexer_types_templavoila.php +++ b/Classes/indexer/types/class.tx_kesearch_indexer_types_templavoila.php @@ -65,28 +65,15 @@ class tx_kesearch_indexer_types_templavoila extends tx_kesearch_indexer_types { public function __construct($pObj) { parent::__construct($pObj); - if (TYPO3_VERSION_INTEGER < 6002000) { - $this->templavoilaIsLoaded = t3lib_extMgm::isLoaded('templavoila'); - } else { - $this->templavoilaIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('templavoila'); - } + $this->templavoilaIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('templavoila'); if ($this->templavoilaIsLoaded) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('pages') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('pages'); - } else { - $enableFields = t3lib_BEfunc::BEenableFields('pages') . t3lib_BEfunc::deleteClause('pages'); - } + $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('pages') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('pages'); $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid,title', 'pages', 'pid = 0' . $enableFields); $GLOBALS['TT'] = new t3lib_timeTrackNull; - if (TYPO3_VERSION_INTEGER >= 6002000) { - $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $row['uid'], 0); - $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_pageSelect'); - } else { - $GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $row['uid'], 0); - $GLOBALS['TSFE']->sys_page = t3lib_div::makeInstance('t3lib_pageSelect'); - } + $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $row['uid'], 0); + $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_pageSelect'); $GLOBALS['TSFE']->sys_page->init(TRUE); $GLOBALS['TSFE']->initTemplate(); @@ -97,11 +84,7 @@ public function __construct($pObj) { // override it with the page/type-specific "config." if (is_array($GLOBALS['TSFE']->pSetup['config.'])) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $GLOBALS['TSFE']->config['config'] = TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($GLOBALS['TSFE']->config['config'], $GLOBALS['TSFE']->pSetup['config.']); - } else { - $GLOBALS['TSFE']->config['config'] = t3lib_div::array_merge_recursive_overrule($GLOBALS['TSFE']->config['config'], $GLOBALS['TSFE']->pSetup['config.']); - } + $GLOBALS['TSFE']->config['config'] = TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($GLOBALS['TSFE']->config['config'], $GLOBALS['TSFE']->pSetup['config.']); } // generate basic rootline @@ -109,11 +92,7 @@ public function __construct($pObj) { 0 => array('uid' => $row['uid'], 'title' => $row['title']) ); - if (TYPO3_VERSION_INTEGER >= 6002000) { - $this->tv = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_templavoila_pi1'); - } else { - $this->tv = t3lib_div::makeInstance('tx_templavoila_pi1'); - } + $this->tv = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_templavoila_pi1'); } $this->counter = 0; @@ -123,11 +102,7 @@ public function __construct($pObj) { $this->whereClauseForCType = implode(' OR ', $cTypes); // get all available sys_language_uid records - if (TYPO3_VERSION_INTEGER >= 7000000) { - $this->sysLanguages = TYPO3\CMS\Backend\Utility\BackendUtility::getSystemLanguages(); - } else { - $this->sysLanguages = t3lib_BEfunc::getSystemLanguages(); - } + $this->sysLanguages = TYPO3\CMS\Backend\Utility\BackendUtility::getSystemLanguages(); } @@ -216,27 +191,14 @@ public function getPageRecords($uids) { public function addLocalizedPagesToCache($row) { $this->cachedPageRecords[0][$row['uid']] = $row; foreach($this->sysLanguages as $sysLang) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - list($pageOverlay) = TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField( - 'pages_language_overlay', - 'pid', - $row['uid'], - 'AND sys_language_uid=' . intval($sysLang[1]) - ); - } else { - list($pageOverlay) = t3lib_BEfunc::getRecordsByField( - 'pages_language_overlay', - 'pid', - $row['uid'], - 'AND sys_language_uid=' . intval($sysLang[1]) - ); - } + list($pageOverlay) = TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField( + 'pages_language_overlay', + 'pid', + $row['uid'], + 'AND sys_language_uid=' . intval($sysLang[1]) + ); if($pageOverlay) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $this->cachedPageRecords[$sysLang[1]][$row['uid']] = TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($row, $pageOverlay); - } else { - $this->cachedPageRecords[$sysLang[1]][$row['uid']] = t3lib_div::array_merge($row, $pageOverlay); - } + $this->cachedPageRecords[$sysLang[1]][$row['uid']] = TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($row, $pageOverlay); } } } @@ -250,12 +212,7 @@ public function getPageContent($uid) { $flex = $this->pageRecords[$uid]['tx_templavoila_flex']; if(empty($flex)) return ''; - - if (TYPO3_VERSION_INTEGER >= 7000000) { - $flex = TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($flex); - } else { - $flex = t3lib_div::xml2array($flex); - } + $flex = TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($flex); // TODO: Maybe I need a more detailed collection of retrieving CE UIDS $contentElementUids = array(); @@ -263,21 +220,13 @@ public function getPageContent($uid) { $tvPaths = 'field_content'; } else $tvPaths = $this->indexerConfig['tvpath']; - if (TYPO3_VERSION_INTEGER >= 7000000) { - $tvPaths = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $tvPaths); - } else { - $tvPaths = t3lib_div::trimExplode(',', $tvPaths); - } + $tvPaths = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $tvPaths); foreach ($tvPaths as $tvPath) { $contentElementUids[] = $flex['data']['sDEF']['lDEF'][$tvPath]['vDEF']; } - if (TYPO3_VERSION_INTEGER >= 7000000) { - $contentElementUids = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList(implode(',', $contentElementUids)); - } else { - $contentElementUids = t3lib_div::uniqueList(implode(',', $contentElementUids)); - } + $contentElementUids = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList(implode(',', $contentElementUids)); if(empty($contentElementUids)) return ''; @@ -288,13 +237,8 @@ public function getPageContent($uid) { $table = 'tt_content'; $where = 'uid IN (' . $contentElementUids . ')'; $where .= ' AND (' . $this->whereClauseForCType. ')'; - if (TYPO3_VERSION_INTEGER >= 7000000) { - $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table); - $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); - } else { - $where .= t3lib_BEfunc::BEenableFields($table); - $where .= t3lib_BEfunc::deleteClause($table); - } + $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table); + $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); // if indexing of content elements with restrictions is not allowed // get only content elements that have empty group restrictions @@ -344,11 +288,7 @@ public function getPageContent($uid) { // hook for custom modifications of the indexed data, e. g. the tags if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyTemplaVoilaIndexEntry'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyTemplaVoilaIndexEntry'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyPagesIndexEntry( $uid, $pageContent, diff --git a/Classes/indexer/types/class.tx_kesearch_indexer_types_tt_address.php b/Classes/indexer/types/class.tx_kesearch_indexer_types_tt_address.php index 64452a74..2785f06c 100644 --- a/Classes/indexer/types/class.tx_kesearch_indexer_types_tt_address.php +++ b/Classes/indexer/types/class.tx_kesearch_indexer_types_tt_address.php @@ -58,13 +58,8 @@ public function startIndexing() { } $where = 'pid IN (' . implode(',', $indexPids) . ') '; - if (TYPO3_VERSION_INTEGER >= 7000000) { - $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table); - $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); - } else { - $where .= t3lib_befunc::BEenableFields($table); - $where .= t3lib_befunc::deleteClause($table); - } + $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table); + $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where); $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res); @@ -148,11 +143,7 @@ public function startIndexing() { // hook for custom modifications of the indexed data, e. g. the tags if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyAddressIndexEntry'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyAddressIndexEntry'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyAddressIndexEntry( $title, $abstract, diff --git a/Classes/indexer/types/class.tx_kesearch_indexer_types_tt_content.php b/Classes/indexer/types/class.tx_kesearch_indexer_types_tt_content.php index 0127d1ef..934917fc 100644 --- a/Classes/indexer/types/class.tx_kesearch_indexer_types_tt_content.php +++ b/Classes/indexer/types/class.tx_kesearch_indexer_types_tt_content.php @@ -49,12 +49,7 @@ function getPageContent($uid) { // copied to the index //$where .= t3lib_BEfunc::BEenableFields($table); $where .= ' AND hidden=0'; - - if (TYPO3_VERSION_INTEGER >= 7000000) { - $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); - } else { - $where .= t3lib_BEfunc::deleteClause($table); - } + $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); // get tags from page $tags = $this->pageRecords[$uid]['tags']; @@ -138,11 +133,7 @@ function getPageContent($uid) { // hook for custom modifications of the indexed data, e. g. the tags if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyContentIndexEntry( $row['header'], $row, diff --git a/Classes/indexer/types/class.tx_kesearch_indexer_types_ttnews.php b/Classes/indexer/types/class.tx_kesearch_indexer_types_ttnews.php index 4d76abe9..ba4ea0a3 100644 --- a/Classes/indexer/types/class.tx_kesearch_indexer_types_ttnews.php +++ b/Classes/indexer/types/class.tx_kesearch_indexer_types_ttnews.php @@ -89,14 +89,8 @@ public function startIndexing() { } $where = 'pid IN (' . implode(',', $indexPids) . ') '; - - if (TYPO3_VERSION_INTEGER >= 7000000) { - $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table); - $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); - } else { - $where .= t3lib_befunc::BEenableFields($table); - $where .= t3lib_befunc::deleteClause($table); - } + $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table); + $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where); $counter = 0; @@ -107,12 +101,7 @@ public function startIndexing() { // if mode equals 'choose categories for indexing' (2). 1 = All if ($this->indexerConfig['index_news_category_mode'] == '2') { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_news_cat') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_news_cat'); - } else { - $enableFields = t3lib_befunc::BEenableFields('tt_news_cat') . t3lib_befunc::deleteClause('tt_news_cat'); - } - + $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_news_cat') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_news_cat'); $resCat = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( 'tt_news_cat.uid', 'tt_news', 'tt_news_cat_mm', 'tt_news_cat', ' AND tt_news.uid = ' . $newsRecord['uid'] . $enableFields, @@ -124,18 +113,10 @@ public function startIndexing() { while ($newsCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resCat)) { // if category was found in list, set isInList to true and break further processing. - if (TYPO3_VERSION_INTEGER >= 7000000) { - if (TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->indexerConfig['index_news_category_selection'], $newsCat['uid'])) { - $isInList = true; - break; - } - } else { - if (t3lib_div::inList($this->indexerConfig['index_news_category_selection'], $newsCat['uid'])) { - $isInList = true; - break; - } + if (TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->indexerConfig['index_news_category_selection'], $newsCat['uid'])) { + $isInList = true; + break; } - } // if category was not found stop further processing and loop with next news record @@ -172,11 +153,7 @@ public function startIndexing() { $params = $newsRecord['ext_url'];; } else { // get target page from category if set (first assigned category) - if (TYPO3_VERSION_INTEGER < 6002000) { - $ttnewsIsLoaded = t3lib_extMgm::isLoaded('tt_news'); - } else { - $ttnewsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tt_news'); - } + $ttnewsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tt_news'); if ($ttnewsIsLoaded) { $singleViewPage = $this->getSingleViewPageFromCategories($newsRecord['uid']); } @@ -220,11 +197,7 @@ public function startIndexing() { // hook for custom modifications of the indexed data, e. g. the tags if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyNewsIndexEntry'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyNewsIndexEntry'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyNewsIndexEntry( $title, $abstract, $fullContent, $params, $tags, $newsRecord, $additionalFields, $indexerConfig ); @@ -280,12 +253,7 @@ function getSingleViewPageFromCategories($uid, $getAll = false) { // TODO: take Storage PID into account (in tx_ttnws class the // where clause is stored in $this->SPaddWhere) $addWhere = ' AND tt_news_cat.deleted=0'; - - if (TYPO3_VERSION_INTEGER >= 7000000) { - $addWhere .= $getAll ? '' : TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_news_cat'); - } else { - $addWhere .= $getAll ? '' : t3lib_befunc::BEenableFields('tt_news_cat'); - } + $addWhere .= $getAll ? '' : TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_news_cat'); // TODO: take tt_news configuration options useSPidFromCategory and // and useSPidFromCategoryRecusive into account (would need an instance @@ -324,12 +292,7 @@ function getSingleViewPageFromCategories($uid, $getAll = false) { * @return int first found single view pid */ function getRecursiveCategorySinglePid($currentCategory) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $addWhere = ' AND tt_news_cat.deleted=0' . TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_news_cat'); - } else { - $addWhere = ' AND tt_news_cat.deleted=0' . t3lib_befunc::BEenableFields('tt_news_cat'); - } - + $addWhere = ' AND tt_news_cat.deleted=0' . TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_news_cat'); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,parent_category,single_pid', 'tt_news_cat', 'tt_news_cat.uid=' . $currentCategory . $addWhere); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $GLOBALS['TYPO3_DB']->sql_free_result($res); diff --git a/Classes/lib/class.tx_kesearch_db.php b/Classes/lib/class.tx_kesearch_db.php index beacd45a..87d7bfc9 100644 --- a/Classes/lib/class.tx_kesearch_db.php +++ b/Classes/lib/class.tx_kesearch_db.php @@ -22,12 +22,6 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -if (TYPO3_VERSION_INTEGER >= 7000000) { - class tx_kesearch_db_baseclass implements \TYPO3\CMS\Core\SingletonInterface { } -} else { - class tx_kesearch_db_baseclass implements t3lib_Singleton { } -} - /** * DB Class for ke_search, generates search queries. * @@ -35,7 +29,7 @@ class tx_kesearch_db_baseclass implements t3lib_Singleton { } * @package TYPO3 * @subpackage tx_kesearch */ -class tx_kesearch_db extends tx_kesearch_db_baseclass { +class tx_kesearch_db implements \TYPO3\CMS\Core\SingletonInterface { var $conf = array(); var $bestIndex = ''; var $countResultsOfTags = 0; @@ -99,11 +93,7 @@ public function getSearchResultByMySQL() { $queryParts['ORDERBY'], $queryParts['LIMIT'] ); - if (TYPO3_VERSION_INTEGER >= 7000000) { - TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Search result query', $this->pObj->extKey, 0, array($query)); - } else { - t3lib_div::devLog('Search result query', $this->pObj->extKey, 0, array($query)); - } + TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Search result query', $this->pObj->extKey, 0, array($query)); } $this->searchResults = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( @@ -143,13 +133,8 @@ function escapeString ( $string ) { * @return array Array containing a limitted (one page) amount of search results */ public function getSearchResultBySphinx() { - if (TYPO3_VERSION_INTEGER >= 6002000) { - require_once(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search_premium') . 'class.user_kesearchpremium.php'); - $this->user_kesearchpremium = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('user_kesearchpremium'); - } else { - require_once(t3lib_extMgm::extPath('ke_search_premium') . 'class.user_kesearchpremium.php'); - $this->user_kesearchpremium = t3lib_div::makeInstance('user_kesearchpremium'); - } + require_once(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search_premium') . 'class.user_kesearchpremium.php'); + $this->user_kesearchpremium = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('user_kesearchpremium'); // set ordering $this->user_kesearchpremium->setSorting($this->getOrdering()); @@ -173,17 +158,9 @@ public function getSearchResultBySphinx() { // add fe_groups to query $queryForSphinx .= ' @fe_group _group_NULL | _group_0'; if(!empty($GLOBALS['TSFE']->gr_list)) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $feGroups = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TSFE']->gr_list, 1); - } else { - $feGroups = t3lib_div::trimExplode(',', $GLOBALS['TSFE']->gr_list, 1); - } + $feGroups = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TSFE']->gr_list, 1); foreach($feGroups as $key => $group) { - if (TYPO3_VERSION_INTEGER >= 6000000) { - $intval_positive_group = TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($group); - } else { - $intval_positive_group = t3lib_div::intval_positive($group); - } + $intval_positive_group = TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($group); if($intval_positive_group) { $feGroups[$key] = '_group_' . $group; } else unset($feGroups[$key]); @@ -192,11 +169,7 @@ public function getSearchResultBySphinx() { } // restrict to storage page (in MySQL: $where .= ' AND pid in (' . . ') ';) - if (TYPO3_VERSION_INTEGER >= 7000000) { - $startingPoints = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->pObj->startingPoints); - } else { - $startingPoints = t3lib_div::trimExplode(',', $this->pObj->startingPoints); - } + $startingPoints = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->pObj->startingPoints); $queryForSphinx .= ' @pid '; $first = true; foreach ($startingPoints as $startingPoint) { @@ -212,11 +185,7 @@ public function getSearchResultBySphinx() { // hook for appending additional where clause to sphinx query if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['appendWhereToSphinx'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['appendWhereToSphinx'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $queryForSphinx = $_procObj->appendWhereToSphinx($queryForSphinx, $this->user_kesearchpremium, $this); } } @@ -271,11 +240,7 @@ public function getQueryParts() { // hook for third party applications to manipulate last part of query building if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['getQueryParts'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['getQueryParts'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $queryParts = $_procObj->getQueryParts($queryParts, $this); } } @@ -478,11 +443,7 @@ public function getOrdering() { $piVarsDir = $this->pObj->piVars['sortByDir']; $piVarsDir = ($piVarsDir == '') ? 'asc' : $piVarsDir; if(!empty($piVarsField)) { // if an ordering field is defined by GET/POST - if (TYPO3_VERSION_INTEGER >= 7000000) { - $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['sortByVisitor'], $piVarsField); - } else { - $isInList = t3lib_div::inList($this->conf['sortByVisitor'], $piVarsField); - } + $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['sortByVisitor'], $piVarsField); if($this->conf['sortByVisitor'] != '' && $isInList) { $orderBy = $piVarsField . ' ' . $piVarsDir; } // if sortByVisitor is not set OR not in the list of allowed fields then use fallback ordering in "sortWithoutSearchword" @@ -513,11 +474,7 @@ public function getLimit() { // hook for third party pagebrowsers or for modification $this->pObj->piVars['page'] parameter if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['getLimit'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['getLimit'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->getLimit($startLimit, $this); } } diff --git a/Classes/lib/class.tx_kesearch_filters.php b/Classes/lib/class.tx_kesearch_filters.php index a5e704fa..9e984a27 100644 --- a/Classes/lib/class.tx_kesearch_filters.php +++ b/Classes/lib/class.tx_kesearch_filters.php @@ -64,11 +64,7 @@ class tx_kesearch_filters { public function initialize(tx_kesearch_lib $pObj) { $this->pObj = $pObj; $this->cObj = $pObj->cObj; - if (TYPO3_VERSION_INTEGER >= 6002000) { - $this->db = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_db'); - } else { - $this->db = t3lib_div::makeInstance('tx_kesearch_db'); - } + $this->db = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_db'); $this->conf = $this->pObj->conf; $this->piVars = $this->pObj->piVars; @@ -81,11 +77,7 @@ public function initialize(tx_kesearch_lib $pObj) { // hook to modify filters if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilters'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilters'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyFilters($this->filters, $this); } } @@ -124,11 +116,7 @@ public function getSelectedFilterOptions($filter) { if ($this->pObj->piVars['filter'][$filter['uid']] == $option['tag']) { $selected = true; } else if (is_array($this->pObj->piVars['filter'][$filter['uid']])) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $isInArray = TYPO3\CMS\Core\Utility\GeneralUtility::inArray($this->pObj->piVars['filter'][$filter['uid']], $option['tag']); - } else { - $isInArray = t3lib_div::inArray($this->pObj->piVars['filter'][$filter['uid']], $option['tag']); - } + $isInArray = TYPO3\CMS\Core\Utility\GeneralUtility::inArray($this->pObj->piVars['filter'][$filter['uid']], $option['tag']); if($isInArray) { $selected = true; } @@ -163,11 +151,7 @@ public function combineLists($list1 = '', $list2 = '') { $list1 .= ','; } $list1 .= $list2; - if (TYPO3_VERSION_INTEGER >= 7000000) { - $returnValue = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($list1); - } else { - $returnValue = t3lib_div::uniqueList($list1); - } + $returnValue = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($list1); return $returnValue; } diff --git a/Classes/lib/class.tx_kesearch_lib.php b/Classes/lib/class.tx_kesearch_lib.php index bff54e39..cf6cc5ea 100644 --- a/Classes/lib/class.tx_kesearch_lib.php +++ b/Classes/lib/class.tx_kesearch_lib.php @@ -22,16 +22,6 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -if (TYPO3_VERSION_INTEGER < 6002000) { - require_once(PATH_tslib . 'class.tslib_pibase.php'); -} - -if (TYPO3_VERSION_INTEGER >= 7000000) { - class tx_kesearch_pluginBase extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { } -} else { - class tx_kesearch_pluginBase extends tslib_pibase { } -} - /** * Parent class for plugins pi1 and pi2 * @@ -41,7 +31,7 @@ class tx_kesearch_pluginBase extends tslib_pibase { } * @package TYPO3 * @subpackage tx_kesearch */ -class tx_kesearch_lib extends tx_kesearch_pluginBase { +class tx_kesearch_lib extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { var $prefixId = 'tx_kesearch_pi1'; // Same as class name var $extKey = 'ke_search'; // The extension key. @@ -106,18 +96,10 @@ class tx_kesearch_lib extends tx_kesearch_pluginBase { */ public function init() { // get some helper functions - if (TYPO3_VERSION_INTEGER >= 6002000) { - $this->div = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_div', $this); - } else { - $this->div = t3lib_div::makeInstance('tx_kesearch_lib_div', $this); - } + $this->div = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_div', $this); // set start of query timer - if (TYPO3_VERSION_INTEGER >= 7000000) { - if(!$GLOBALS['TSFE']->register['ke_search_queryStartTime']) $GLOBALS['TSFE']->register['ke_search_queryStartTime'] = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds(); - } else { - if(!$GLOBALS['TSFE']->register['ke_search_queryStartTime']) $GLOBALS['TSFE']->register['ke_search_queryStartTime'] = t3lib_div::milliseconds(); - } + if(!$GLOBALS['TSFE']->register['ke_search_queryStartTime']) $GLOBALS['TSFE']->register['ke_search_queryStartTime'] = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds(); // make settings from flexform available in general configuration ($this->conf) $this->moveFlexFormDataToConf(); @@ -151,31 +133,19 @@ public function init() { // hook: modifyFlexFormData if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFlexFormData'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFlexFormData'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyFlexFormData($this->conf, $this->cObj, $this->piVars); } } // prepare database object - if (TYPO3_VERSION_INTEGER >= 6002000) { - $this->db = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_db', $this); - } else { - $this->db = t3lib_div::makeInstance('tx_kesearch_db', $this); - } + $this->db = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_db', $this); // set startingPoints $this->startingPoints = $this->div->getStartingPoint(); // get filter class - if (TYPO3_VERSION_INTEGER >= 6002000) { - $this->filters = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_filters'); - } else { - $this->filters = t3lib_div::makeInstance('tx_kesearch_filters'); - } + $this->filters = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_filters'); // get extension configuration array $this->extConf = tx_kesearch_helper::getExtConf(); @@ -191,22 +161,14 @@ public function init() { $this->firstStartingPoint = $this->div->getFirstStartingPoint($this->startingPoints); // build words searchphrase - if (TYPO3_VERSION_INTEGER >= 6002000) { - $searchPhrase = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_searchphrase'); - } else { - $searchPhrase = t3lib_div::makeInstance('tx_kesearch_lib_searchphrase'); - } + $searchPhrase = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_searchphrase'); $searchPhrase->initialize($this); $searchWordInformation = $searchPhrase->buildSearchPhrase(); // Hook: modifySearchWords if(isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifySearchWords'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifySearchWords'] as $classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $hookObj = TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); - } else { - $hookObj = t3lib_div::getUserObj($classRef); - } + $hookObj = TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); if(method_exists($hookObj, 'modifySearchWords')) { $hookObj->modifySearchWords($searchWordInformation, $this); } @@ -230,11 +192,7 @@ public function init() { // * sorting for "relevance" is allowed (internal: "score") // * user did not select his own sorting yet // * a searchword is given - if (TYPO3_VERSION_INTEGER >= 7000000) { - $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['sortByVisitor'], 'score'); - } else { - $isInList = t3lib_div::inList($this->conf['sortByVisitor'], 'score'); - } + $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['sortByVisitor'], 'score'); if ($this->conf['showSortInFrontend'] && $isInList && !$this->piVars['sortByField'] && $this->sword) { $this->piVars['sortByField'] = 'score'; $this->piVars['sortByDir'] = 'desc'; @@ -263,11 +221,7 @@ public function init() { $cssFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['cssFile']); if(!empty($cssFile)) { $cssTag = $this->cObj->wrap($cssFile, ''); - if (TYPO3_VERSION_INTEGER >= 6000000) { - $GLOBALS['TSFE']->getPageRenderer()->addCssFile($cssFile); - } else { - $GLOBALS['TSFE']->additionalHeaderData[$this->prefixId . '_css'] = $cssTag; - } + $GLOBALS['TSFE']->getPageRenderer()->addCssFile($cssFile); } } @@ -278,21 +232,13 @@ public function init() { public function initTemplate() { // check for rendering method if ($this->conf['renderMethod'] == 'fluidtemplate') { - if (TYPO3_VERSION_INTEGER < 6000000) { - return ('ke_search error:Render method "Fluid template" needs at least TYPO3 version 6.'); - } else { - // set default template paths - $this->conf['templateRootPath'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->conf['templateRootPath'] ? $this->conf['templateRootPath'] : 'EXT:ke_search/Resources/Private/Templates/'); - $this->conf['partialRootPath'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->conf['partialRootPath'] ? $this->conf['partialRootPath'] : 'EXT:ke_search/Resources/Private/Partials/'); - $this->conf['layoutRootPath'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->conf['layoutRootPath'] ? $this->conf['layoutRootPath'] : 'EXT:ke_search/Resources/Private/Layouts/'); - } + // set default template paths + $this->conf['templateRootPath'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->conf['templateRootPath'] ? $this->conf['templateRootPath'] : 'EXT:ke_search/Resources/Private/Templates/'); + $this->conf['partialRootPath'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->conf['partialRootPath'] ? $this->conf['partialRootPath'] : 'EXT:ke_search/Resources/Private/Partials/'); + $this->conf['layoutRootPath'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->conf['layoutRootPath'] ? $this->conf['layoutRootPath'] : 'EXT:ke_search/Resources/Private/Layouts/'); } else { // get html template - if (TYPO3_VERSION_INTEGER < 6002000) { - $this->templateFile = $this->conf['templateFile'] ? $this->conf['templateFile'] : t3lib_extMgm::siteRelPath($this->extKey) . 'res/template_pi1.tpl'; - } else { - $this->templateFile = $this->conf['templateFile'] ? $this->conf['templateFile'] : TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/template_pi1.tpl'; - } + $this->templateFile = $this->conf['templateFile'] ? $this->conf['templateFile'] : TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/template_pi1.tpl'; $this->templateCode = $this->cObj->fileResource($this->templateFile); } } @@ -420,17 +366,10 @@ public function getSearchboxContent() { $this->fluidTemplateVariables['targetpage'] = $this->conf['resultPage']; // set form action - if (TYPO3_VERSION_INTEGER >= 7000000) { - $siteUrl = TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); - $lParam = TYPO3\CMS\Core\Utility\GeneralUtility::_GET('L'); - $mpParam = TYPO3\CMS\Core\Utility\GeneralUtility::_GET('MP'); - $typeParam = TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type'); - } else { - $siteUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL'); - $lParam = t3lib_div::_GET('L'); - $mpParam = t3lib_div::_GET('MP'); - $typeParam = t3lib_div::_GP('type'); - } + $siteUrl = TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); + $lParam = TYPO3\CMS\Core\Utility\GeneralUtility::_GET('L'); + $mpParam = TYPO3\CMS\Core\Utility\GeneralUtility::_GET('MP'); + $typeParam = TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type'); $actionUrl = $siteUrl . 'index.php'; $content = $this->cObj->substituteMarker($content,'###FORM_ACTION###', $actionUrl); $this->fluidTemplateVariables['actionUrl'] = $actionUrl; @@ -496,11 +435,7 @@ public function renderFilters() { // rendering of this filter. The filter is only used // to add preselected filter options to the query and // must not be rendered. - if (TYPO3_VERSION_INTEGER >= 7000000) { - $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['hiddenfilters'], $filter['uid']); - } else { - $isInList = t3lib_div::inList($this->conf['hiddenfilters'], $filter['uid']); - } + $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['hiddenfilters'], $filter['uid']); if ($isInList) { continue; @@ -517,11 +452,7 @@ public function renderFilters() { // hook for modifying filter options if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptionsArray'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptionsArray'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $options = $_procObj->modifyFilterOptionsArray($filter['uid'], $options, $this); } } @@ -552,11 +483,7 @@ public function renderFilters() { // special classes / custom code switch($filter['rendertype']) { case 'textlinks': - if (TYPO3_VERSION_INTEGER >= 6002000) { - $textLinkObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_filters_textlinks', $this); - } else { - $textLinkObj = t3lib_div::makeInstance('tx_kesearch_lib_filters_textlinks', $this); - } + $textLinkObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_filters_textlinks', $this); $textLinkObj->renderTextlinks($filter['uid'], $options, $this); break; @@ -565,11 +492,7 @@ public function renderFilters() { // hook for custom filter renderer if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['customFilterRenderer'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['customFilterRenderer'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->customFilterRenderer($filter['uid'], $options, $this); } } @@ -642,11 +565,7 @@ public function compileCheckboxOptions($filter, $options) { // modify filter options by hook if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptions'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptions'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $contentOptions .= $_procObj->modifyFilterOptions( $filter, $checkboxOptions, @@ -772,11 +691,7 @@ public function getFiltersFromFlexform() { */ public function getFilterOptions($optionList, $returnSortedByTitle = false) { // check/convert if list contains only integers - if (TYPO3_VERSION_INTEGER >= 7000000) { - $optionIdArray = TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $optionList, true); - } else { - $optionIdArray = t3lib_div::intExplode(',', $optionList, true); - } + $optionIdArray = TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $optionList, true); $optionList = implode(',', $optionIdArray); if($returnSortedByTitle) { $sortBy = 'title'; @@ -814,19 +729,11 @@ public function getFilterOptions($optionList, $returnSortedByTitle = false) { public function initXajax() { // Include xaJax if(!class_exists('xajax')) { - if (TYPO3_VERSION_INTEGER < 6002000) { - $path_to_xajax = t3lib_extMgm::extPath('xajax') . 'class.tx_xajax.php'; - } else { - $path_to_xajax = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('xajax') . 'class.tx_xajax.php'; - } + $path_to_xajax = t3lib_extMgm::extPath('xajax') . 'class.tx_xajax.php'; require_once($path_to_xajax); } // Make the instance - if (TYPO3_VERSION_INTEGER >= 6002000) { - $this->xajax = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_xajax'); - } else { - $this->xajax = t3lib_div::makeInstance('tx_xajax'); - } + $this->xajax = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_xajax'); // Decode form vars from utf8 $this->xajax->decodeUTF8InputOn(); // Encoding of the response to utf-8. @@ -850,16 +757,8 @@ public function initXajax() { $this->xajax->processRequests(); // Create javacript and add it to the normal output - if (TYPO3_VERSION_INTEGER < 6002000) { - $jsCode = $this->xajax->getJavascript(t3lib_extMgm::siteRelPath('xajax')); - } else { - $jsCode = $this->xajax->getJavascript(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('xajax')); - } - if (TYPO3_VERSION_INTEGER >= 6000000) { - $GLOBALS['TSFE']->getPageRenderer()->addHeaderData($jsCode); - } else { - $GLOBALS['TSFE']->additionalHeaderData['xajax_search_filters'] = $jsCode; - } + $jsCode = $this->xajax->getJavascript(t3lib_extMgm::siteRelPath('xajax')); + $GLOBALS['TSFE']->getPageRenderer()->addHeaderData($jsCode); } @@ -871,11 +770,7 @@ public function initXajax() { */ public function createHideSpinner() { // generate onload image - if (TYPO3_VERSION_INTEGER < 6002000) { - $path = t3lib_extMgm::siteRelPath($this->extKey) . 'res/img/blank.gif'; - } else { - $path = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/blank.gif'; - } + $path = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/blank.gif'; if ($GLOBALS['TSFE']->id != $this->conf['resultPage']) { $spinnerFunction = 'hideSpinnerFiltersOnly()'; } else $spinnerFunction = 'hideSpinner()'; @@ -975,11 +870,7 @@ public function refresh($data) { if ($this->conf['showQueryTime']) { // Calculate Querytime // we have two plugin. That's why we work with register here. - if (TYPO3_VERSION_INTEGER >= 7000000) { - $GLOBALS['TSFE']->register['ke_search_queryTime'] = (TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime']); - } else { - $GLOBALS['TSFE']->register['ke_search_queryTime'] = (t3lib_div::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime']); - } + $GLOBALS['TSFE']->register['ke_search_queryTime'] = (TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime']); $objResponse->addAssign('kesearch_query_time', 'innerHTML', sprintf($this->pi_getLL('query_time'), $GLOBALS['TSFE']->register['ke_search_queryTime'])); } } @@ -1050,11 +941,7 @@ public function renderNoResultsText() { // attention icon (only in marker based template) unset($imageConf); - if (TYPO3_VERSION_INTEGER < 6002000) { - $imageConf['file'] = t3lib_extMgm::siteRelPath($this->extKey).'res/img/attention.gif'; - } else { - $imageConf['file'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/img/attention.gif'; - } + $imageConf['file'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/img/attention.gif'; $imageConf['altText'] = $this->pi_getLL('no_results_found'); $attentionImage = $this->cObj->IMAGE($imageConf); } @@ -1062,11 +949,7 @@ public function renderNoResultsText() { // hook to implement your own idea of a no result message if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['noResultsHandler'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['noResultsHandler'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->noResultsHandler($noResultsText, $this); } } @@ -1098,11 +981,7 @@ public function renderTooShortWordsText() { // attention icon unset($imageConf); - if (TYPO3_VERSION_INTEGER < 6002000) { - $imageConf['file'] = t3lib_extMgm::siteRelPath($this->extKey) . 'res/img/attention.gif'; - } else { - $imageConf['file'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/attention.gif'; - } + $imageConf['file'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/attention.gif'; $imageConf['altText'] = $this->pi_getLL('no_results_found'); $attentionImage=$this->cObj->IMAGE($imageConf); @@ -1156,11 +1035,7 @@ public function getSearchResults() { // init counter and loop through the search results $resultCount = 1; - if (TYPO3_VERSION_INTEGER >= 6002000) { - $this->searchResult = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_searchresult', $this); - } else { - $this->searchResult = t3lib_div::makeInstance('tx_kesearch_lib_searchresult', $this); - } + $this->searchResult = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_searchresult', $this); $this->fluidTemplateVariables['resultrows'] = array(); @@ -1179,11 +1054,7 @@ public function getSearchResults() { // make curent row number available to hook $this->currentRowNumber = $resultCount; foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['additionalResultMarker'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->additionalResultMarker( $tempMarkerArray, $row, @@ -1301,11 +1172,7 @@ public function getSearchResults() { // hook for additional content AFTER the result list if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['additionalContentAfterResultList'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['additionalContentAfterResultList'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $content .= $_procObj->additionalContentAfterResultList($this); } } @@ -1385,25 +1252,13 @@ function renderPreviewImageOrTypeIcon($row) { public function countSearchWordWithKeStats($searchphrase='') { $searchphrase = trim($searchphrase); - if (TYPO3_VERSION_INTEGER < 6002000) { - $keStatsIsLoaded = t3lib_extMgm::isLoaded('ke_stats'); - } else { - $keStatsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_stats'); - } + $keStatsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_stats'); if ($keStatsIsLoaded && !empty($searchphrase)) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $keStatsObj = TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj('EXT:ke_stats/pi1/class.tx_kestats_pi1.php:tx_kestats_pi1'); - } else { - $keStatsObj = t3lib_div::getUserObj('EXT:ke_stats/pi1/class.tx_kestats_pi1.php:tx_kestats_pi1'); - } + $keStatsObj = TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj('EXT:ke_stats/pi1/class.tx_kestats_pi1.php:tx_kestats_pi1'); $keStatsObj->initApi(); // count words - if (TYPO3_VERSION_INTEGER >= 7000000) { - $wordlist = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $searchphrase, true); - } else { - $wordlist = t3lib_div::trimExplode(' ', $searchphrase, true); - } + $wordlist = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $searchphrase, true); foreach ($wordlist as $singleword) { $keStatsObj->increaseCounter( 'ke_search Words', @@ -1489,11 +1344,7 @@ public function renderPagebrowser() { $content = ''; if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['renderPagebrowserInit'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['renderPagebrowserInit'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $content = $_procObj->renderPagebrowserInit($this); } } @@ -1648,11 +1499,7 @@ public function renderPagebrowser() { // use only if you use marker based templating, not for fluid based templating! if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['pagebrowseAdditionalMarker'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['pagebrowseAdditionalMarker'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->pagebrowseAdditionalMarker( $markerArray, $this @@ -1667,11 +1514,7 @@ public function renderPagebrowser() { public function renderOrdering() { - if (TYPO3_VERSION_INTEGER >= 6002000) { - $sortObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_sorting', $this); - } else { - $sortObj = t3lib_div::makeInstance('tx_kesearch_lib_sorting', $this); - } + $sortObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_sorting', $this); return $sortObj->renderSorting($this->fluidTemplateVariables); } @@ -1718,23 +1561,21 @@ public function renderFilePreview($row) { public function renderFALPreviewImage($uid, $table='pages', $fieldname='media') { $imageHtml = ''; - if (TYPO3_VERSION_INTEGER >= 6000000) { - $imageConf = $this->conf['previewImage.']; - $fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository'); - $fileObjects = $fileRepository->findByRelation($table, $fieldname, $uid); - if (count($fileObjects)) { - $fileObject = $fileObjects[0]; - } + $imageConf = $this->conf['previewImage.']; + $fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository'); + $fileObjects = $fileRepository->findByRelation($table, $fieldname, $uid); + if (count($fileObjects)) { + $fileObject = $fileObjects[0]; + } - if ($fileObject) { - $referenceProperties = $fileObject->getReferenceProperties(); - $originalFileProperties = $fileObject->getOriginalFile()->getProperties(); - $alternative = $referenceProperties['alternative'] ? $referenceProperties['alternative'] : $originalFileProperties['alternative']; + if ($fileObject) { + $referenceProperties = $fileObject->getReferenceProperties(); + $originalFileProperties = $fileObject->getOriginalFile()->getProperties(); + $alternative = $referenceProperties['alternative'] ? $referenceProperties['alternative'] : $originalFileProperties['alternative']; - $imageConf['file'] = $fileObject->getPublicUrl(); - $imageConf['altText'] = $alternative; - $imageHtml = $this->renderPreviewImage($imageConf); - } + $imageConf['file'] = $fileObject->getPublicUrl(); + $imageConf['altText'] = $alternative; + $imageHtml = $this->renderPreviewImage($imageConf); } return $imageHtml; @@ -1750,11 +1591,7 @@ public function renderFALPreviewImage($uid, $table='pages', $fieldname='media') public function renderPreviewImage($imageConf) { if (empty($imageConf['file.']['maxW'])) $imageConf['file.']['maxW'] = 150; if (empty($imageConf['file.']['maxH'])) $imageConf['file.']['maxH'] = 150; - if (TYPO3_VERSION_INTEGER < 7000000) { - $rendered = $this->cObj->IMAGE($imageConf); - } else { - $rendered = $this->cObj->cObjGetSingle('IMAGE', $imageConf); - } + $rendered = $this->cObj->cObjGetSingle('IMAGE', $imageConf); return $rendered; } @@ -1772,37 +1609,21 @@ public function renderTypeIcon($typeComplete) { } else { // custom image (old configuration option, only for gif images) if ($this->conf['additionalPathForTypeIcons']) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $imageConf['file'] = str_replace(PATH_site, '', TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->conf['additionalPathForTypeIcons'] . $name . '.gif')); - } else { - $imageConf['file'] = str_replace(PATH_site, '', t3lib_div::getFileAbsFileName($this->conf['additionalPathForTypeIcons'] . $name . '.gif')); - } + $imageConf['file'] = str_replace(PATH_site, '', TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->conf['additionalPathForTypeIcons'] . $name . '.gif')); } } // fallback: default image if(!is_file(PATH_site . $imageConf['file'])) { - if (TYPO3_VERSION_INTEGER < 6002000) { - $imageConf['file'] = t3lib_extMgm::siteRelPath($this->extKey) . 'res/img/types/' . $name . '.gif'; - } else { - $imageConf['file'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/types/' . $name . '.gif'; - } + $imageConf['file'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/types/' . $name . '.gif'; // fallback for file results: use default if no image for this file extension is available if($type == 'file' && !is_file(PATH_site . $imageConf['file'])) { - if (TYPO3_VERSION_INTEGER < 6002000) { - $imageConf['file'] = t3lib_extMgm::siteRelPath($this->extKey) . 'res/img/types/file.gif'; - } else { - $imageConf['file'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/types/file.gif'; - } + $imageConf['file'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/types/file.gif'; } } - if (TYPO3_VERSION_INTEGER < 7000000) { - $rendered = $this->cObj->IMAGE($imageConf); - } else { - $rendered = $this->cObj->cObjGetSingle('IMAGE', $imageConf); - } + $rendered = $this->cObj->cObjGetSingle('IMAGE', $imageConf); return $rendered; } @@ -1910,11 +1731,7 @@ public function getFilterPreselect() { // and proceed only when preselectedFilter was not set // this reduces the amount of sql queries, too if($this->conf['preselected_filters'] && count($this->preselectedFilter) == 0) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $preselectedArray = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['preselected_filters'], true); - } else { - $preselectedArray = t3lib_div::trimExplode(',', $this->conf['preselected_filters'], true); - } + $preselectedArray = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['preselected_filters'], true); foreach ($preselectedArray as $option) { $option = intval($option); $fields = ' @@ -1970,11 +1787,7 @@ public function addHeaderParts() { $linkconf['parameter'] = $this->conf['resultPage']; $linkconf['additionalParams'] = ''; $linkconf['useCacheHash'] = false; - if (TYPO3_VERSION_INTEGER >= 7000000) { - $targetUrl = TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkconf)); - } else { - $targetUrl = t3lib_div::locationHeaderUrl($this->cObj->typoLink_URL($linkconf)); - } + $targetUrl = TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkconf)); $content = $this->cObj->getSubpart($this->templateCode, '###JS_SEARCH_ALL###'); if($this->conf['renderMethod'] != 'static' ) { @@ -1993,11 +1806,7 @@ public function addHeaderParts() { } // define some additional markers - if (TYPO3_VERSION_INTEGER < 6002000) { - $markerArray['###SITE_REL_PATH###'] = t3lib_extMgm::siteRelPath($this->extKey); - } else { - $markerArray['###SITE_REL_PATH###'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey); - } + $markerArray['###SITE_REL_PATH###'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey); $markerArray['###TARGET_URL###'] = $targetUrl; $markerArray['###PREFIX_ID###'] = $this->prefixId; $markerArray['###SEARCHBOX_DEFAULT_VALUE###'] = $this->pi_getLL('searchbox_default_value'); @@ -2006,11 +1815,7 @@ public function addHeaderParts() { $content = $this->cObj->substituteMarkerArray($content, $markerArray); // add JS to page header - if (TYPO3_VERSION_INTEGER >= 6000000) { - $GLOBALS['TSFE']->getPageRenderer()->addHeaderData($content); - } else { - $GLOBALS['TSFE']->additionalHeaderData['jsContent'] = $content; - } + $GLOBALS['TSFE']->getPageRenderer()->addHeaderData($content); } diff --git a/Classes/lib/class.tx_kesearch_lib_div.php b/Classes/lib/class.tx_kesearch_lib_div.php index 8d336daf..ad17bf0b 100644 --- a/Classes/lib/class.tx_kesearch_lib_div.php +++ b/Classes/lib/class.tx_kesearch_lib_div.php @@ -98,11 +98,7 @@ public function getFirstStartingPoint($pages = 0) { * @return string XSS safe value */ public function removeXSS($value) { - if (TYPO3_VERSION_INTEGER >= 6002000) { - $returnValue = TYPO3\CMS\Core\Utility\GeneralUtility::removeXSS($value); - } else { - $returnValue = t3lib_div::removeXSS($value); - } + $returnValue = TYPO3\CMS\Core\Utility\GeneralUtility::removeXSS($value); return $returnValue; } diff --git a/Classes/lib/class.tx_kesearch_lib_fileinfo.php b/Classes/lib/class.tx_kesearch_lib_fileinfo.php index f821e60b..616c357f 100644 --- a/Classes/lib/class.tx_kesearch_lib_fileinfo.php +++ b/Classes/lib/class.tx_kesearch_lib_fileinfo.php @@ -67,11 +67,7 @@ protected function setFileInformations($file) { $this->file = $file instanceof \TYPO3\CMS\Core\Resource\File ? $file : NULL; if(is_string($file) && !empty($file)) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $this->fileInfo = TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($file); - } else { - $this->fileInfo = t3lib_div::split_fileref($file); - } + $this->fileInfo = TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($file); $this->fileInfo['mtime'] = filemtime($file); $this->fileInfo['atime'] = fileatime($file); $this->fileInfo['owner'] = fileowner($file); diff --git a/Classes/lib/class.tx_kesearch_lib_helper.php b/Classes/lib/class.tx_kesearch_lib_helper.php index e585c762..27af1ec5 100644 --- a/Classes/lib/class.tx_kesearch_lib_helper.php +++ b/Classes/lib/class.tx_kesearch_lib_helper.php @@ -46,11 +46,7 @@ public static function getExtConf() { // so you we need to change the default char # against something else. // MySQL has problems also with # // but we wrap # with " and it works. - if (TYPO3_VERSION_INTEGER < 6002000) { - $keSearchPremiumIsLoaded = t3lib_extMgm::isLoaded('ke_search_premium'); - } else { - $keSearchPremiumIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_search_premium'); - } + $keSearchPremiumIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_search_premium'); if ($keSearchPremiumIsLoaded) { $extConfPremium = tx_kesearch_helper::getExtConfPremium(); $extConf['prePostTagChar'] = $extConfPremium['prePostTagChar']; @@ -79,11 +75,7 @@ public static function getExtConf() { * @since 14.10.14 */ public static function getExtConfPremium() { - if (TYPO3_VERSION_INTEGER < 6002000) { - $keSearchPremiumIsLoaded = t3lib_extMgm::isLoaded('ke_search_premium'); - } else { - $keSearchPremiumIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_search_premium'); - } + $keSearchPremiumIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_search_premium'); if ($keSearchPremiumIsLoaded) { $extConfPremium = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ke_search_premium']); if (!$extConfPremium['prePostTagChar']) $extConfPremium['prePostTagChar'] = '_'; @@ -117,11 +109,7 @@ public static function getCategories($uid, $table) { ); if ($uid && $table) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $enableFields = \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_category') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_category'); - } else { - $enableFields = t3lib_befunc::BEenableFields('sys_category') . t3lib_befunc::deleteClause('sys_category'); - } + $enableFields = \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_category') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_category'); $resCat = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( 'sys_category.uid, sys_category.title', 'sys_category', diff --git a/Classes/lib/class.tx_kesearch_lib_items.php b/Classes/lib/class.tx_kesearch_lib_items.php index 1b9537ae..a6b6e143 100644 --- a/Classes/lib/class.tx_kesearch_lib_items.php +++ b/Classes/lib/class.tx_kesearch_lib_items.php @@ -35,11 +35,7 @@ public function fillIndexerConfig(&$params, $pObj) { // hook for custom registration of further indexerConfigurations if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerIndexerConfiguration'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerIndexerConfiguration'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->registerIndexerConfiguration($params, $pObj); } } diff --git a/Classes/lib/class.tx_kesearch_lib_searchphrase.php b/Classes/lib/class.tx_kesearch_lib_searchphrase.php index 179f189a..47dff49d 100644 --- a/Classes/lib/class.tx_kesearch_lib_searchphrase.php +++ b/Classes/lib/class.tx_kesearch_lib_searchphrase.php @@ -120,11 +120,7 @@ public function explodeSearchPhrase($searchString) { $word = trim($word, '+-~<>'); // check for word length - if (TYPO3_VERSION_INTEGER >= 7000000) { - $csconv = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter'); - } else { - $csconv = t3lib_div::makeInstance('t3lib_cs'); - } + $csconv = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter'); $searchWordLength = $csconv->utf8_strlen($word); if($searchWordLength < $this->pObj->extConf['searchWordLength']) { $this->pObj->hasTooShortWords = true; @@ -228,11 +224,7 @@ public function buildPiVarsTagsAgainst(array &$tagsAgainst) { // hook for modifiying the tags to filter for if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyTagsAgainst'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyTagsAgainst'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyTagsAgainst($tagsAgainst, $this); } } diff --git a/Classes/lib/class.tx_kesearch_lib_searchresult.php b/Classes/lib/class.tx_kesearch_lib_searchresult.php index cd6fa491..120faa4b 100644 --- a/Classes/lib/class.tx_kesearch_lib_searchresult.php +++ b/Classes/lib/class.tx_kesearch_lib_searchresult.php @@ -102,11 +102,7 @@ public function getTitle() { if ($this->row['orig_uid']) { $fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository'); $fileObject = $fileRepository->findByUid($this->row['orig_uid']); - if (TYPO3_VERSION_INTEGER >= 6002000) { - $metadata = $fileObject->_getMetaData(); - } else { - $metadata = array(); - } + $metadata = $fileObject->_getMetaData(); $linktext = ($metadata['title'] ? $metadata['title'] : $this->row['title']); } else { $linktext = $this->row['title']; diff --git a/Classes/lib/class.tx_kesearch_lib_sorting.php b/Classes/lib/class.tx_kesearch_lib_sorting.php index 70928925..10c55eb1 100644 --- a/Classes/lib/class.tx_kesearch_lib_sorting.php +++ b/Classes/lib/class.tx_kesearch_lib_sorting.php @@ -88,11 +88,7 @@ public function init(tx_kesearch_lib $pObj) { $this->subpartArray['###SORT_LINK###'] = $this->cObj->getSubpart($this->subpartArray['###ORDERNAVIGATION###'], '###SORT_LINK###'); // get sorting values (sortdate, title, what ever...) - if (TYPO3_VERSION_INTEGER >= 7000000) { - $this->sortBy = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['sortByVisitor'], true); - } else { - $this->sortBy = t3lib_div::trimExplode(',', $this->conf['sortByVisitor'], true); - } + $this->sortBy = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['sortByVisitor'], true); } @@ -113,11 +109,7 @@ public function renderSorting(&$fluidTemplateVariables) { // we can't sort by score if there is no sword given if($this->pObj->sword != '' || $field != 'score') { $sortByDir = $this->getDefaultSortingDirection($field); - if (TYPO3_VERSION_INTEGER >= 7000000) { - $dbOrdering = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $this->db->getOrdering()); - } else { - $dbOrdering = t3lib_div::trimExplode(' ', $this->db->getOrdering()); - } + $dbOrdering = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $this->db->getOrdering()); /* if ordering direction is the same change it * @@ -191,11 +183,7 @@ public function getDefaultSortingDirection($field) { public function changeOrdering($direction) { $allowedDirections = array('asc', 'desc'); $direction = strtolower($direction); - if (TYPO3_VERSION_INTEGER >= 7000000) { - $isInArray = TYPO3\CMS\Core\Utility\GeneralUtility::inArray($allowedDirections, $direction); - } else { - $isInArray = t3lib_div::inArray($allowedDirections, $direction); - } + $isInArray = TYPO3\CMS\Core\Utility\GeneralUtility::inArray($allowedDirections, $direction); if(!empty($direction) && $isInArray) { if($direction == 'asc') { $direction = 'desc'; diff --git a/Classes/lib/filters/class.tx_kesearch_lib_filters_textlinks.php b/Classes/lib/filters/class.tx_kesearch_lib_filters_textlinks.php index 8e5f3464..ffc1cda5 100644 --- a/Classes/lib/filters/class.tx_kesearch_lib_filters_textlinks.php +++ b/Classes/lib/filters/class.tx_kesearch_lib_filters_textlinks.php @@ -135,11 +135,7 @@ public function renderTextlinks($filterUid, $optionsOfSearchresult, $lib) { // modify filter options by hook if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptions'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptions'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $contentOptions .= $_procObj->modifyFilterOptions( $filterUid, $contentOptions, @@ -217,11 +213,7 @@ public function getOptionsOfFilter($filter, $additionalOptionValues) { // build intersection of both arrays $optionsOfCurrentFilter = array_intersect_key($allOptionsOfCurrentFilter, $additionalOptionValues); // merge additional values into option array - if (TYPO3_VERSION_INTEGER >= 7000000) { - \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($optionsOfCurrentFilter, (array)$additionalOptionValues); - } else { - $optionsOfCurrentFilter = t3lib_div::array_merge_recursive_overrule((array)$optionsOfCurrentFilter, (array)$additionalOptionValues); - } + \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($optionsOfCurrentFilter, (array)$additionalOptionValues); // return sorted option array return $this->sortMultiDimArray($optionsOfCurrentFilter); } else return array(); @@ -337,11 +329,7 @@ public function generateLink($filterUid, $option) { // This is useful if you want to define special sortings for each textlink if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyParamsForTextlinks'])) { foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyParamsForTextlinks'] as $_classRef) { - if (TYPO3_VERSION_INTEGER >= 7000000) { - $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); - } else { - $_procObj = & t3lib_div::getUserObj($_classRef); - } + $_procObj = & TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $_procObj->modifyParamsForTextlinks($params, $excludes, $option, $this->conf, $this->pObj); } } diff --git a/Resources/Private/Partials/Filters.html b/Resources/Private/Partials/Filters.html index ef3f1b54..362b1880 100644 --- a/Resources/Private/Partials/Filters.html +++ b/Resources/Private/Partials/Filters.html @@ -4,7 +4,6 @@ -->The indexer is already running and can not be started twice.
'; $content .= 'The indexing process was started at '.strftime('%c', $lockTime).'.
'; $content .= 'You can remove the lock by clicking the following button.
'; - if (TYPO3_VERSION_INTEGER < 6002000) { - $content .= '' . $GLOBALS['LANG']->getLL('index_contains') . ' ' . $this->getNumberOfRecordsInIndex() . ' ' . $GLOBALS['LANG']->getLL('records') . '.
'; // show "clear index" link - if (TYPO3_VERSION_INTEGER < 6002000) { - $content .= 'Clear search index: This function is available to admins only.
'; } @@ -552,14 +488,8 @@ function getIndexedContent($pageUid) { $table = 'tx_kesearch_index'; $where = '(type="page" AND targetpid="'.intval($pageUid).'") '; $where .= 'OR (type<>"page" AND pid="'.intval($pageUid).'") '; - - if (TYPO3_VERSION_INTEGER >= 7000000) { - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table,$inv=0); - $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table,$inv=0); - } else { - $where .= t3lib_befunc::BEenableFields($table,$inv=0); - $where .= t3lib_befunc::deleteClause($table,$inv=0); - } + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table,$inv=0); + $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table,$inv=0); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields,$table,$where,$groupBy='',$orderBy='',$limit=''); @@ -568,11 +498,7 @@ function getIndexedContent($pageUid) { // build tag table $tagTable = '