/**
  * Initializes indexer for files
  */
 public function __construct($pObj)
 {
     parent::__construct($pObj);
     // get extension configuration of ke_search
     $this->extConf = tx_kesearch_helper::getExtConf();
     $this->fileInfo = GeneralUtility::makeInstance('tx_kesearch_lib_fileinfo');
 }
 /**
  * Constructor of this class
  */
 public function __construct()
 {
     // get extension configuration array
     $this->extConf = tx_kesearch_helper::getExtConf();
     $this->extConfPremium = tx_kesearch_helper::getExtConfPremium();
     $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
     // fetch the list of the default indexers which come with ke_search
     foreach ($GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['type']['config']['items'] as $indexerType) {
         $this->defaultIndexerTypes[] = $indexerType[1];
     }
 }
 /**
  * Initializes indexer for files
  */
 public function __construct($pObj)
 {
     parent::__construct($pObj);
     // get extension configuration of ke_search
     $this->extConf = tx_kesearch_helper::getExtConf();
     if (TYPO3_VERSION_INTEGER >= 6002000) {
         $this->fileInfo = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_fileinfo');
     } else {
         $this->fileInfo = t3lib_div::makeInstance('tx_kesearch_lib_fileinfo');
     }
 }
 /**
  * Constructor of this class
  */
 public function __construct()
 {
     // get extension configuration array
     $this->extConf = tx_kesearch_helper::getExtConf();
     $this->extConfPremium = tx_kesearch_helper::getExtConfPremium();
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
     } else {
         if (TYPO3_VERSION_INTEGER >= 6002000) {
             $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_Registry');
         } else {
             $this->registry = t3lib_div::makeInstance('t3lib_Registry');
         }
     }
     // fetch the list of the default indexers which come with ke_search
     // load TCA definition first (only necessary in TYPO3 below 6.1)
     if (TYPO3_VERSION_INTEGER < 6001000) {
         t3lib_div::loadTCA('tx_kesearch_indexerconfig');
     }
     foreach ($GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['type']['config']['items'] as $indexerType) {
         $this->defaultIndexerTypes[] = $indexerType[1];
     }
 }
 /**
  * Initializes flexform, conf vars and some more
  *
  * @return void
  */
 public function init()
 {
     // get some helper functions
     $this->div = GeneralUtility::makeInstance('tx_kesearch_lib_div', $this);
     // set start of query timer
     if (!$GLOBALS['TSFE']->register['ke_search_queryStartTime']) {
         $GLOBALS['TSFE']->register['ke_search_queryStartTime'] = GeneralUtility::milliseconds();
     }
     // make settings from flexform available in general configuration ($this->conf)
     $this->moveFlexFormDataToConf();
     // in pi2 (the list plugin) fetch the configuration from pi1 (the search
     // box plugin) since all the configuration is done there
     if (!empty($this->conf['loadFlexformsFromOtherCE'])) {
         $data = $this->pi_getRecord('tt_content', intval($this->conf['loadFlexformsFromOtherCE']));
         $this->cObj->data = $data;
         $this->moveFlexFormDataToConf();
     }
     // clean piVars
     $this->piVars = $this->div->cleanPiVars($this->piVars);
     // get preselected filter from rootline
     $this->getFilterPreselect();
     // add stdWrap properties to each config value (not to arrays)
     foreach ($this->conf as $key => $value) {
         if (!is_array($this->conf[$key])) {
             $this->conf[$key] = $this->cObj->stdWrap($value, $this->conf[$key . '.']);
         }
     }
     // set some default values (this part have to be after stdWrap!!!)
     if (!$this->conf['resultPage']) {
         $this->conf['resultPage'] = $GLOBALS['TSFE']->id;
     }
     if (!isset($this->piVars['page'])) {
         $this->piVars['page'] = 1;
     }
     if (!empty($this->conf['additionalPathForTypeIcons'])) {
         $this->conf['additionalPathForTypeIcons'] = rtrim($this->conf['additionalPathForTypeIcons'], '/') . '/';
     }
     // hook: modifyFlexFormData
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFlexFormData'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFlexFormData'] as $_classRef) {
             $_procObj =& GeneralUtility::getUserObj($_classRef);
             $_procObj->modifyFlexFormData($this->conf, $this->cObj, $this->piVars);
         }
     }
     // prepare database object
     $this->db = GeneralUtility::makeInstance('tx_kesearch_db', $this);
     // set startingPoints
     $this->startingPoints = $this->div->getStartingPoint();
     // get filter class
     $this->filters = GeneralUtility::makeInstance('tx_kesearch_filters');
     // get extension configuration array
     $this->extConf = tx_kesearch_helper::getExtConf();
     $this->extConfPremium = tx_kesearch_helper::getExtConfPremium();
     // initialize filters
     $this->filters->initialize($this);
     // init templating (marker based or fluid)
     $this->initTemplate();
     // get first startingpoint
     $this->firstStartingPoint = $this->div->getFirstStartingPoint($this->startingPoints);
     // build words searchphrase
     $searchPhrase = GeneralUtility::makeInstance('tx_kesearch_lib_searchphrase');
     $searchPhrase->initialize($this);
     $searchWordInformation = $searchPhrase->buildSearchPhrase();
     // Hook: modifySearchWords
     if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifySearchWords'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifySearchWords'] as $classRef) {
             $hookObj = GeneralUtility::getUserObj($classRef);
             if (method_exists($hookObj, 'modifySearchWords')) {
                 $hookObj->modifySearchWords($searchWordInformation, $this);
             }
         }
     }
     // set searchword and tag information
     $this->sword = $searchWordInformation['sword'];
     $this->swords = $searchWordInformation['swords'];
     $this->wordsAgainst = $searchWordInformation['wordsAgainst'];
     $this->tagsAgainst = $searchWordInformation['tagsAgainst'];
     $this->scoreAgainst = $searchWordInformation['scoreAgainst'];
     $this->isEmptySearch = $this->isEmptySearch();
     // Since sorting for "relevance" in most cases ist the most useful option and
     // this sorting option is not available until a searchword is given, make it
     // the default sorting after a searchword has been given.
     // Set default sorting to "relevance" if the following conditions are true:
     // * sorting by user is allowed
     // * sorting for "relevance" is allowed (internal: "score")
     // * user did not select his own sorting yet
     // * a searchword is given
     $isInList = GeneralUtility::inList($this->conf['sortByVisitor'], 'score');
     if ($this->conf['showSortInFrontend'] && $isInList && !$this->piVars['sortByField'] && $this->sword) {
         $this->piVars['sortByField'] = 'score';
         $this->piVars['sortByDir'] = 'desc';
     }
     // after the searchword is removed, sorting for "score" is not possible
     // anymore. So remove this sorting here and put it back to default.
     if (!$this->sword && $this->piVars['sortByField'] == 'score') {
         unset($this->piVars['sortByField']);
         unset($this->piVars['sortByDir']);
     }
     // chooseBestIndex is only needed for MySQL-Search. Not for Sphinx
     if (!$this->extConfPremium['enableSphinxSearch']) {
         // precount results to find the best index
         $this->db->chooseBestIndex($this->wordsAgainst, $this->tagsAgainst);
     }
     // perform search at this point already if we need to calculate what
     // filters to display.
     if ($this->conf['checkFilterCondition'] != 'none') {
         $this->db->getSearchResults();
     }
     // add cssTag to header if set
     $cssFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['cssFile']);
     if (!empty($cssFile)) {
         $GLOBALS['TSFE']->getPageRenderer()->addCssFile($cssFile);
     }
 }
 /**
  * creates tags from category titles
  * removes characters: # , space ( ) _
  *
  * @param string $tags comma-list of tags, new tags will be added to this
  * @param array $categoryArray Array of Titles (eg. categories)
  * @author Christian Bülter <*****@*****.**>
  * @since 17.10.14
  */
 public static function makeTags(&$tags, $categoryArray)
 {
     if (is_array($categoryArray) && count($categoryArray)) {
         $extConf = tx_kesearch_helper::getExtConf();
         foreach ($categoryArray as $catTitle) {
             $tag = $catTitle;
             $tag = str_replace('#', '', $tag);
             $tag = str_replace(',', '', $tag);
             $tag = str_replace(' ', '', $tag);
             $tag = str_replace('(', '', $tag);
             $tag = str_replace(')', '', $tag);
             $tag = str_replace('_', '', $tag);
             if (!empty($tags)) {
                 $tags .= ',';
             }
             $tags .= $extConf['prePostTagChar'] . $tag . $extConf['prePostTagChar'];
         }
     }
 }
 /**
  * Injects ke_search extension config
  */
 protected function injectKeSearchExtensionConfig()
 {
     $this->keSearchExtensionConfig = \tx_kesearch_helper::getExtConf();
 }