/**
  * The main method of the PlugIn
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  * @return	The content that is displayed on the website
  */
 function main($content, $conf)
 {
     $this->ms = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_loadLL();
     // Configuring so caching is not expected. This value means that no cHash params are ever set.
     // We do this, because it's a USER_INT object!
     $this->pi_USER_INT_obj = 1;
     // initializes plugin configuration
     $this->init();
     if ($this->conf['resultPage'] != $GLOBALS['TSFE']->id) {
         $content = '<div id="textmessage">' . $this->pi_getLL('error_resultPage') . '</div>';
         return $this->pi_wrapInBaseClass($content);
     }
     // init template
     $this->initFluidTemplate();
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->addInitials($this);
         }
     }
     // assign isEmptySearch to fluid templates
     $this->fluidTemplateVariables['isEmptySearch'] = $this->isEmptySearch;
     // render "no results"-message, "too short words"-message and finally the result list
     $this->getSearchResults();
     // number of results
     $this->fluidTemplateVariables['numberofresults'] = $this->numberOfResults;
     // render links for sorting, fluid template variables are filled in class tx_kesearch_lib_sorting
     $this->renderOrdering();
     // process query time
     $queryTime = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime'];
     $this->fluidTemplateVariables['queryTime'] = $queryTime;
     $this->fluidTemplateVariables['queryTimeText'] = sprintf($this->pi_getLL('query_time'), $queryTime);
     // render pagebrowser
     if ($GLOBALS['TSFE']->id == $this->conf['resultPage']) {
         if ($this->conf['pagebrowserOnTop'] || $this->conf['pagebrowserAtBottom']) {
             $this->renderPagebrowser();
         }
     }
     // generate HTML output
     $this->resultListView->assignMultiple($this->fluidTemplateVariables);
     $htmlOutput = $this->resultListView->render();
     return $htmlOutput;
 }
 /**
  * The main method of the PlugIn
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  * @return	The content that is displayed on the website
  */
 function main($content, $conf)
 {
     $this->ms = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_loadLL();
     $this->pi_USER_INT_obj = 1;
     // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
     // initializes plugin configuration
     $this->init();
     // init domReady action
     $this->initDomReadyAction();
     // add header parts when in searchbox mode
     $this->addHeaderParts();
     // init template for pi1
     if ($this->conf['renderMethod'] == 'fluidtemplate') {
         $this->initFluidTemplate();
     } else {
         $content = $this->initMarkerTemplate();
         if ($content) {
             return $content;
         }
     }
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->addInitials($this);
         }
     }
     // get content for searchbox (get the real content for marker based
     // templating and fill the variables for fluid rendering)
     $content = $this->getSearchboxContent();
     // show loading message for marker based and ajax template
     if ($this->conf['renderMethod'] != 'fluidtemplate') {
         $content = $this->renderAdditionalSearchboxContent($content);
     }
     if ($this->conf['renderMethod'] == 'fluidtemplate') {
         // assign variables and do the rendering
         $this->searchFormView->assignMultiple($this->fluidTemplateVariables);
         $htmlOutput = $this->searchFormView->render();
     } else {
         $htmlOutput = $this->pi_wrapInBaseClass($content);
     }
     return $htmlOutput;
 }
 /**
  * The main method of the PlugIn
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  * @return	The content that is displayed on the website
  */
 function main($content, $conf)
 {
     $this->ms = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_loadLL();
     $this->pi_USER_INT_obj = 1;
     // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
     // initializes plugin configuration
     $this->init();
     // init XAJAX?
     if ($this->conf['renderMethod'] != 'static') {
         $xajaxIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('xajax');
         if (!$xajaxIsLoaded) {
             return '<span style="color: red;"><b>ke_search error:</b>"XAJAX" must be installed for this mode.</span>';
         } else {
             $this->initXajax();
         }
     }
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->addInitials($this);
         }
     }
     // get templates
     $template['multiselect'] = $this->cObj->getSubpart($this->templateCode, '###SUB_FILTER_MULTISELECT###');
     $template['multihidden'] = $this->cObj->getSubpart($template['multiselect'], '###SUB_FILTER_MULTISELECT_HIDDEN###');
     $template['multifilter'] = $this->cObj->getSubpart($template['multiselect'], '###SUB_FILTER_MULTISELECT_FILTER###');
     $template['multioption'] = $this->cObj->getSubpart($template['multifilter'], '###SUB_FILTER_MULTISELECT_OPTION###');
     // get current filter
     $filters = $this->filters->getFilters();
     foreach ($filters as $filter) {
         if ($filter['target_pid'] == intval($GLOBALS['TSFE']->id)) {
             break;
         }
     }
     // hook for modifying content
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyMultiselectContent'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyMultiselectContent'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $content = $_procObj->modifyMultiselectContent($template['multiselect'], $filter, $this);
         }
     }
     if (is_array($filter) && count($filter)) {
         $contentOptions = '';
         $optionsAmountArray = $GLOBALS['TSFE']->fe_user->getKey('ses', 'ke_search.tagsInSearchResults');
         $countLoops = 1;
         if (is_array($this->piVars['filter'][$filter['uid']]) && count($this->piVars['filter'][$filter['uid']])) {
             $this->piVars['filter'][$filter['uid']] = array_unique($this->piVars['filter'][$filter['uid']]);
         }
         foreach ($filter['options'] as $optionKey => $option) {
             $option['title'] = htmlspecialchars($option['title']);
             $option['tag'] = htmlspecialchars($option['tag']);
             if ($optionsAmountArray[$option['tag']]) {
                 $optionCounter = $optionsAmountArray[$option['tag']];
             } else {
                 $optionCounter = 0;
             }
             $selected = $this->piVars['filter'][$filter['uid']][$optionKey] ? 'checked="checked"' : '';
             $markerArray['###ADDCLASS###'] = $countLoops % 3 ? '' : ' last';
             $markerArray['###FILTERNAME###'] = 'tx_kesearch_pi1[filter][' . $filter['uid'] . ']';
             $markerArray['###OPTIONID###'] = $option['uid'];
             $markerArray['###OPTIONKEY###'] = $optionKey;
             $markerArray['###OPTIONTITLE###'] = $option['title'] . ' (' . $optionCounter . ')';
             $markerArray['###OPTIONTAG###'] = $option['tag'];
             $markerArray['###SELECTED###'] = $selected;
             $countLoops++;
             $contentOptions .= $this->cObj->substituteMarkerArray($template['multioption'], $markerArray);
         }
         $content .= $this->cObj->substituteSubpart($template['multifilter'], '###SUB_FILTER_MULTISELECT_OPTION###', $contentOptions);
         $content = $this->cObj->substituteMarker($content, '###TITLE###', $filter['title']);
     }
     $content = $this->cObj->substituteSubpart($template['multiselect'], '###SUB_FILTER_MULTISELECT_FILTER###', $content);
     $content = $this->cObj->substituteMarker($content, '###FORM_ACTION###', $this->pi_getPageLink($this->conf['resultPage']));
     $content = $this->cObj->substituteMarker($content, '###SHOW_RESULTS###', $this->pi_getLL('show_results'));
     $content = $this->cObj->substituteMarker($content, '###LINK_BACK###', $this->cObj->typoLink($this->pi_getLL('back'), array('parameter' => $this->conf['resultPage'], 'addQueryString' => 1, 'addQueryString.' => array('exclude' => 'id'))));
     if (is_array($this->piVars['filter']) && count($this->piVars['filter'])) {
         foreach ($this->piVars['filter'] as $filterKey => $filterValue) {
             if ($filterKey == $filter['uid']) {
                 continue;
             }
             foreach ($this->piVars['filter'][$filterKey] as $optionKey => $option) {
                 $hidden .= $this->cObj->substituteMarker($template['multihidden'], '###NAME###', 'tx_kesearch_pi1[filter][' . $filterKey . '][' . $optionKey . ']');
                 $hidden = $this->cObj->substituteMarker($hidden, '###VALUE###', $option);
             }
         }
     }
     $content = $this->cObj->substituteSubpart($content, '###SUB_FILTER_MULTISELECT_HIDDEN###', $hidden);
     $content = $this->cObj->substituteMarker($content, '###PAGEID###', $this->conf['resultPage']);
     $content = $this->cObj->substituteMarker($content, '###SWORD###', htmlspecialchars($this->piVars['sword']));
     return $this->pi_wrapInBaseClass($content);
 }
 /**
  * The main method of the PlugIn
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  * @return	The content that is displayed on the website
  */
 function main($content, $conf)
 {
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $this->ms = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
     } else {
         $this->ms = t3lib_div::milliseconds();
     }
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_loadLL();
     $this->pi_USER_INT_obj = 1;
     // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
     // initializes plugin configuration
     $this->init();
     // init domReady action
     $this->initDomReadyAction();
     // add header parts when in searchbox mode
     $this->addHeaderParts();
     // init XAJAX?
     if ($this->conf['renderMethod'] != 'static') {
         if (TYPO3_VERSION_INTEGER < 6002000) {
             $xajaxIsLoaded = t3lib_extMgm::isLoaded('xajax');
         } else {
             $xajaxIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('xajax');
         }
         if (!$xajaxIsLoaded) {
             return '<span style="color: red;"><b>ke_search error:</b>"XAJAX" must be installed for this mode.</span>';
         } else {
             $this->initXajax();
         }
     }
     // Spinner Image
     if ($this->conf['spinnerImageFile']) {
         $spinnerSrc = $this->conf['spinnerImageFile'];
     } else {
         if (TYPO3_VERSION_INTEGER < 6002000) {
             $spinnerSrc = t3lib_extMgm::siteRelPath($this->extKey) . 'res/img/spinner.gif';
         } else {
             $spinnerSrc = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/spinner.gif';
         }
     }
     $this->spinnerImageFilters = '<img id="kesearch_spinner_filters" src="' . $spinnerSrc . '" alt="' . $this->pi_getLL('loading') . '" />';
     $this->spinnerImageResults = '<img id="kesearch_spinner_results" src="' . $spinnerSrc . '" alt="' . $this->pi_getLL('loading') . '" />';
     // get javascript onclick actions
     $this->initOnclickActions();
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             if (TYPO3_VERSION_INTEGER >= 7000000) {
                 $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             } else {
                 $_procObj =& t3lib_div::getUserObj($_classRef);
             }
             $_procObj->addInitials($this);
         }
     }
     // get content
     $content = $this->getSearchboxContent();
     $subpart = $this->cObj->getSubpart($content, '###SHOW_SPINNER###');
     if ($this->conf['renderMethod'] == 'static') {
         $content = $this->cObj->substituteSubpart($content, '###SHOW_SPINNER###', '');
     } else {
         $subpart = $this->cObj->substituteMarker($subpart, '###SPINNER###', $this->spinnerImageFilters);
         $content = $this->cObj->substituteSubpart($content, '###SHOW_SPINNER###', $subpart);
     }
     $content = $this->cObj->substituteMarker($content, '###LOADING###', $this->pi_getLL('loading'));
     // hook for additional searchbox markers
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['additionalSearchboxContent'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['additionalSearchboxContent'] as $_classRef) {
             if (TYPO3_VERSION_INTEGER >= 7000000) {
                 $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             } else {
                 $_procObj =& t3lib_div::getUserObj($_classRef);
             }
             $_procObj->additionalSearchboxContent($content, $this);
         }
     }
     return $this->pi_wrapInBaseClass($content);
 }
 /**
  * The main method of the PlugIn
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  * @return	The content that is displayed on the website
  */
 function main($content, $conf)
 {
     $this->ms = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_loadLL();
     $this->pi_USER_INT_obj = 1;
     // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
     // initializes plugin configuration
     $this->init();
     if ($this->conf['resultPage'] != $GLOBALS['TSFE']->id) {
         $content = '<div id="textmessage">' . $this->pi_getLL('error_resultPage') . '</div>';
         return $this->pi_wrapInBaseClass($content);
     }
     // init template
     if ($this->conf['renderMethod'] == 'fluidtemplate') {
         $this->initFluidTemplate();
     } else {
         if (!$this->initMarkerTemplate()) {
             return;
         }
     }
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->addInitials($this);
         }
     }
     // fetch template code for marker based templating
     if ($this->conf['renderMethod'] != 'fluidtemplate') {
         $content = $this->cObj->getSubpart($this->templateCode, '###RESULT_LIST###');
     }
     // hook: modifyResultList (only valid for marker based templating, not for fluid based templating)
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyResultList'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyResultList'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->modifyResultList($content, $this);
         }
     }
     // assign isEmptySearch to fluid templates
     $this->fluidTemplateVariables['isEmptySearch'] = $this->isEmptySearch;
     // if there's exclusive content do the rendering and stop here
     if ($this->conf['renderMethod'] != 'fluidtemplate') {
         $exclusiveContent = $this->renderExclusiveMarkerBasedContent();
         if ($exclusiveContent) {
             return $exclusiveContent;
         }
     }
     // render "no results"-message, "too short words"-message and finally the result list
     $resultList = $this->getSearchResults();
     $content = $this->cObj->substituteMarker($content, '###MESSAGE###', $resultList);
     // number of results
     $content = $this->cObj->substituteMarker($content, '###NUMBER_OF_RESULTS###', sprintf($this->pi_getLL('num_results'), $this->numberOfResults));
     $this->fluidTemplateVariables['numberofresults'] = $this->numberOfResults;
     // sorting, fluid template variables are filled in class tx_kesearch_lib_sorting
     $content = $this->cObj->substituteMarker($content, '###ORDERING###', $this->renderOrdering());
     // spinner and loading icon (does not apply to fluid template)
     if ($this->conf['renderMethod'] != 'fluidtemplate') {
         $subpart = $this->cObj->getSubpart($content, '###SHOW_SPINNER###');
         if ($this->conf['renderMethod'] == 'static') {
             $content = $this->cObj->substituteSubpart($content, '###SHOW_SPINNER###', '');
         } else {
             $subpart = $this->cObj->substituteMarker($subpart, '###SPINNER###', $this->spinnerImageResults);
             $content = $this->cObj->substituteSubpart($content, '###SHOW_SPINNER###', $subpart);
         }
         $content = $this->cObj->substituteMarker($content, '###LOADING###', $this->pi_getLL('loading'));
     }
     // process query time
     $queryTime = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime'];
     $this->fluidTemplateVariables['queryTime'] = $queryTime;
     $this->fluidTemplateVariables['queryTimeText'] = sprintf($this->pi_getLL('query_time'), $queryTime);
     if ($this->conf['showQueryTime']) {
         $content = $this->cObj->substituteMarker($content, '###QUERY_TIME###', sprintf($this->pi_getLL('query_time'), $queryTime));
     } else {
         $content = $this->cObj->substituteMarker($content, '###QUERY_TIME###', '');
     }
     // render pagebrowser
     if ($GLOBALS['TSFE']->id == $this->conf['resultPage']) {
         if ($this->conf['pagebrowserOnTop'] || $this->conf['pagebrowserAtBottom']) {
             $pagebrowserContent = $this->renderPagebrowser();
         }
         if ($this->conf['pagebrowserOnTop']) {
             $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_TOP###', $pagebrowserContent);
         } else {
             $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_TOP###', '');
         }
         if ($this->conf['pagebrowserAtBottom']) {
             $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_BOTTOM###', $pagebrowserContent);
         } else {
             $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_BOTTOM###', '');
         }
     }
     // generate HTML output (fluid or marker based templating)
     if ($this->conf['renderMethod'] == 'fluidtemplate') {
         $this->resultListView->assignMultiple($this->fluidTemplateVariables);
         $htmlOutput = $this->resultListView->render();
     } else {
         $htmlOutput = $this->pi_wrapInBaseClass($content);
     }
     return $htmlOutput;
 }
 /**
  * This function will be called from AJAX directly, so this must be public
  *
  * @param $data
  */
 public function refresh($data)
 {
     // initializes plugin configuration
     $this->init();
     // set pivars
     foreach ($data[$this->prefixId] as $key => $value) {
         if (is_array($data[$this->prefixId][$key])) {
             foreach ($data[$this->prefixId][$key] as $subkey => $subtag) {
                 $this->piVars[$key][$subkey] = $subtag;
             }
         } else {
             $this->piVars[$key] = $value;
         }
     }
     // create a list of all filters in piVars
     if (is_array($this->piVars['filter'])) {
         foreach ($this->piVars['filter'] as $key => $value) {
             if (is_array($this->piVars['filter'][$key])) {
                 $filterString .= implode($this->piVars['filter'][$key]);
             } else {
                 $filterString .= $this->piVars['filter'][$key];
             }
         }
     }
     // generate onload image
     $this->onloadImage = $this->createHideSpinner();
     // init javascript onclick actions
     $this->initOnclickActions();
     // reset filters?
     if ($this->piVars['resetFilters'] && is_array($this->piVars['filter'])) {
         foreach ($this->piVars['filter'] as $key => $value) {
             // do not reset the preselected filters
             if ($this->preselectedFilter[$key]) {
                 $this->piVars['filter'][$key] = $this->preselectedFilter[$key];
             }
         }
     }
     // make xajax response object
     $objResponse = new tx_xajax_response();
     if (!$filterString && !$this->piVars['sword'] && $this->conf['showTextInsteadOfResults']) {
         $objResponse->addAssign('kesearch_results', 'innerHTML', $this->pi_RTEcssText($this->conf['textForResults']));
         $objResponse->addAssign('kesearch_query_time', 'innerHTML', '');
         $objResponse->addAssign('kesearch_ordering', 'innerHTML', '');
         $objResponse->addAssign('kesearch_pagebrowser_top', 'innerHTML', '');
         $objResponse->addAssign('kesearch_pagebrowser_bottom', 'innerHTML', '');
         $objResponse->addAssign('kesearch_updating_results', 'innerHTML', '');
         $objResponse->addAssign('kesearch_num_results', 'innerHTML', '');
         $objResponse->addAssign('kesearch_filters', 'innerHTML', $this->renderFilters() . $this->onloadImage);
     } else {
         // set search results
         // process if on result page
         if ($GLOBALS['TSFE']->id == $this->conf['resultPage']) {
             $objResponse->addAssign('kesearch_results', 'innerHTML', $this->getSearchResults() . $this->onloadImage);
             $objResponse->addAssign('kesearch_num_results', 'innerHTML', sprintf($this->pi_getLL('num_results'), $this->numberOfResults));
             $objResponse->addAssign('kesearch_ordering', 'innerHTML', $this->renderOrdering());
         }
         // set pagebrowser
         if ($GLOBALS['TSFE']->id == $this->conf['resultPage']) {
             if ($this->conf['pagebrowserOnTop'] || $this->conf['pagebrowserAtBottom']) {
                 $pagebrowserContent = $this->renderPagebrowser();
             }
             if ($this->conf['pagebrowserOnTop']) {
                 $objResponse->addAssign('kesearch_pagebrowser_top', 'innerHTML', $pagebrowserContent);
             } else {
                 $objResponse->addAssign('kesearch_pagebrowser_top', 'innerHTML', '');
             }
             if ($this->conf['pagebrowserAtBottom']) {
                 $objResponse->addAssign('kesearch_pagebrowser_bottom', 'innerHTML', $pagebrowserContent);
             } else {
                 $objResponse->addAssign('kesearch_pagebrowser_bottom', 'innerHTML', '');
             }
         }
         // set filters
         $objResponse->addAssign('kesearch_filters', 'innerHTML', $this->renderFilters() . $this->onloadImage);
         // set end milliseconds for query time calculation
         if ($this->conf['showQueryTime']) {
             // Calculate Querytime
             // we have two plugin. That's why we work with register here.
             $GLOBALS['TSFE']->register['ke_search_queryTime'] = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime'];
             $objResponse->addAssign('kesearch_query_time', 'innerHTML', sprintf($this->pi_getLL('query_time'), $GLOBALS['TSFE']->register['ke_search_queryTime']));
         }
     }
     // return response xml
     return $objResponse->getXML();
 }
 /**
  * The main method of the PlugIn
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  * @return	The content that is displayed on the website
  */
 function main($content, $conf)
 {
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $this->ms = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
     } else {
         $this->ms = t3lib_div::milliseconds();
     }
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_loadLL();
     $this->pi_USER_INT_obj = 1;
     // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
     // initializes plugin configuration
     $this->init();
     if ($this->conf['resultPage'] != $GLOBALS['TSFE']->id) {
         $content = '<div id="textmessage">' . $this->pi_getLL('error_resultPage') . '</div>';
         return $this->pi_wrapInBaseClass($content);
     }
     // init XAJAX?
     if ($this->conf['renderMethod'] != 'static') {
         if (TYPO3_VERSION_INTEGER < 6002000) {
             $xajaxIsLoaded = t3lib_extMgm::isLoaded('xajax');
         } else {
             $xajaxIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('xajax');
         }
         if (!$xajaxIsLoaded) {
             return;
         } else {
             $this->initXajax();
         }
     }
     // Spinner Image
     if ($this->conf['spinnerImageFile']) {
         $spinnerSrc = $this->conf['spinnerImageFile'];
     } else {
         if (TYPO3_VERSION_INTEGER < 6002000) {
             $spinnerSrc = t3lib_extMgm::siteRelPath($this->extKey) . 'res/img/spinner.gif';
         } else {
             $spinnerSrc = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'res/img/spinner.gif';
         }
     }
     $this->spinnerImageFilters = '<img id="kesearch_spinner_filters" src="' . $spinnerSrc . '" alt="' . $this->pi_getLL('loading') . '" />';
     $this->spinnerImageResults = '<img id="kesearch_spinner_results" src="' . $spinnerSrc . '" alt="' . $this->pi_getLL('loading') . '" />';
     // get javascript onclick actions
     $this->initOnclickActions();
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             if (TYPO3_VERSION_INTEGER >= 7000000) {
                 $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             } else {
                 $_procObj =& t3lib_div::getUserObj($_classRef);
             }
             $_procObj->addInitials($this);
         }
     }
     $content = $this->cObj->getSubpart($this->templateCode, '###RESULT_LIST###');
     // hook: modifyResultList
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyResultList'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyResultList'] as $_classRef) {
             if (TYPO3_VERSION_INTEGER >= 7000000) {
                 $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             } else {
                 $_procObj =& t3lib_div::getUserObj($_classRef);
             }
             $_procObj->modifyResultList($content, $this);
         }
     }
     // show text instead of results if no searchparams set and activated in ff
     if ($this->isEmptySearch && $this->conf['showTextInsteadOfResults']) {
         // Don't replace the following with substituteMarker
         // this is used to be valid against JavaScript calls
         $content = '<div id="textmessage">' . $this->pi_RTEcssText($this->conf['textForResults']) . '</div>';
         $content .= '<div id="kesearch_results"></div>';
         $content .= '<div id="kesearch_updating_results"></div>';
         $content .= '<div id="kesearch_pagebrowser_top"></div>';
         $content .= '<div id="kesearch_pagebrowser_bottom"></div>';
         $content .= '<div id="kesearch_query_time"></div>';
         return $content;
     }
     if ($this->conf['renderMethod'] == 'ajax_after_reload') {
         $content = $this->cObj->substituteMarker($content, '###MESSAGE###', '');
         $content = $this->cObj->substituteMarker($content, '###QUERY_TIME###', '');
         $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_TOP###', '');
         $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_BOTTOM###', '');
         $content = $this->cObj->substituteMarker($content, '###NUMBER_OF_RESULTS###', '');
         $content = $this->cObj->substituteMarker($content, '###ORDERING###', '');
         $content = $this->cObj->substituteMarker($content, '###SPINNER###', '');
         $content = $this->cObj->substituteMarker($content, '###LOADING###', '');
         return $this->pi_wrapInBaseClass($content);
     }
     $content = $this->cObj->substituteMarker($content, '###MESSAGE###', $this->getSearchResults());
     $content = $this->cObj->substituteMarker($content, '###NUMBER_OF_RESULTS###', sprintf($this->pi_getLL('num_results'), $this->numberOfResults));
     $content = $this->cObj->substituteMarker($content, '###ORDERING###', $this->renderOrdering());
     $subpart = $this->cObj->getSubpart($content, '###SHOW_SPINNER###');
     if ($this->conf['renderMethod'] == 'static') {
         $content = $this->cObj->substituteSubpart($content, '###SHOW_SPINNER###', '');
     } else {
         $subpart = $this->cObj->substituteMarker($subpart, '###SPINNER###', $this->spinnerImageResults);
         $content = $this->cObj->substituteSubpart($content, '###SHOW_SPINNER###', $subpart);
     }
     $content = $this->cObj->substituteMarker($content, '###LOADING###', $this->pi_getLL('loading'));
     // process query time
     if ($this->conf['showQueryTime']) {
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             $queryTime = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime'];
         } else {
             $queryTime = t3lib_div::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime'];
         }
         $content = $this->cObj->substituteMarker($content, '###QUERY_TIME###', sprintf($this->pi_getLL('query_time'), $queryTime));
     } else {
         $content = $this->cObj->substituteMarker($content, '###QUERY_TIME###', '');
     }
     // render pagebrowser
     if ($GLOBALS['TSFE']->id == $this->conf['resultPage']) {
         if ($this->conf['pagebrowserOnTop'] || $this->conf['pagebrowserAtBottom']) {
             $pagebrowserContent = $this->renderPagebrowser();
         }
         if ($this->conf['pagebrowserOnTop']) {
             $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_TOP###', $pagebrowserContent);
         } else {
             $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_TOP###', '');
         }
         if ($this->conf['pagebrowserAtBottom']) {
             $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_BOTTOM###', $pagebrowserContent);
         } else {
             $content = $this->cObj->substituteMarker($content, '###PAGEBROWSER_BOTTOM###', '');
         }
     }
     return $this->pi_wrapInBaseClass($content);
 }