Revert "[TASK] Rebuild the calcAge functionality"
[Packages/TYPO3.CMS.git] / typo3 / sysext / indexed_search / Classes / Controller / SearchController.php
index ff8f073..27d6e0e 100644 (file)
 <?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2011 Benjamin Mack (benni@typo3.org)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
+namespace TYPO3\CMS\IndexedSearch\Controller;
+
+/**
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Index search frontend
  *
  * Creates a searchform for indexed search. Indexing must be enabled
  * for this to make sense.
  *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @author     Christian Jul Jensen <christian@typo3.com>
- * @author     Benjamin Mack <benni@typo3.org>
- *
- * The following variables can be sent from the form
- *
- * _sections
- * _freeIndexUid
- * pointer
- * sword
- * sword_prev
- * sword_prev_include
- * type
- * defOp
- * media
- * lang
- * sections
- * freeIndexUid
- * order
- * desc
- * results
- * group
- * extResume
- * submit_button
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @author     Christian Jul Jensen <christian@typo3.com>
+ * @author     Benjamin Mack <benni@typo3.org>
  */
-class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Controller_ActionController {
+class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
 
-
-               // previously known as $this->piVars['sword']
+       // previously known as $this->piVars['sword']
        protected $sword = NULL;
+
        protected $searchWords = array();
+
        protected $searchData;
 
-               // This is the id of the site root.
-               // This value may be a commalist of integer (prepared for this)
-               // Root-page PIDs to search in (rl0 field where clause, see initialize() function)
+       // This is the id of the site root.
+       // This value may be a commalist of integer (prepared for this)
+       // Root-page PIDs to search in (rl0 field where clause, see initialize() function)
        protected $searchRootPageIdList = 0;
 
        protected $defaultResultNumber = 10;
 
-
        /**
         * Lexer object
         *
-        * @var Tx_IndexedSearch_Domain_Repository_IndexSearchRepository
+        * @var \TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository
         */
        protected $searchRepository = NULL;
 
        /**
         * Lexer object
         *
-        * @var tx_indexedsearch_lexer
+        * @var \TYPO3\CMS\IndexedSearch\Lexer
         */
        protected $lexerObj;
 
-               // External parser objects
+       // External parser objects
        protected $externalParsers = array();
 
-               // Will hold the first row in result - used to calculate relative hit-ratings.
+       // Will hold the first row in result - used to calculate relative hit-ratings.
        protected $firstRow = array();
 
-               // Domain records (needed ?)
+       // Domain records (needed ?)
        protected $domainRecords = array();
-               // Required fe_groups memberships for display of a result.
+
+       // Required fe_groups memberships for display of a result.
        protected $requiredFrontendUsergroups = array();
-               // Page tree sections for search result.
+
+       // Page tree sections for search result.
        protected $resultSections = array();
-               // Caching of page path
+
+       // Caching of page path
        protected $pathCache = array();
-               // Storage of icons
+
+       // Storage of icons
        protected $iconFileNameCache = array();
-               // Indexer configuration, coming from $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']
+
+       // Indexer configuration, coming from $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']
        protected $indexerConfig = array();
 
        /**
@@ -114,72 +90,54 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                if (!is_array($searchData)) {
                        $searchData = array();
                }
-
-                       // setting default values
+               // setting default values
                if (is_array($this->settings['defaultOptions'])) {
                        $searchData = array_merge($this->settings['defaultOptions'], $searchData);
                }
-
-
-                       // Indexer configuration from Extension Manager interface:
+               // Indexer configuration from Extension Manager interface:
                $this->indexerConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']);
                $this->enableMetaphoneSearch = $this->indexerConfig['enableMetaphoneSearch'] ? TRUE : FALSE;
-
                $this->initializeExternalParsers();
-
-                       // If "_sections" is set, this value overrides any existing value.
+               // If "_sections" is set, this value overrides any existing value.
                if ($searchData['_sections']) {
                        $searchData['sections'] = $searchData['_sections'];
                }
-
-                       // If "_sections" is set, this value overrides any existing value.
+               // If "_sections" is set, this value overrides any existing value.
                if ($searchData['_freeIndexUid'] !== '' && $searchData['_freeIndexUid'] !== '_') {
                        $searchData['freeIndexUid'] = $searchData['_freeIndexUid'];
                }
-
-               $searchData['results'] = t3lib_utility_Math::forceIntegerInRange($searchData['results'], 1, 100000, $this->defaultResultNumber);
-
-
-                       // This gets the search-words into the $searchWordArray
+               $searchData['results'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($searchData['results'], 1, 100000, $this->defaultResultNumber);
+               // This gets the search-words into the $searchWordArray
                $this->sword = $searchData['sword'];
-
-                       // Add previous search words to current
+               // Add previous search words to current
                if ($searchData['sword_prev_include'] && $searchData['sword_prev']) {
                        $this->sword = trim($searchData['sword_prev']) . ' ' . $this->sword;
                }
-
                $this->searchWords = $this->getSearchWords($searchData['defaultOperand']);
-
-
-                       // This is the id of the site root.
-                       // This value may be a commalist of integer (prepared for this)
-               $this->searchRootPageIdList = intval($GLOBALS['TSFE']->config['rootLine'][0]['uid']);
-
-                       // Setting the list of root PIDs for the search. Notice, these page IDs MUST
-                       // have a TypoScript template with root flag on them! Basically this list is used
-                       // to select on the "rl0" field and page ids are registered as "rl0" only if
-                       // a TypoScript template record with root flag is there.
-                       // This happens AFTER the use of $this->searchRootPageIdList above because
-                       // the above will then fetch the menu for the CURRENT site - regardless
-                       // of this kind of searching here. Thus a general search will lookup in
-                       // the WHOLE database while a specific section search will take the current sections.
+               // This is the id of the site root.
+               // This value may be a commalist of integer (prepared for this)
+               $this->searchRootPageIdList = (int)$GLOBALS['TSFE']->config['rootLine'][0]['uid'];
+               // Setting the list of root PIDs for the search. Notice, these page IDs MUST
+               // have a TypoScript template with root flag on them! Basically this list is used
+               // to select on the "rl0" field and page ids are registered as "rl0" only if
+               // a TypoScript template record with root flag is there.
+               // This happens AFTER the use of $this->searchRootPageIdList above because
+               // the above will then fetch the menu for the CURRENT site - regardless
+               // of this kind of searching here. Thus a general search will lookup in
+               // the WHOLE database while a specific section search will take the current sections.
                if ($this->settings['rootPidList']) {
-                       $this->searchRootPageIdList = implode(',', t3lib_div::intExplode(',', $this->settings['rootPidList']));
+                       $this->searchRootPageIdList = implode(',', GeneralUtility::intExplode(',', $this->settings['rootPidList']));
                }
-
-               $this->searchRepository = t3lib_div::makeInstance('Tx_IndexedSearch_Domain_Repository_IndexSearchRepository');
+               $this->searchRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\IndexedSearch\\Domain\\Repository\\IndexSearchRepository');
                $this->searchRepository->initialize($this->settings, $searchData, $this->externalParsers, $this->searchRootPageIdList);
-
                $this->searchData = $searchData;
-
-                       // Calling hook for modification of initialized content
+               // Calling hook for modification of initialized content
                if ($hookObj = $this->hookRequest('initialize_postProc')) {
                        $hookObj->initialize_postProc();
                }
                return $searchData;
        }
 
-
        /**
         * Performs the search, the display and writing stats
         *
@@ -189,55 +147,43 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        public function searchAction($search = array()) {
                $searchData = $this->initialize($search);
-
-                       // Find free index uid:
+               // Find free index uid:
                $freeIndexUid = $searchData['freeIndexUid'];
                if ($freeIndexUid == -2) {
                        $freeIndexUid = $this->settings['defaultFreeIndexUidList'];
                } elseif (!isset($searchData['freeIndexUid'])) {
-                               // index configuration is disabled
+                       // index configuration is disabled
                        $freeIndexUid = -1;
                }
-
-               $indexCfgs = t3lib_div::intExplode(',', $freeIndexUid);
-
+               $indexCfgs = GeneralUtility::intExplode(',', $freeIndexUid);
                $resultsets = array();
                foreach ($indexCfgs as $freeIndexUid) {
-
-                               // Get result rows
-                       $tstamp1 = t3lib_div::milliseconds();
+                       // Get result rows
+                       $tstamp1 = GeneralUtility::milliseconds();
                        if ($hookObj = $this->hookRequest('getResultRows')) {
                                $resultData = $hookObj->getResultRows($this->searchWords, $freeIndexUid);
                        } else {
                                $resultData = $this->searchRepository->doSearch($this->searchWords, $freeIndexUid);
                        }
-
-                               // Display search results
-                       $tstamp2 = t3lib_div::milliseconds();
+                       // Display search results
+                       $tstamp2 = GeneralUtility::milliseconds();
                        if ($hookObj = $this->hookRequest('getDisplayResults')) {
                                $resultsets[$freeIndexUid] = $hookObj->getDisplayResults($this->searchWords, $resultData, $freeIndexUid);
                        } else {
                                $resultsets[$freeIndexUid] = $this->getDisplayResults($this->searchWords, $resultData, $freeIndexUid);
                        }
-
-                       $tstamp3 = t3lib_div::milliseconds();
-
-                               // Create header if we are searching more than one indexing configuration
+                       $tstamp3 = GeneralUtility::milliseconds();
+                       // Create header if we are searching more than one indexing configuration
                        if (count($indexCfgs) > 1) {
                                if ($freeIndexUid > 0) {
-                                       $indexCfgRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
-                                               'title',
-                                               'index_config',
-                                               'uid=' . intval($freeIndexUid) . $GLOBALS['TSFE']->cObj->enableFields('index_config')
-                                       );
+                                       $indexCfgRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('title', 'index_config', 'uid=' . (int)$freeIndexUid . $GLOBALS['TSFE']->cObj->enableFields('index_config'));
                                        $categoryTitle = $indexCfgRec['title'];
                                } else {
-                                       $categoryTitle = Tx_Extbase_Utility_Localization::translate('indexingConfigurationHeader.' . $freeIndexUid, 'indexed_search');
+                                       $categoryTitle = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('indexingConfigurationHeader.' . $freeIndexUid, 'indexed_search');
                                }
                                $resultsets[$freeIndexUid]['categoryTitle'] = $categoryTitle;
                        }
-
-                               // Write search statistics
+                       // Write search statistics
                        $this->writeSearchStat($searchData, $this->searchWords, $resultData['count'], array($tstamp1, $tstamp2, $tstamp3));
                }
                $this->view->assign('resultsets', $resultsets);
@@ -245,14 +191,10 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                $this->view->assign('searchWords', $this->searchWords);
        }
 
-
-
        /****************************************
         * functions to make the result rows and result sets
         * ready for the output
         ***************************************/
-
-
        /**
         * Compiles the HTML display of the incoming array of result rows.
         *
@@ -266,29 +208,24 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                        'count' => $resultData['count'],
                        'searchWords' => $searchWords
                );
-
-                       // Perform display of result rows array
+               // Perform display of result rows array
                if ($resultData) {
-                               // Set first selected row (for calculation of ranking later)
+                       // Set first selected row (for calculation of ranking later)
                        $this->firstRow = $resultData['firstRow'];
-
-                               // Result display here
+                       // Result display here
                        $result['rows'] = $this->compileResultRows($resultData['resultRows'], $freeIndexUid);
                        $result['affectedSections'] = $this->resultSections;
-                               // Browsing box
+                       // Browsing box
                        if ($resultData['count']) {
-
-                                       // could we get this in the view?
+                               // could we get this in the view?
                                if ($this->searchData['group'] == 'sections' && $freeIndexUid <= 0) {
-                                       $result['sectionText'] = sprintf(Tx_Extbase_Utility_Localization::translate('result.' . (count($this->resultSections) > 1 ? 'inNsections' : 'inNsection'), 'indexed_search'), count($this->resultSections));
+                                       $result['sectionText'] = sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.' . (count($this->resultSections) > 1 ? 'inNsections' : 'inNsection'), 'indexed_search'), count($this->resultSections));
                                }
                        }
                }
-
-                       // Print a message telling which words in which sections we searched for
+               // Print a message telling which words in which sections we searched for
                if (substr($this->searchData['sections'], 0, 2) == 'rl') {
-                       $result['searchedInSectionInfo'] = Tx_Extbase_Utility_Localization::translate('result.inSection', 'indexed_search')
-                       . ' "' . substr($this->getPathFromPageId(substr($this->searchData['sections'], 4)), 1) . '"';
+                       $result['searchedInSectionInfo'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.inSection', 'indexed_search') . ' "' . substr($this->getPathFromPageId(substr($this->searchData['sections'], 4)), 1) . '"';
                }
                return $result;
        }
@@ -303,21 +240,19 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        protected function compileResultRows($resultRows, $freeIndexUid = -1) {
                $finalResultRows = array();
-
-                       // Transfer result rows to new variable,
-                       // performing some mapping of sub-results etc.
+               // Transfer result rows to new variable,
+               // performing some mapping of sub-results etc.
                $newResultRows = array();
                foreach ($resultRows as $row) {
                        $id = md5($row['phash_grouping']);
                        if (is_array($newResultRows[$id])) {
-                                       // swapping:
+                               // swapping:
                                if (!$newResultRows[$id]['show_resume'] && $row['show_resume']) {
-                                               // Remove old
+                                       // Remove old
                                        $subrows = $newResultRows[$id]['_sub'];
                                        unset($newResultRows[$id]['_sub']);
                                        $subrows[] = $newResultRows[$id];
-
-                                               // Insert new:
+                                       // Insert new:
                                        $newResultRows[$id] = $row;
                                        $newResultRows[$id]['_sub'] = $subrows;
                                } else {
@@ -329,17 +264,14 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                }
                $resultRows = $newResultRows;
                $this->resultSections = array();
-
                if ($freeIndexUid <= 0 && $this->searchData['group'] == 'sections') {
                        $rl2flag = substr($this->searchData['sections'], 0, 2) == 'rl';
                        $sections = array();
                        foreach ($resultRows as $row) {
-                               $id = $row['rl0'].'-'.$row['rl1'].($rl2flag?'-'.$row['rl2']:'');
+                               $id = $row['rl0'] . '-' . $row['rl1'] . ($rl2flag ? '-' . $row['rl2'] : '');
                                $sections[$id][] = $row;
                        }
-
                        $this->resultSections = array();
-
                        foreach ($sections as $id => $resultRows) {
                                $rlParts = explode('-', $id);
                                if ($rlParts[2]) {
@@ -352,33 +284,29 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                                        $theId = $rlParts[0];
                                        $theRLid = '0';
                                }
-
                                $sectionName = $this->getPathFromPageId($theId);
                                $sectionName = ltrim($sectionName, '/');
-
                                if (!trim($sectionName)) {
-                                       $sectionTitleLinked = Tx_Extbase_Utility_Localization::translate('result.unnamedSection', 'indexed_search') . ':';
+                                       $sectionTitleLinked = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.unnamedSection', 'indexed_search') . ':';
                                } else {
-                                       $onclick = 'document.'.$this->prefixId.'[\''.$this->prefixId.'[_sections]\'].value=\''.$theRLid.'\';document.'.$this->prefixId.'.submit();return false;';
-                                       $sectionTitleLinked = '<a href="#" onclick="'.htmlspecialchars($onclick).'">'.htmlspecialchars($sectionName).':</a>';
+                                       $onclick = 'document.' . $this->prefixId . '[\'' . $this->prefixId . '[_sections]\'].value=\'' . $theRLid . '\';document.' . $this->prefixId . '.submit();return false;';
+                                       $sectionTitleLinked = '<a href="#" onclick="' . htmlspecialchars($onclick) . '">' . htmlspecialchars($sectionName) . ':</a>';
                                }
                                $this->resultSections[$id] = array($sectionName, count($resultRows));
-
-                                       // Add section header
+                               // Add section header
                                $finalResultRows[] = array(
                                        'isSectionHeader' => TRUE,
-                                       'numResultRows'   => count($resultRows),
-                                       'anchorName'      => 'anchor_' . md5($id),
-                                       'sectionTitle'    => $sectionTitleLinked
+                                       'numResultRows' => count($resultRows),
+                                       'anchorName' => 'anchor_' . md5($id),
+                                       'sectionTitle' => $sectionTitleLinked
                                );
-
-                                       // Render result rows
+                               // Render result rows
                                foreach ($resultRows as $row) {
                                        $finalResultRows[] = $this->compileSingleResultRow($row);
                                }
                        }
                } else {
-                               // flat mode or no sections at all
+                       // flat mode or no sections at all
                        foreach ($resultRows as $row) {
                                $finalResultRows[] = $this->compileSingleResultRow($row);
                        }
@@ -386,8 +314,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                return $finalResultRows;
        }
 
-
-
        /**
         * This prints a single result row, including a recursive call for subrows.
         *
@@ -397,48 +323,40 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        protected function compileSingleResultRow($row, $headerOnly = 0) {
                $specRowConf = $this->getSpecialConfigForResultRow($row);
-
                $resultData = $row;
                $resultData['headerOnly'] = $headerOnly;
                $resultData['CSSsuffix'] = $specRowConf['CSSsuffix'] ? '-' . $specRowConf['CSSsuffix'] : '';
-
                if ($this->multiplePagesType($row['item_type'])) {
                        $dat = unserialize($row['cHashParams']);
                        $pp = explode('-', $dat['key']);
                        if ($pp[0] != $pp[1]) {
-                               $resultData['titleaddition'] = ', ' . Tx_Extbase_Utility_Localization::translate('result.page', 'indexed_search') . ' ' . $dat['key'];
+                               $resultData['titleaddition'] = ', ' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.page', 'indexed_search') . ' ' . $dat['key'];
                        } else {
-                               $resultData['titleaddition'] = ', ' . Tx_Extbase_Utility_Localization::translate('result.pages', 'indexed_search') . ' ' . $pp[0];
+                               $resultData['titleaddition'] = ', ' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.pages', 'indexed_search') . ' ' . $pp[0];
                        }
                }
                $title = $resultData['item_title'] . $resultData['titleaddition'];
-               $title = htmlspecialchars($title);
-
-
-                       // If external media, link to the media-file instead.
+               // If external media, link to the media-file instead.
                if ($row['item_type']) {
                        if ($row['show_resume']) {
-                                       // Can link directly.
+                               // Can link directly.
                                $targetAttribute = '';
                                if ($GLOBALS['TSFE']->config['config']['fileTarget']) {
                                        $targetAttribute = ' target="' . htmlspecialchars($GLOBALS['TSFE']->config['config']['fileTarget']) . '"';
                                }
-                               $title = '<a href="' . htmlspecialchars($row['data_filename']) . '"' . $targetAttribute . '>' .
-                                       $title .
-                                       '</a>';
+                               $title = '<a href="' . htmlspecialchars($row['data_filename']) . '"' . $targetAttribute . '>' . htmlspecialchars($title) . '</a>';
                        } else {
-                                       // Suspicious, so linking to page instead...
+                               // Suspicious, so linking to page instead...
                                $copiedRow = $row;
                                unset($copiedRow['cHashParams']);
                                $title = $this->linkPage($row['page_id'], $title, $copiedRow);
                        }
                } else {
-                               // Else the page:
-
-                               // Prepare search words for markup in content:
+                       // Else the page:
+                       // Prepare search words for markup in content:
                        if ($this->settings['forwardSearchWordsInResultLink']) {
                                $markUpSwParams = array('no_cache' => 1);
-                               foreach ($this->sWArr as $d) {
+                               foreach ($this->searchWords as $d) {
                                        $markUpSwParams['sword_list'][] = $d['sword'];
                                }
                        } else {
@@ -446,58 +364,50 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                        }
                        $title = $this->linkPage($row['data_page_id'], $title, $row, $markUpSwParams);
                }
-
-               $resultData['title']       = $title;
-               $resultData['icon']        = $this->makeItemTypeIcon($row['item_type'], '', $specRowConf);
-               $resultData['rating']      = $this->makeRating($row);
-               $resultData['description'] = $this->makeDescription($row, ($this->searchData['extResume'] && !$headerOnly) ? 0 : 1);
-               $resultData['language']    = $this->makeLanguageIndication($row);
-
-               $resultData['size']     = t3lib_div::formatSize($row['item_size']);
-               $resultData['created']  = $row['item_crdate'];
+               $resultData['title'] = $title;
+               $resultData['icon'] = $this->makeItemTypeIcon($row['item_type'], '', $specRowConf);
+               $resultData['rating'] = $this->makeRating($row);
+               $resultData['description'] = $this->makeDescription($row, $this->searchData['extResume'] && !$headerOnly ? 0 : 1);
+               $resultData['language'] = $this->makeLanguageIndication($row);
+               $resultData['size'] = GeneralUtility::formatSize($row['item_size']);
+               $resultData['created'] = $row['item_crdate'];
                $resultData['modified'] = $row['item_mtime'];
-
                $pI = parse_url($row['data_filename']);
                if ($pI['scheme']) {
                        $targetAttribute = '';
                        if ($GLOBALS['TSFE']->config['config']['fileTarget']) {
                                $targetAttribute = ' target="' . htmlspecialchars($GLOBALS['TSFE']->config['config']['fileTarget']) . '"';
                        }
-                       $resultData['path'] = '<a href="' . htmlspecialchars($row['data_filename']) . '"' . $targetAttribute . '>' .
-                               htmlspecialchars($row['data_filename']) .
-                               '</a>';
+                       $resultData['path'] = '<a href="' . htmlspecialchars($row['data_filename']) . '"' . $targetAttribute . '>' . htmlspecialchars($row['data_filename']) . '</a>';
                } else {
-                       $pathId = $row['data_page_id'] ? $row['data_page_id'] : $row['page_id'];
+                       $pathId = $row['data_page_id'] ?: $row['page_id'];
                        $pathMP = $row['data_page_id'] ? $row['data_page_mp'] : '';
                        $pathStr = htmlspecialchars($this->getPathFromPageId($pathId, $pathMP));
                        $resultData['path'] = $this->linkPage($pathId, $pathStr, array(
-                               'cHashParams'      => $row['cHashParams'],
-                               'data_page_type'   => $row['data_page_type'],
-                               'data_page_mp'     => $pathMP,
-                               'sys_language_uid' => $row['sys_language_uid'],
+                               'cHashParams' => $row['cHashParams'],
+                               'data_page_type' => $row['data_page_type'],
+                               'data_page_mp' => $pathMP,
+                               'sys_language_uid' => $row['sys_language_uid']
                        ));
-
-                               // check if the access is restricted
+                       // check if the access is restricted
                        if (is_array($this->requiredFrontendUsergroups[$id]) && count($this->requiredFrontendUsergroups[$id])) {
-                               $resultData['access'] = '<img src="' . t3lib_extMgm::siteRelPath('indexed_search') . 'pi/res/locked.gif" width="12" height="15" vspace="5" title="' . sprintf(Tx_Extbase_Utility_Localization::translate('result.memberGroups', 'indexed_search'), implode(',', array_unique($this->requiredFrontendUsergroups[$id]))) . '" alt="" />';
+                               $resultData['access'] = '<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('indexed_search') . 'pi/res/locked.gif" width="12" height="15" vspace="5" title="' . sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.memberGroups', 'indexed_search'), implode(',', array_unique($this->requiredFrontendUsergroups[$id]))) . '" alt="" />';
                        }
                }
-
-                       // If there are subrows (eg. subpages in a PDF-file or if a duplicate page
-                       // is selected due to user-login (phash_grouping))
+               // If there are subrows (eg. subpages in a PDF-file or if a duplicate page
+               // is selected due to user-login (phash_grouping))
                if (is_array($row['_sub'])) {
                        $resultData['subresults'] = array();
                        if ($this->multiplePagesType($row['item_type'])) {
-                               $resultData['subresults']['header'] = Tx_Extbase_Utility_Localization::translate('result.otherMatching', 'indexed_search');
+                               $resultData['subresults']['header'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.otherMatching', 'indexed_search');
                                foreach ($row['_sub'] as $subRow) {
                                        $resultData['subresults']['items'][] = $this->compileSingleResultRow($subRow, 1);
                                }
                        } else {
-                               $resultData['subresults']['header'] = Tx_Extbase_Utility_Localization::translate('result.otherMatching', 'indexed_search');
-                               $resultData['subresults']['info'] = Tx_Extbase_Utility_Localization::translate('result.otherPageAsWell', 'indexed_search');
+                               $resultData['subresults']['header'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.otherMatching', 'indexed_search');
+                               $resultData['subresults']['info'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.otherPageAsWell', 'indexed_search');
                        }
                }
-
                return $resultData;
        }
 
@@ -509,9 +419,8 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         * @return array Configuration array
         */
        protected function getSpecialConfigForResultRow($row) {
-               $pathId = $row['data_page_id'] ? $row['data_page_id'] : $row['page_id'];
+               $pathId = $row['data_page_id'] ?: $row['page_id'];
                $pathMP = $row['data_page_id'] ? $row['data_page_mp'] : '';
-
                $rl = $GLOBALS['TSFE']->sys_page->getRootLine($pathId, $pathMP);
                $specConf = $this->settings['specialConfiguration.']['0.'];
                if (is_array($rl)) {
@@ -523,7 +432,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                                }
                        }
                }
-
                return $specConf;
        }
 
@@ -535,57 +443,39 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         * @todo can this be a ViewHelper?
         */
        protected function makeRating($row) {
-
-               switch((string) $this->searchData['sortOrder']) {
-
-                               // Number of occurencies on page
+               switch ((string) $this->searchData['sortOrder']) {
                        case 'rank_count':
-                               return $row['order_val'] . ' ' . Tx_Extbase_Utility_Localization::translate('result.ratingMatches', 'indexed_search');
-                       break;
-
-                               // Close to top of page
+                               return $row['order_val'] . ' ' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.ratingMatches', 'indexed_search');
+                               break;
                        case 'rank_first':
-                               return ceil(t3lib_utility_Math::forceIntegerInRange(255 - $row['order_val'], 1, 255) / 255 * 100) . '%';
-                       break;
-
-                               // Based on priority assigned to <title> / <meta-keywords> / <meta-description> / <body>
+                               return ceil(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((255 - $row['order_val']), 1, 255) / 255 * 100) . '%';
+                               break;
                        case 'rank_flag':
                                if ($this->firstRow['order_val2']) {
-                                               // (3 MSB bit, 224 is highest value of order_val1 currently)
+                                       // (3 MSB bit, 224 is highest value of order_val1 currently)
                                        $base = $row['order_val1'] * 256;
-                                               // 15-3 MSB = 12
+                                       // 15-3 MSB = 12
                                        $freqNumber = $row['order_val2'] / $this->firstRow['order_val2'] * pow(2, 12);
-                                       $total = t3lib_utility_Math::forceIntegerInRange($base + $freqNumber, 0, 32767);
+                                       $total = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($base + $freqNumber, 0, 32767);
                                        return ceil(log($total) / log(32767) * 100) . '%';
                                }
-                       break;
-
-                               // Based on frequency
+                               break;
                        case 'rank_freq':
                                $max = 10000;
-                               $total = t3lib_utility_Math::forceIntegerInRange($row['order_val'], 0, $max);
+                               $total = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($row['order_val'], 0, $max);
                                return ceil(log($total) / log($max) * 100) . '%';
-                       break;
-
-                               // Based on creation date
+                               break;
                        case 'crdate':
                                return $this->cObj->calcAge($GLOBALS['EXEC_TIME'] - $row['item_crdate'], 0);
-                       break;
-
-                               // Based on modification time
+                               break;
                        case 'mtime':
                                return $this->cObj->calcAge($GLOBALS['EXEC_TIME'] - $row['item_mtime'], 0);
-                       break;
-
-                               // fx. title
+                               break;
                        default:
                                return ' ';
-                       break;
                }
        }
 
-
-
        /**
         * Returns the HTML code for language indication.
         *
@@ -594,33 +484,24 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        protected function makeLanguageIndication($row) {
                $output = '&nbsp;';
-
-                       // If search result is a TYPO3 page:
+               // If search result is a TYPO3 page:
                if ((string) $row['item_type'] === '0') {
-
-                               // If TypoScript is used to render the flag:
+                       // If TypoScript is used to render the flag:
                        if (is_array($this->settings['flagRendering.'])) {
-                               $cObj = t3lib_div::makeInstance('tslib_cObj');
+                               /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj */
+                               $cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
                                $cObj->setCurrentVal($row['sys_language_uid']);
                                $output = $cObj->cObjGetSingle($this->settings['flagRendering'], $this->settings['flagRendering.']);
                        } else {
-                                       // ... otherwise, get flag from sys_language record:
-                               $languageRow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
-                                       'flag, title',
-                                       'sys_language',
-                                       'uid=' . intval($row['sys_language_uid'])
-                                       . $GLOBALS['TSFE']->cObj->enableFields('sys_language')
-                               );
-
-                                       // Flag code:
+                               // ... otherwise, get flag from sys_language record:
+                               $languageRow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('flag, title', 'sys_language', 'uid=' . (int)$row['sys_language_uid'] . $GLOBALS['TSFE']->cObj->enableFields('sys_language'));
+                               // Flag code:
                                $flag = $languageRow['flag'];
                                if ($flag) {
-
-                                               // FIXME not all flags from typo3/gfx/flags
-                                               // are available in media/flags/
-                                       $file = substr(PATH_tslib, strlen(PATH_site)) . 'media/flags/flag_' . $flag;
-                                       $imgInfo = @getimagesize(PATH_site . $file);
-
+                                       // FIXME not all flags from typo3/gfx/flags
+                                       // are available in media/flags/
+                                       $file = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(PATH_tslib) . 'media/flags/flag_' . $flag;
+                                       $imgInfo = @getimagesize((PATH_site . $file));
                                        if (is_array($imgInfo)) {
                                                $output = '<img src="' . $file . '" ' . $imgInfo[3] . ' title="' . htmlspecialchars($languageRow['title']) . '" alt="' . htmlspecialchars($languageRow['title']) . '" />';
                                        }
@@ -630,8 +511,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                return $output;
        }
 
-
-
        /**
         * Return icon for file extension
         *
@@ -639,27 +518,22 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         * @param string $alt Title attribute value in icon.
         * @param array $specRowConf TypoScript configuration specifically for search result.
         * @return string <img> tag for icon
+        * @todo Define visibility
         */
-       function makeItemTypeIcon($imageType, $alt, $specRowConf) {
-
-                       // Build compound key if item type is 0, iconRendering is not used
-                       // and specConfs.[pid].pageIcon was set in TS
+       public function makeItemTypeIcon($imageType, $alt, $specRowConf) {
+               // Build compound key if item type is 0, iconRendering is not used
+               // and specConfs.[pid].pageIcon was set in TS
                if ($imageType === '0' && $specRowConf['_pid'] && is_array($specRowConf['pageIcon.']) && !is_array($this->settings['iconRendering.'])) {
                        $imageType .= ':' . $specRowConf['_pid'];
                }
-
                if (!isset($this->iconFileNameCache[$imageType])) {
                        $this->iconFileNameCache[$imageType] = '';
-
-                               // If TypoScript is used to render the icon:
+                       // If TypoScript is used to render the icon:
                        if (is_array($this->settings['iconRendering.'])) {
                                $this->cObj->setCurrentVal($imageType);
                                $this->iconFileNameCache[$imageType] = $this->cObj->cObjGetSingle($this->settings['iconRendering'], $this->settings['iconRendering.']);
-
-                               // ... otherwise, get flag from sys_language record:
                        } else {
-
-                                       // Default creation / finding of icon:
+                               // Default creation / finding of icon:
                                $icon = '';
                                if ($imageType === '0' || substr($imageType, 0, 2) == '0:') {
                                        if (is_array($specRowConf['pageIcon.'])) {
@@ -670,14 +544,12 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                                } elseif ($this->externalParsers[$imageType]) {
                                        $icon = $this->externalParsers[$imageType]->getIcon($imageType);
                                }
-
                                if ($icon) {
-                                       $fullPath = t3lib_div::getFileAbsFileName($icon);
-
+                                       $fullPath = GeneralUtility::getFileAbsFileName($icon);
                                        if ($fullPath) {
                                                $info = @getimagesize($fullPath);
-                                               $iconPath = substr($fullPath, strlen(PATH_site));
-                                               $this->iconFileNameCache[$imageType] = (is_array($info)) ? '<img src="' . $iconPath . '" ' . $info[3] . ' title="' . htmlspecialchars($alt) . '" alt="" />' : '';
+                                               $iconPath = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($fullPath);
+                                               $this->iconFileNameCache[$imageType] = is_array($info) ? '<img src="' . $iconPath . '" ' . $info[3] . ' title="' . htmlspecialchars($alt) . '" alt="" />' : '';
                                        }
                                }
                        }
@@ -685,8 +557,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                return $this->iconFileNameCache[$imageType];
        }
 
-
-
        /**
         * Returns the resume for the search-result.
         *
@@ -696,99 +566,86 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         * @return string HTML string
         * @todo overwork this
         */
-       protected function makeDescription($row, $noMarkup = FALSE, $lgd = 180) {
+       protected function makeDescription($row, $noMarkup = FALSE, $length = 180) {
                if ($row['show_resume']) {
                        if (!$noMarkup) {
                                $markedSW = '';
-                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'index_fulltext', 'phash=' . intval($row['phash']));
+                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'index_fulltext', 'phash=' . (int)$row['phash']);
                                if ($ftdrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                                               // Cut HTTP references after some length
-                                       $content = preg_replace('/(http:\/\/[^ ]{60})([^ ]+)/i', '$1...', $ftdrow['fulltextdata']);
+                                       // Cut HTTP references after some length
+                                       $content = preg_replace('/(http:\\/\\/[^ ]{60})([^ ]+)/i', '$1...', $ftdrow['fulltextdata']);
                                        $markedSW = $this->markupSWpartsOfString($content);
                                }
                                $GLOBALS['TYPO3_DB']->sql_free_result($res);
                        }
-
                        if (!trim($markedSW)) {
                                $outputStr = $GLOBALS['TSFE']->csConvObj->crop('utf-8', $row['item_description'], $length);
                                $outputStr = htmlspecialchars($outputStr);
                        }
-                       $output = $outputStr ? $outputStr : $markedSW;
+                       $output = $outputStr ?: $markedSW;
                        $output = $GLOBALS['TSFE']->csConv($output, 'utf-8');
                } else {
-                       $output = '<span class="noResume">' . Tx_Extbase_Utility_Localization::translate('result.noResume', 'indexed_search') . '</span>';
+                       $output = '<span class="noResume">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.noResume', 'indexed_search') . '</span>';
                }
-
                return $output;
        }
 
        /**
-        * Marks up the search words from $this->sWarr in the $str with a color.
+        * Marks up the search words from $this->searchWords in the $str with a color.
         *
         * @param string $str Text in which to find and mark up search words. This text is assumed to be UTF-8 like the search words internally is.
         * @return string Processed content
         */
        protected function markupSWpartsOfString($str) {
-
-                       // Init:
-               $str = str_replace('&nbsp;', ' ', t3lib_parsehtml::bidir_htmlspecialchars($str, -1));
-               $str = preg_replace('/\s\s+/', ' ', $str);
+               // Init:
+               $str = str_replace('&nbsp;', ' ', \TYPO3\CMS\Core\Html\HtmlParser::bidir_htmlspecialchars($str, -1));
+               $str = preg_replace('/\\s\\s+/', ' ', $str);
                $swForReg = array();
-
-                       // Prepare search words for regex:
-               foreach ($this->sWArr as $d) {
+               // Prepare search words for regex:
+               foreach ($this->searchWords as $d) {
                        $swForReg[] = preg_quote($d['sword'], '/');
                }
                $regExString = '(' . implode('|', $swForReg) . ')';
-
-                       // Split and combine:
-               $parts = preg_split('/'.$regExString.'/i', ' '.$str.' ', 20000, PREG_SPLIT_DELIM_CAPTURE);
-                       // Constants:
+               // Split and combine:
+               $parts = preg_split('/' . $regExString . '/i', ' ' . $str . ' ', 20000, PREG_SPLIT_DELIM_CAPTURE);
+               // Constants:
                $summaryMax = 300;
                $postPreLgd = 60;
                $postPreLgd_offset = 5;
                $divider = ' ... ';
-
-               $occurencies = (count($parts)-1)/2;
+               $occurencies = (count($parts) - 1) / 2;
                if ($occurencies) {
-                       $postPreLgd = t3lib_utility_Math::forceIntegerInRange($summaryMax / $occurencies, $postPreLgd, $summaryMax / 2);
+                       $postPreLgd = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($summaryMax / $occurencies, $postPreLgd, $summaryMax / 2);
                }
-
-                       // Variable:
+               // Variable:
                $summaryLgd = 0;
                $output = array();
-
-                       // Shorten in-between strings:
+               // Shorten in-between strings:
                foreach ($parts as $k => $strP) {
-                       if (($k % 2) == 0) {
-
-                                       // Find length of the summary part:
+                       if ($k % 2 == 0) {
+                               // Find length of the summary part:
                                $strLen = $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $parts[$k]);
                                $output[$k] = $parts[$k];
-
-                                       // Possibly shorten string:
-                               if (!$k) {      // First entry at all (only cropped on the frontside)
+                               // Possibly shorten string:
+                               if (!$k) {
+                                       // First entry at all (only cropped on the frontside)
                                        if ($strLen > $postPreLgd) {
-                                               $output[$k] = $divider.preg_replace('/^[^[:space:]]+[[:space:]]/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset)));
+                                               $output[$k] = $divider . preg_replace('/^[^[:space:]]+[[:space:]]/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset)));
                                        }
-                               } elseif ($summaryLgd > $summaryMax || !isset($parts[$k+1])) {  // In case summary length is exceed OR if there are no more entries at all:
+                               } elseif ($summaryLgd > $summaryMax || !isset($parts[($k + 1)])) {
+                                       // In case summary length is exceed OR if there are no more entries at all:
                                        if ($strLen > $postPreLgd) {
-                                               $output[$k] = preg_replace('/[[:space:]][^[:space:]]+$/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], $postPreLgd - $postPreLgd_offset)) . $divider;
+                                               $output[$k] = preg_replace('/[[:space:]][^[:space:]]+$/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], ($postPreLgd - $postPreLgd_offset))) . $divider;
                                        }
-                                       // In-between search words:
                                } else {
                                        if ($strLen > $postPreLgd * 2) {
-                                               $output[$k] = preg_replace('/[[:space:]][^[:space:]]+$/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], $postPreLgd - $postPreLgd_offset)) .
-                                                       $divider .
-                                                       preg_replace('/^[^[:space:]]+[[:space:]]/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset)));
+                                               $output[$k] = preg_replace('/[[:space:]][^[:space:]]+$/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], ($postPreLgd - $postPreLgd_offset))) . $divider . preg_replace('/^[^[:space:]]+[[:space:]]/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset)));
                                        }
                                }
-                               $summaryLgd+= $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $output[$k]);
-
-                                       // Protect output:
+                               $summaryLgd += $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $output[$k]);
+                               // Protect output:
                                $output[$k] = htmlspecialchars($output[$k]);
-
-                                       // If summary lgd is exceed, break the process:
+                               // If summary lgd is exceed, break the process:
                                if ($summaryLgd > $summaryMax) {
                                        break;
                                }
@@ -797,59 +654,50 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                                $output[$k] = '<strong class="tx-indexedsearch-redMarkup">' . htmlspecialchars($parts[$k]) . '</strong>';
                        }
                }
-
-                       // Return result:
+               // Return result:
                return implode('', $output);
        }
 
-
-
        /**
         * Write statistics information to database for the search operation
         *
-        * @param       array           search params
-        * @param       array           Search Word array
-        * @param       integer         Number of hits
-        * @param       integer         Milliseconds the search took
-        * @return      void
+        * @param       array           search params
+        * @param       array           Search Word array
+        * @param       integer         Number of hits
+        * @param       integer         Milliseconds the search took
+        * @return      void
         */
        protected function writeSearchStat($searchParams, $searchWords, $count, $pt) {
                $insertFields = array(
-                       'searchstring'  => $this->sword,
+                       'searchstring' => $this->sword,
                        'searchoptions' => serialize(array($searchParams, $searchWords, $pt)),
-                       'feuser_id' => intval($GLOBALS['TSFE']->fe_user->user['uid']),
-                               // cookie as set or retrieved. If people has cookies disabled this will vary all the time
+                       'feuser_id' => (int)$GLOBALS['TSFE']->fe_user->user['uid'],
+                       // cookie as set or retrieved. If people has cookies disabled this will vary all the time
                        'cookie' => $GLOBALS['TSFE']->fe_user->id,
-                               // Remote IP address
-                       'IP'     => t3lib_div::getIndpEnv('REMOTE_ADDR'),
-                               // Number of hits on the search
-                       'hits'   => intval($count),
-                               // Time stamp
+                       // Remote IP address
+                       'IP' => GeneralUtility::getIndpEnv('REMOTE_ADDR'),
+                       // Number of hits on the search
+                       'hits' => (int)$count,
+                       // Time stamp
                        'tstamp' => $GLOBALS['EXEC_TIME']
                );
-
                $GLOBALS['TYPO3_DB']->exec_INSERTquery('index_stat_search', $insertFields);
                $newId = $GLOBALS['TYPO3_DB']->sql_insert_id();
-
                if ($newId) {
                        foreach ($searchWords as $val) {
                                $insertFields = array(
                                        'word' => $val['sword'],
                                        'index_stat_search_id' => $newId,
-                                               // Time stamp
+                                       // Time stamp
                                        'tstamp' => $GLOBALS['EXEC_TIME'],
-                                               // search page id for indexed search stats
+                                       // search page id for indexed search stats
                                        'pageid' => $GLOBALS['TSFE']->id
                                );
-
                                $GLOBALS['TYPO3_DB']->exec_INSERTquery('index_stat_word', $insertFields);
                        }
                }
        }
 
-
-
-
        /**
         * Splits the search word input into an array where each word is represented by an array with key "sword" holding the search word and key "oper" holding the SQL operator (eg. AND, OR)
         *
@@ -866,18 +714,16 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         * @return array Search words if any found
         */
        protected function getSearchWords($defaultOperator) {
-                       // Shorten search-word string to max 200 bytes (does NOT take multibyte charsets into account - but never mind, shortening the string here is only a run-away feature!)
+               // Shorten search-word string to max 200 bytes (does NOT take multibyte charsets into account - but never mind, shortening the string here is only a run-away feature!)
                $searchWords = substr($this->sword, 0, 200);
-
-                       // Convert to UTF-8 + conv. entities (was also converted during indexing!)
+               // Convert to UTF-8 + conv. entities (was also converted during indexing!)
                $searchWords = $GLOBALS['TSFE']->csConvObj->utf8_encode($searchWords, $GLOBALS['TSFE']->metaCharset);
                $searchWords = $GLOBALS['TSFE']->csConvObj->entities_to_utf8($searchWords, TRUE);
-
                $sWordArray = FALSE;
                if ($hookObj = $this->hookRequest('getSearchWords')) {
                        $sWordArray = $hookObj->getSearchWords_splitSWords($searchWords, $defaultOperator);
                } else {
-                               // sentence
+                       // sentence
                        if ($this->searchDat['searchType'] == 20) {
                                $sWordArray = array(
                                        array(
@@ -886,25 +732,22 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                                        )
                                );
                        } else {
-
                                // case-sensitive. Defines the words, which will be
                                // operators between words
                                $operatorTranslateTable = array(
                                        array('+', 'AND'),
                                        array('|', 'OR'),
                                        array('-', 'AND NOT'),
-                                               // Add operators for various languages
-                                               // Converts the operators to UTF-8 and lowercase
-                                       array($GLOBALS['TSFE']->csConvObj->conv_case('utf-8', $GLOBALS['TSFE']->csConvObj->utf8_encode(Tx_Extbase_Utility_Localization::translate('localizedOperandAnd', 'indexed_search'), $GLOBALS['TSFE']->renderCharset), 'toLower'), 'AND'),
-                                       array($GLOBALS['TSFE']->csConvObj->conv_case('utf-8', $GLOBALS['TSFE']->csConvObj->utf8_encode(Tx_Extbase_Utility_Localization::translate('localizedOperandOr', 'indexed_search'), $GLOBALS['TSFE']->renderCharset), 'toLower'), 'OR'),
-                                       array($GLOBALS['TSFE']->csConvObj->conv_case('utf-8', $GLOBALS['TSFE']->csConvObj->utf8_encode(Tx_Extbase_Utility_Localization::translate('localizedOperandNot', 'indexed_search'), $GLOBALS['TSFE']->renderCharset), 'toLower'), 'AND NOT'),
+                                       // Add operators for various languages
+                                       // Converts the operators to UTF-8 and lowercase
+                                       array($GLOBALS['TSFE']->csConvObj->conv_case('utf-8', $GLOBALS['TSFE']->csConvObj->utf8_encode(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('localizedOperandAnd', 'indexed_search'), $GLOBALS['TSFE']->renderCharset), 'toLower'), 'AND'),
+                                       array($GLOBALS['TSFE']->csConvObj->conv_case('utf-8', $GLOBALS['TSFE']->csConvObj->utf8_encode(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('localizedOperandOr', 'indexed_search'), $GLOBALS['TSFE']->renderCharset), 'toLower'), 'OR'),
+                                       array($GLOBALS['TSFE']->csConvObj->conv_case('utf-8', $GLOBALS['TSFE']->csConvObj->utf8_encode(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('localizedOperandNot', 'indexed_search'), $GLOBALS['TSFE']->renderCharset), 'toLower'), 'AND NOT')
                                );
-
-                               $search = t3lib_div::makeInstance('tslib_search');
+                               $search = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\SearchResultContentObject');
                                $search->default_operator = $defaultOperator == 1 ? 'OR' : 'AND';
                                $search->operator_translate_table = $operatorTranslateTable;
                                $search->register_and_explode_search_string($searchWords);
-
                                if (is_array($search->sword_array)) {
                                        $sWordArray = $this->procSearchWordsByLexer($search->sword_array);
                                }
@@ -922,21 +765,16 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        protected function procSearchWordsByLexer($searchWords) {
                $newSearchWords = array();
-
-                       // Init lexer (used to post-processing of search words)
-               $lexerObjRef = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['lexer'] ?
-                                               $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['lexer'] :
-                                               'EXT:indexed_search/class.lexer.php:&tx_indexedsearch_lexer';
-               $this->lexerObj = t3lib_div::getUserObj($lexerObjRef);
-
-                       // Traverse the search word array
+               // Init lexer (used to post-processing of search words)
+               $lexerObjRef = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['lexer'] ? $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['lexer'] : 'EXT:indexed_search/Classes/Lexer.php:&TYPO3\\CMS\\IndexedSearch\\Lexer';
+               $this->lexerObj = GeneralUtility::getUserObj($lexerObjRef);
+               // Traverse the search word array
                foreach ($searchWords as $wordDef) {
-                               // No space in word (otherwise it might be a sentense in quotes like "there is").
+                       // No space in word (otherwise it might be a sentense in quotes like "there is").
                        if (strpos($wordDef['sword'], ' ') === FALSE) {
-                                       // Split the search word by lexer:
+                               // Split the search word by lexer:
                                $res = $this->lexerObj->split2Words($wordDef['sword']);
-
-                                       // Traverse lexer result and add all words again:
+                               // Traverse lexer result and add all words again:
                                foreach ($res as $word) {
                                        $newSearchWords[] = array(
                                                'sword' => $word,
@@ -950,9 +788,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                return $newSearchWords;
        }
 
-
-
-
        /**
         * Sort options about the search form
         *
@@ -962,78 +797,54 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        public function formAction($search = array()) {
                $this->initialize($search);
-
-                       // Adding search field value
+               // Adding search field value
                $this->view->assign('sword', $this->sword);
-
-                       // Additonal keyword => "Add to current search words"
-               $showAdditionalKeywordSearch = ($this->settings['clearSearchBox'] && $this->settings['clearSearchBox.']['enableSubSearchCheckBox']);
+               // Additonal keyword => "Add to current search words"
+               $showAdditionalKeywordSearch = $this->settings['clearSearchBox'] && $this->settings['clearSearchBox.']['enableSubSearchCheckBox'];
                if ($showAdditionalKeywordSearch) {
-                       $this->view->assign('previousSearchWord', ($this->settings['clearSearchBox'] ? '' : $this->sword));
+                       $this->view->assign('previousSearchWord', $this->settings['clearSearchBox'] ? '' : $this->sword);
                }
                $this->view->assign('showAdditionalKeywordSearch', $showAdditionalKeywordSearch);
-
-                       // Extended search
+               // Extended search
                if ($search['extendedSearch']) {
-
-                               // "Search for"
+                       // "Search for"
                        $allSearchTypes = $this->getAllAvailableSearchTypeOptions();
                        $this->view->assign('allSearchTypes', $allSearchTypes);
-
                        $allDefaultOperands = $this->getAllAvailableOperandsOptions();
                        $this->view->assign('allDefaultOperands', $allDefaultOperands);
-
-                       $showTypeSearch = (count($allSearchTypes) || count($allDefaultOperands));
+                       $showTypeSearch = count($allSearchTypes) || count($allDefaultOperands);
                        $this->view->assign('showTypeSearch', $showTypeSearch);
-
-
-                               // "Search in"
+                       // "Search in"
                        $allMediaTypes = $this->getAllAvailableMediaTypesOptions();
                        $this->view->assign('allMediaTypes', $allMediaTypes);
-
                        $allLanguageUids = $this->getAllAvailableLanguageOptions();
                        $this->view->assign('allLanguageUids', $allLanguageUids);
-
-                       $showMediaAndLanguageSearch = (count($allMediaTypes) || count($allLanguageUids));
+                       $showMediaAndLanguageSearch = count($allMediaTypes) || count($allLanguageUids);
                        $this->view->assign('showMediaAndLanguageSearch', $showMediaAndLanguageSearch);
-
-
-                               // Sections
+                       // Sections
                        $allSections = $this->getAllAvailableSectionsOptions();
                        $this->view->assign('allSections', $allSections);
-
-                               // Free Indexing Configurations
+                       // Free Indexing Configurations
                        $allIndexConfigurations = $this->getAllAvailableIndexConfigurationsOptions();
                        $this->view->assign('allIndexConfigurations', $allIndexConfigurations);
-
-                               // Sorting
+                       // Sorting
                        $allSortOrders = $this->getAllAvailableSortOrderOptions();
                        $this->view->assign('allSortOrders', $allSortOrders);
                        $allSortDescendings = $this->getAllAvailableSortDescendingOptions();
                        $this->view->assign('allSortDescendings', $allSortDescendings);
-                       $showSortOrders = (count($allSortOrders) || count($allSortDescendings));
+                       $showSortOrders = count($allSortOrders) || count($allSortDescendings);
                        $this->view->assign('showSortOrders', $showSortOrders);
-
-                               // Limits
+                       // Limits
                        $allNumberOfResults = $this->getAllAvailableNumberOfResultsOptions();
                        $this->view->assign('allNumberOfResults', $allNumberOfResults);
-
                        $allGroups = $this->getAllAvailableGroupOptions();
                        $this->view->assign('allGroups', $allGroups);
                }
        }
 
-
-
-
-
-
-
-
        /****************************************
         * building together the available options for every dropdown
         ***************************************/
-
        /**
         * get the values for the "type" selector
         *
@@ -1042,25 +853,21 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
        protected function getAllAvailableSearchTypeOptions() {
                $allOptions = array();
                $types = array(0, 1, 2, 3, 10, 20);
-
                $blindSettings = $this->settings['blind.'];
                if (!$blindSettings['searchType']) {
                        foreach ($types as $typeNum) {
-                               $allOptions[$typeNum] = Tx_Extbase_Utility_Localization::translate('searchTypes.' . $typeNum, 'indexed_search');
+                               $allOptions[$typeNum] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('searchTypes.' . $typeNum, 'indexed_search');
                        }
                }
-
-                               // Remove this option if metaphone search is disabled)
+               // Remove this option if metaphone search is disabled)
                if (!$this->enableMetaphoneSearch) {
-                       unset ($allOptions[10]);
+                       unset($allOptions[10]);
                }
-
-                       // disable single entries by TypoScript
+               // disable single entries by TypoScript
                $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['searchType.']);
                return $allOptions;
        }
 
-
        /**
         * get the values for the "defaultOperand" selector
         *
@@ -1068,16 +875,14 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        protected function getAllAvailableOperandsOptions() {
                $allOptions = array();
-
                $blindSettings = $this->settings['blind.'];
                if (!$blindSettings['defaultOperand']) {
                        $allOptions = array(
-                               0 => Tx_Extbase_Utility_Localization::translate('defaultOperands.0', 'indexed_search'),
-                               1 => Tx_Extbase_Utility_Localization::translate('defaultOperands.1', 'indexed_search')
+                               0 => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('defaultOperands.0', 'indexed_search'),
+                               1 => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('defaultOperands.1', 'indexed_search')
                        );
                }
-
-                       // disable single entries by TypoScript
+               // disable single entries by TypoScript
                $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['defaultOperand.']);
                return $allOptions;
        }
@@ -1090,38 +895,31 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
        protected function getAllAvailableMediaTypesOptions() {
                $allOptions = array();
                $mediaTypes = array(-1, 0, -2);
-
                $blindSettings = $this->settings['blind.'];
                if (!$blindSettings['mediaType']) {
                        foreach ($mediaTypes as $mediaType) {
-                               $allOptions[$mediaType] = Tx_Extbase_Utility_Localization::translate('mediaTypes.' . $mediaType, 'indexed_search');
+                               $allOptions[$mediaType] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('mediaTypes.' . $mediaType, 'indexed_search');
                        }
-
-                               // Add media to search in:
+                       // Add media to search in:
                        $additionalMedia = trim($this->settings['mediaList']);
                        if (strlen($additionalMedia) > 0) {
-                               $additionalMedia = t3lib_div::trimExplode(',', $additionalMedia, TRUE);
+                               $additionalMedia = GeneralUtility::trimExplode(',', $additionalMedia, TRUE);
                        }
-
                        foreach ($this->externalParsers as $extension => $obj) {
-                                       // Skip unwanted extensions
+                               // Skip unwanted extensions
                                if (count($additionalMedia) && !in_array($extension, $additionalMedia)) {
                                        continue;
                                }
-
                                if ($name = $obj->searchTypeMediaTitle($extension)) {
-                                       $allOptions[$extension] = Tx_Extbase_Utility_Localization::translate('mediaTypes.' . $extension, $name);
+                                       $allOptions[$extension] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('mediaTypes.' . $extension, $name);
                                }
                        }
                }
-
-                       // disable single entries by TypoScript
+               // disable single entries by TypoScript
                $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['mediaType.']);
                return $allOptions;
        }
 
-
-
        /**
         * get the values for the "language" selector
         *
@@ -1129,65 +927,53 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        protected function getAllAvailableLanguageOptions() {
                $allOptions = array(
-                       '-1' => Tx_Extbase_Utility_Localization::translate('languageUids.-1', 'indexed_search'),
-                       '0'  => Tx_Extbase_Utility_Localization::translate('languageUids.0', 'indexed_search')
+                       '-1' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('languageUids.-1', 'indexed_search'),
+                       '0' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('languageUids.0', 'indexed_search')
                );
-
                $blindSettings = $this->settings['blind.'];
                if (!$blindSettings['languageUid']) {
-
-                               // Add search languages
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               '*',
-                               'sys_language',
-                               '1=1' . $GLOBALS['TSFE']->cObj->enableFields('sys_language')
-                       );
+                       // Add search languages
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_language', '1=1' . $GLOBALS['TSFE']->cObj->enableFields('sys_language'));
                        if ($res) {
                                while ($lang = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                        $allOptions[$lang['uid']] = $lang['title'];
                                }
                        }
-
-                               // disable single entries by TypoScript
+                       // disable single entries by TypoScript
                        $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['languageUid.']);
-
                } else {
                        $allOptions = array();
                }
                return $allOptions;
        }
 
-
        /**
         * get the values for the "section" selector
         * Here values like "rl1_" and "rl2_" + a rootlevel 1/2 id can be added
-        *  to perform searches in rootlevel 1+2 specifically. The id-values can even
-        *  be commaseparated. Eg. "rl1_1,2" would search for stuff inside pages on
-        *  menu-level 1 which has the uid's 1 and 2.
+        * to perform searches in rootlevel 1+2 specifically. The id-values can even
+        * be commaseparated. Eg. "rl1_1,2" would search for stuff inside pages on
+        * menu-level 1 which has the uid's 1 and 2.
         *
         * @return array Associative array with options
         */
        protected function getAllAvailableSectionsOptions() {
                $allOptions = array();
                $sections = array(0, -1, -2, -3);
-
                $blindSettings = $this->settings['blind.'];
                if (!$blindSettings['sections']) {
                        foreach ($sections as $section) {
-                               $allOptions[$section] = Tx_Extbase_Utility_Localization::translate('sections.' . $section, 'indexed_search');
+                               $allOptions[$section] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.' . $section, 'indexed_search');
                        }
                }
-
-                       // Creating levels for section menu:
-                       // This selects the first and secondary menus for the "sections" selector - so we can search in sections and sub sections.
+               // Creating levels for section menu:
+               // This selects the first and secondary menus for the "sections" selector - so we can search in sections and sub sections.
                if ($this->settings['displayLevel1Sections']) {
                        $firstLevelMenu = $this->getMenuOfPages($this->searchRootPageIdList);
-                       $labelLevel1 = Tx_Extbase_Utility_Localization::translate('sections.Rl1', 'indexed_search');
-                       $labelLevel2 = Tx_Extbase_Utility_Localization::translate('sections.Rl2', 'indexed_search');
+                       $labelLevel1 = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.Rl1', 'indexed_search');
+                       $labelLevel2 = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.Rl2', 'indexed_search');
                        foreach ($firstLevelMenu as $firstLevelKey => $menuItem) {
                                if (!$menuItem['nav_hide']) {
                                        $allOptions['rl1_' . $menuItem['uid']] = trim($labelLevel1 . ' ' . $menuItem['title']);
-
                                        if ($this->settings['displayLevel2Sections']) {
                                                $secondLevelMenu = $this->getMenuOfPages($menuItem['uid']);
                                                foreach ($secondLevelMenu as $secondLevelKey => $menuItemLevel2) {
@@ -1197,21 +983,19 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                                                                unset($secondLevelMenu[$secondLevelKey]);
                                                        }
                                                }
-                                               $allOptions['rl2_' . implode(',', array_keys($secondLevelMenu))] = Tx_Extbase_Utility_Localization::translate('sections.Rl2All', 'indexed_search');
+                                               $allOptions['rl2_' . implode(',', array_keys($secondLevelMenu))] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.Rl2All', 'indexed_search');
                                        }
                                } else {
                                        unset($firstLevelMenu[$firstLevelKey]);
                                }
                        }
-                       $allOptions['rl1_' . implode(',', array_keys($firstLevelMenu))] = Tx_Extbase_Utility_Localization::translate('sections.Rl1All', 'indexed_search');
+                       $allOptions['rl1_' . implode(',', array_keys($firstLevelMenu))] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sections.Rl1All', 'indexed_search');
                }
-
-                       // disable single entries by TypoScript
+               // disable single entries by TypoScript
                $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['sections.']);
                return $allOptions;
        }
 
-
        /**
         * get the values for the "freeIndexUid" selector
         *
@@ -1219,35 +1003,23 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        protected function getAllAvailableIndexConfigurationsOptions() {
                $allOptions = array(
-                       '-1' => Tx_Extbase_Utility_Localization::translate('indexingConfigurations.-1', 'indexed_search'),
-                       '-2' => Tx_Extbase_Utility_Localization::translate('indexingConfigurations.-2', 'indexed_search'),
-                       '0' => Tx_Extbase_Utility_Localization::translate('indexingConfigurations.0', 'indexed_search')
+                       '-1' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('indexingConfigurations.-1', 'indexed_search'),
+                       '-2' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('indexingConfigurations.-2', 'indexed_search'),
+                       '0' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('indexingConfigurations.0', 'indexed_search')
                );
                $blindSettings = $this->settings['blind.'];
                if (!$blindSettings['indexingConfigurations']) {
-
-                               // add an additional index configuration
+                       // add an additional index configuration
                        if ($this->settings['defaultFreeIndexUidList']) {
-                               $uidList = t3lib_div::intExplode(',', $this->settings['defaultFreeIndexUidList']);
-                               $indexCfgRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                                       'uid,title',
-                                       'index_config',
-                                       'uid IN (' . implode(',', $uidList).  ')'
-                                       . $GLOBALS['TSFE']->cObj->enableFields('index_config'),
-                                       '',
-                                       '',
-                                       '',
-                                       'uid'
-                               );
-
+                               $uidList = GeneralUtility::intExplode(',', $this->settings['defaultFreeIndexUidList']);
+                               $indexCfgRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title', 'index_config', 'uid IN (' . implode(',', $uidList) . ')' . $GLOBALS['TSFE']->cObj->enableFields('index_config'), '', '', '', 'uid');
                                foreach ($uidList as $uidValue) {
                                        if (is_array($indexCfgRecords[$uidValue])) {
                                                $allOptions[$uidValue] = $indexCfgRecords[$uidValue]['title'];
                                        }
                                }
                        }
-
-                               // disable single entries by TypoScript
+                       // disable single entries by TypoScript
                        $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['indexingConfigurations.']);
                } else {
                        $allOptions = array();
@@ -1258,9 +1030,9 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
        /**
         * get the values for the "section" selector
         * Here values like "rl1_" and "rl2_" + a rootlevel 1/2 id can be added
-        *  to perform searches in rootlevel 1+2 specifically. The id-values can even
-        *  be commaseparated. Eg. "rl1_1,2" would search for stuff inside pages on
-        *  menu-level 1 which has the uid's 1 and 2.
+        * to perform searches in rootlevel 1+2 specifically. The id-values can even
+        * be commaseparated. Eg. "rl1_1,2" would search for stuff inside pages on
+        * menu-level 1 which has the uid's 1 and 2.
         *
         * @return array Associative array with options
         */
@@ -1270,11 +1042,10 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                $blindSettings = $this->settings['blind.'];
                if (!$blindSettings['sortOrder']) {
                        foreach ($sortOrders as $order) {
-                               $allOptions[$order] = Tx_Extbase_Utility_Localization::translate('sortOrders.' . $order, 'indexed_search');
+                               $allOptions[$order] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sortOrders.' . $order, 'indexed_search');
                        }
                }
-
-                       // disable single entries by TypoScript
+               // disable single entries by TypoScript
                $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['sortOrder.']);
                return $allOptions;
        }
@@ -1289,12 +1060,11 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                $blindSettings = $this->settings['blind.'];
                if (!$blindSettings['groupBy']) {
                        $allOptions = array(
-                               'sections' => Tx_Extbase_Utility_Localization::translate('groupBy.sections', 'indexed_search'),
-                               'flat' => Tx_Extbase_Utility_Localization::translate('groupBy.flat', 'indexed_search')
+                               'sections' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('groupBy.sections', 'indexed_search'),
+                               'flat' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('groupBy.flat', 'indexed_search')
                        );
                }
-
-                       // disable single entries by TypoScript
+               // disable single entries by TypoScript
                $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['groupBy.']);
                return $allOptions;
        }
@@ -1309,12 +1079,11 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                $blindSettings = $this->settings['blind.'];
                if (!$blindSettings['descending']) {
                        $allOptions = array(
-                               0 => Tx_Extbase_Utility_Localization::translate('sortOrders.descending', 'indexed_search'),
-                               1 => Tx_Extbase_Utility_Localization::translate('sortOrders.ascending', 'indexed_search')
+                               0 => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sortOrders.descending', 'indexed_search'),
+                               1 => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('sortOrders.ascending', 'indexed_search')
                        );
                }
-
-                       // disable single entries by TypoScript
+               // disable single entries by TypoScript
                $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['descending.']);
                return $allOptions;
        }
@@ -1335,13 +1104,11 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                                100 => 100
                        );
                }
-
-                       // disable single entries by TypoScript
+               // disable single entries by TypoScript
                $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['numberOfResults.']);
                return $allOptions;
        }
 
-
        /**
         * removes blinding entries from the option list of a selector
         *
@@ -1360,8 +1127,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                return $allOptions;
        }
 
-
-
        /**
         * Links the $linkText to page $pageUid
         *
@@ -1372,60 +1137,44 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         * @return string <A> tag wrapped title string.
         * @todo make use of the UriBuilder
         */
-       protected function linkPage($pageUid, $linkText, $row=array(), $markUpSwParams = array()) {
-
-                       // Parameters for link
+       protected function linkPage($pageUid, $linkText, $row = array(), $markUpSwParams = array()) {
+               // Parameters for link
                $urlParameters = (array) unserialize($row['cHashParams']);
-
-                       // Add &type and &MP variable:
+               // Add &type and &MP variable:
                if ($row['data_page_mp']) {
                        $urlParameters['MP'] = $row['data_page_mp'];
                }
                if ($row['sys_language_uid']) {
                        $urlParameters['L'] = $row['sys_language_uid'];
                }
-
-                       // markup-GET vars:
+               // markup-GET vars:
                $urlParameters = array_merge($urlParameters, $markUpSwParams);
-
-                       // This will make sure that the path is retrieved if it hasn't been
-                       // already. Used only for the sake of the domain_record thing.
+               // This will make sure that the path is retrieved if it hasn't been
+               // already. Used only for the sake of the domain_record thing.
                if (!is_array($this->domainRecords[$pageUid])) {
                        $this->getPathFromPageId($pageUid);
                }
-
-
-                       // If external domain, then link to that:
+               // If external domain, then link to that:
                if (count($this->domainRecords[$pageUid])) {
-                       $scheme = t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
+                       $scheme = GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
                        $firstDomain = reset($this->domainRecords[$pageUid]);
-
                        $additionalParams = '';
                        if (is_array($urlParameters)) {
                                if (count($urlParameters)) {
-                                       $additionalParams = t3lib_div::implodeArrayForUrl('', $urlParameters);
+                                       $additionalParams = GeneralUtility::implodeArrayForUrl('', $urlParameters);
                                }
                        }
-
                        $uri = $scheme . $firstDomain . '/index.php?id=' . $pageUid . $additionalParams;
-
                        if ($target = $this->settings['detectDomainRecords.']['target']) {
                                $target = ' target="' . $target . '"';
                        }
                } else {
                        $uriBuilder = $this->controllerContext->getUriBuilder();
-                       $uri = $uriBuilder
-                               ->setTargetPageUid($pageUid)
-                               ->setTargetPageType($row['data_page_type'])
-                               ->setUseCacheHash(TRUE)
-                               ->setArguments($urlParameters)
-                               ->build();
+                       $uri = $uriBuilder->setTargetPageUid($pageUid)->setTargetPageType($row['data_page_type'])->setUseCacheHash(TRUE)->setArguments($urlParameters)->build();
                }
                return '<a href="' . htmlspecialchars($uri) . '"' . $target . '>' . htmlspecialchars($linkText) . '</a>';
        }
 
-
-
        /**
         * Return the menu of pages used for the selector.
         *
@@ -1435,14 +1184,7 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
        protected function getMenuOfPages($pageUid) {
                if ($this->settings['displayLevelxAllTypes']) {
                        $menu = array();
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               'title,uid',
-                               'pages',
-                               'pid=' . intval($pageUid)
-                               . $GLOBALS['TSFE']->cObj->enableFields('pages'),
-                               '',
-                               'sorting'
-                       );
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('title,uid', 'pages', 'pid=' . (int)$pageUid . $GLOBALS['TSFE']->cObj->enableFields('pages'), '', 'sorting');
                        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                $menu[$row['uid']] = $GLOBALS['TSFE']->sys_page->getPageOverlay($row);
                        }
@@ -1453,7 +1195,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                return $menu;
        }
 
-
        /**
         * Returns the path to the page $id
         *
@@ -1463,7 +1204,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         */
        protected function getPathFromPageId($id, $pathMP = '') {
                $identStr = $id . '|' . $pathMP;
-
                if (!isset($this->pathCache[$identStr])) {
                        $this->requiredFrontendUsergroups[$id] = array();
                        $this->domainRecords[$id] = array();
@@ -1471,37 +1211,32 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                        $path = '';
                        if (is_array($rl) && count($rl)) {
                                foreach ($rl as $k => $v) {
-                                               // Check fe_user
+                                       // Check fe_user
                                        if ($v['fe_group'] && ($v['uid'] == $id || $v['extendToSubpages'])) {
                                                $this->requiredFrontendUsergroups[$id][] = $v['fe_group'];
                                        }
-
-                                               // Check sys_domain
+                                       // Check sys_domain
                                        if ($this->settings['detectDomainRcords']) {
                                                $domainName = $this->getFirstSysDomainRecordForPage($v['uid']);
                                                if ($domainName) {
                                                        $this->domainRecords[$id][] = $domainName;
-                                                               // Set path accordingly
+                                                       // Set path accordingly
                                                        $path = $domainName . $path;
                                                        break;
                                                }
                                        }
-
-                                               // Stop, if we find that the current id is the current root page.
+                                       // Stop, if we find that the current id is the current root page.
                                        if ($v['uid'] == $GLOBALS['TSFE']->config['rootLine'][0]['uid']) {
                                                break;
                                        }
                                        $path = '/' . $v['title'] . $path;
                                }
                        }
-
                        $this->pathCache[$identStr] = $path;
                }
-
                return $this->pathCache[$identStr];
        }
 
-
        /**
         * Gets the first sys_domain record for the page, $id
         *
@@ -1509,19 +1244,11 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         * @return string Domain name
         */
        protected function getFirstSysDomainRecordForPage($id) {
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                       'domainName',
-                       'sys_domain',
-                       'pid=' . intval($id)
-                       . $GLOBALS['TSFE']->cObj->enableFields('sys_domain'),
-                       '',
-                       'sorting'
-               );
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('domainName', 'sys_domain', 'pid=' . (int)$id . $GLOBALS['TSFE']->cObj->enableFields('sys_domain'), '', 'sorting');
                $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
                return rtrim($row['domainName'], '/');
        }
 
-
        /**
         * simple function to initialize possible external parsers
         * feeds the $this->externalParsers array
@@ -1529,12 +1256,11 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         * @return void
         */
        protected function initializeExternalParsers() {
-                       // Initialize external document parsers for icon display and other soft operations
+               // Initialize external document parsers for icon display and other soft operations
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['external_parsers'])) {
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['external_parsers'] as $extension => $_objRef) {
-                               $this->externalParsers[$extension] = t3lib_div::getUserObj($_objRef);
-
-                                       // Init parser and if it returns FALSE, unset its entry again
+                               $this->externalParsers[$extension] = GeneralUtility::getUserObj($_objRef);
+                               // Init parser and if it returns FALSE, unset its entry again
                                if (!$this->externalParsers[$extension]->softInit($extension)) {
                                        unset($this->externalParsers[$extension]);
                                }
@@ -1542,7 +1268,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                }
        }
 
-
        /**
         * Returns an object reference to the hook object if any
         *
@@ -1550,9 +1275,9 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
         * @return object Hook object, if any. Otherwise NULL.
         */
        protected function hookRequest($functionName) {
-                       // Hook: menuConfig_preProcessModMenu
+               // Hook: menuConfig_preProcessModMenu
                if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['pi1_hooks'][$functionName]) {
-                       $hookObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['pi1_hooks'][$functionName]);
+                       $hookObj = GeneralUtility::getUserObj($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['pi1_hooks'][$functionName]);
                        if (method_exists($hookObj, $functionName)) {
                                $hookObj->pObj = $this;
                                return $hookObj;
@@ -1561,7 +1286,6 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
                return NULL;
        }
 
-
        /**
         * Returns if an item type is a multipage item type
         *
@@ -1571,5 +1295,5 @@ class Tx_IndexedSearch_Controller_SearchController extends Tx_Extbase_MVC_Contro
        protected function multiplePagesType($item_type) {
                return is_object($this->externalParsers[$item_type]) && $this->externalParsers[$item_type]->isMultiplePageExtension($item_type);
        }
+
 }
-?>
\ No newline at end of file