/**
  * Construcor of this object
  */
 public function __construct($pObj)
 {
     parent::__construct($pObj);
     $this->templavoilaIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('templavoila');
     if ($this->templavoilaIsLoaded) {
         $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('pages') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('pages');
         $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid,title', 'pages', 'pid = 0' . $enableFields);
         $GLOBALS['TT'] = new t3lib_timeTrackNull();
         $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $row['uid'], 0);
         $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_pageSelect');
         $GLOBALS['TSFE']->sys_page->init(TRUE);
         $GLOBALS['TSFE']->initTemplate();
         // Filling the config-array, first with the main "config." part
         if (is_array($GLOBALS['TSFE']->tmpl->setup['config.'])) {
             $GLOBALS['TSFE']->config['config'] = $GLOBALS['TSFE']->tmpl->setup['config.'];
         }
         // override it with the page/type-specific "config."
         if (is_array($GLOBALS['TSFE']->pSetup['config.'])) {
             $GLOBALS['TSFE']->config['config'] = TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($GLOBALS['TSFE']->config['config'], $GLOBALS['TSFE']->pSetup['config.']);
         }
         // generate basic rootline
         $GLOBALS['TSFE']->rootLine = array(0 => array('uid' => $row['uid'], 'title' => $row['title']));
         $this->tv = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_templavoila_pi1');
     }
     $this->counter = 0;
     foreach ($this->indexCTypes as $value) {
         $cTypes[] = 'CType="' . $value . '"';
     }
     $this->whereClauseForCType = implode(' OR ', $cTypes);
     // get all available sys_language_uid records
     $this->sysLanguages = TYPO3\CMS\Backend\Utility\BackendUtility::getSystemLanguages();
 }
 /**
  * get extension manager configuration for ke_search_premium
  * and make it possible to override it with page ts setup
  *
  * @return array
  * @author Christian Bülter <*****@*****.**>
  * @since 14.10.14
  */
 public static function getExtConfPremium()
 {
     $keSearchPremiumIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_search_premium');
     if ($keSearchPremiumIsLoaded) {
         $extConfPremium = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ke_search_premium']);
         if (!$extConfPremium['prePostTagChar']) {
             $extConfPremium['prePostTagChar'] = '_';
         }
     } else {
         $extConfPremium = array();
     }
     // override extConfPremium with TS Setup
     if (is_array($GLOBALS['TSFE']->tmpl->setup['ke_search_premium.']['extconf.']['override.']) && count($GLOBALS['TSFE']->tmpl->setup['ke_search_premium.']['extconf.']['override.'])) {
         foreach ($GLOBALS['TSFE']->tmpl->setup['ke_search_premium.']['extconf.']['override.'] as $key => $value) {
             $extConfPremium[$key] = $value;
         }
     }
     return $extConfPremium;
 }
<?php

$configurationArray = array('ctrl' => array('title' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig', 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'default_sortby' => 'ORDER BY crdate', 'delete' => 'deleted', 'enablecolumns' => array('disabled' => 'hidden'), 'iconfile' => 'EXT:ke_search/res/img/table_icons/icon_tx_kesearch_indexerconfig.gif', 'searchFields' => 'title', 'requestUpdate' => 'type'), 'interface' => array('showRecordFieldList' => 'hidden,title,storagepid,startingpoints_recursive,single_pages,sysfolder,type,index_content_with_restrictions,index_passed_events,,index_news_category_mode,index_news_category_selection,directories,fileext,filteroption'), 'columns' => array('hidden' => array('exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', 'config' => array('type' => 'check', 'default' => '0')), 'title' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.title', 'config' => array('type' => 'input', 'size' => '30')), 'storagepid' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.storagepid', 'config' => array('type' => 'group', 'internal_type' => 'db', 'allowed' => 'pages', 'size' => 1, 'minitems' => 1, 'maxitems' => 1)), 'targetpid' => array('displayCond' => 'FIELD:type:!IN:page,tt_content,file,templavoila,comments,remote', 'exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.targetpid', 'config' => array('type' => 'group', 'internal_type' => 'db', 'allowed' => 'pages', 'size' => 1, 'minitems' => 1, 'maxitems' => 1)), 'type' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'items' => array(array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.0', 'page', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_0.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.1', 'ke_yac', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_1.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.2', 'ttnews', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_2.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.5', 'tt_address', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_5.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.6', 'tt_content', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_6.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.7', 'file', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_7.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.8', 't3s_content', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_8.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.9', 'templavoila', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_9.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.10', 'mmforum', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_10.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.11', 'comments', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_11.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.12', 'news', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_12.gif'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.type.I.13', 'a21glossary', 'EXT:ke_search/res/img/types_backend/selicon_tx_kesearch_indexerconfig_type_13.gif')), 'itemsProcFunc' => 'tx_kesearch_lib_items->fillIndexerConfig', 'size' => 1, 'maxitems' => 1, 'default' => 'page')), 'startingpoints_recursive' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.startingpoints_recursive', 'displayCond' => 'FIELD:type:IN:page,tt_content,ttnews,tt_address,templavoila,comments,news,a21glossary', 'config' => array('type' => 'group', 'internal_type' => 'db', 'allowed' => 'pages', 'size' => 10, 'minitems' => 0, 'maxitems' => 99)), 'single_pages' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.single_pages', 'displayCond' => 'FIELD:type:IN:page,tt_content,templavoila', 'config' => array('type' => 'group', 'internal_type' => 'db', 'allowed' => 'pages', 'size' => 10, 'minitems' => 0, 'maxitems' => 99)), 'sysfolder' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.sysfolder', 'displayCond' => 'FIELD:type:IN:ke_yac,ttnews,tt_address,mmforum,comments,news,a21glossary', 'config' => array('type' => 'group', 'internal_type' => 'db', 'allowed' => 'pages', 'size' => 10, 'minitems' => 0, 'maxitems' => 99)), 'index_content_with_restrictions' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_content_with_restrictions', 'displayCond' => 'FIELD:type:=:page', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'items' => array(array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_content_with_restrictions.I.0', 'yes'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_content_with_restrictions.I.1', 'no')), 'size' => 1, 'maxitems' => 1, 'default' => 'no')), 'index_passed_events' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_passed_events', 'displayCond' => 'FIELD:type:=:ke_yac', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'items' => array(array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_passed_events.I.0', 'yes'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_passed_events.I.1', 'no')), 'size' => 1, 'maxitems' => 1)), 'index_news_category_mode' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_category_mode', 'displayCond' => 'FIELD:type:IN:ttnews,news', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'items' => array(array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_category_mode.I.1', '1'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_category_mode.I.2', '2')), 'size' => 1, 'maxitems' => 1)), 'index_news_archived' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_archived', 'displayCond' => 'FIELD:type:IN:news', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'items' => array(array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_archived.I.0', '0'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_archived.I.1', '1'), array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_archived.I.2', '2')), 'size' => 1, 'maxitems' => 1)), 'index_news_category_selection' => array('exclude' => 1, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_category_selection', 'displayCond' => 'FIELD:type:=:ttnews', 'config' => array('type' => 'none')), 'index_extnews_category_selection' => array('exclude' => 1, 'l10n_mode' => 'mergeIfNotBlank', 'label' => 'LLL:EXT:news/Resources/Private/Language/locallang_db.xml:tx_news_domain_model_news.categories', 'displayCond' => 'FIELD:type:=:news', 'config' => array('type' => 'none')), 'index_news_useHRDatesSingle' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_useHRDatesSingle', 'displayCond' => 'FIELD:type:=:ttnews', 'config' => array('type' => 'check', 'default' => '0')), 'index_news_useHRDatesSingleWithoutDay' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_news_useHRDatesSingleWithoutDay', 'displayCond' => 'FIELD:type:=:ttnews', 'config' => array('type' => 'check', 'default' => '0')), 'index_use_page_tags' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_use_page_tags', 'displayCond' => 'FIELD:type:IN:ttnews,tt_address,mmforum,comments,news', 'config' => array('type' => 'check', 'default' => '0')), 'directories' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.directories', 'displayCond' => 'FIELD:type:IN:file', 'config' => array('type' => 'text', 'cols' => 48, 'rows' => 10, 'eval' => 'trim')), 'fileext' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.fileext', 'displayCond' => 'FIELD:type:IN:file,page,tt_content', 'config' => array('type' => 'input', 'size' => '30', 'default' => 'pdf,ppt,doc,xls')), 'index_use_page_tags_for_files' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.index_use_page_tags_for_files', 'displayCond' => 'FIELD:type:IN:page,tt_content', 'config' => array('type' => 'check', 'default' => '0')), 'commenttypes' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.commenttypes', 'displayCond' => 'FIELD:type:=:comments', 'config' => array('type' => 'input', 'size' => '30', 'default' => 'pages')), 'filteroption' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.filteroption', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'items' => array(array('', 0)), 'itemsProcFunc' => 'user_filterlist->getListOfAvailableFiltersForTCA', 'size' => 1, 'minitems' => 0, 'maxitems' => 1)), 'tvpath' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.tvpath', 'displayCond' => 'FIELD:type:=:templavoila', 'config' => array('type' => 'input', 'size' => '30', 'default' => 'field_content')), 'fal_storage' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.fal_storage', 'displayCond' => 'FIELD:type:=:file', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'items' => array(array('LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.fal_storage.dont_use_fal', -1)), 'size' => 1, 'maxitems' => 1, 'default' => -1, 'foreign_table' => 'sys_file_storage', 'allowNonIdValues' => 1)), 'contenttypes' => array('exclude' => 0, 'label' => 'LLL:EXT:ke_search/locallang_db.xml:tx_kesearch_indexerconfig.contenttypes', 'displayCond' => 'FIELD:type:IN:page,tt_content', 'config' => array('type' => 'input', 'size' => '30', 'default' => 'text,textpic,bullets,table,html,header,uploads'))), 'types' => array('0' => array('showitem' => 'hidden;;1;;1-1-1, title;;;;2-2-2, storagepid,targetpid;;;;3-3-3,type,startingpoints_recursive,single_pages,sysfolder,index_content_with_restrictions,index_passed_events,index_news_archived,index_news_category_mode,index_news_category_selection,index_extnews_category_selection,index_news_useHRDatesSingle,index_news_useHRDatesSingleWithoutDay,index_use_page_tags,fal_storage,directories,fileext,contenttypes,commenttypes,filteroption,tvpath,index_use_page_tags_for_files')), 'palettes' => array('1' => array('showitem' => '')));
// define dependencies to tt_news only if tt_news is installed
if (TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tt_news')) {
    $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['index_news_category_selection']['config'] = array('type' => 'select', 'form_type' => 'user', 'userFunc' => 'tx_ttnews_TCAform_selectTree->renderCategoryFields', 'treeView' => 1, 'foreign_table' => 'tt_news_cat', 'autoSizeMax' => 50, 'minitems' => 0, 'maxitems' => 500);
}
// define dependencies to news only if news is installed
if (TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('news')) {
    $configurationArray['columns']['index_extnews_category_selection']['config'] = array('type' => 'select', 'renderType' => 'selectTree', 'renderMode' => 'tree', 'treeConfig' => array('parentField' => 'parentcategory'), 'foreign_table' => 'tx_news_domain_model_category', 'foreign_table_where' => ' AND (tx_news_domain_model_category.sys_language_uid = 0 OR tx_news_domain_model_category.l10n_parent = 0) ORDER BY tx_news_domain_model_category.sorting', 'size' => 10, 'autoSizeMax' => 20, 'minitems' => 0, 'maxitems' => 20);
    // news version 3 features system categories instead of it's own
    // category system which was used in previous versions
    if (version_compare(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion('news'), '3.0.0') >= 0) {
        $configurationArray['columns']['index_extnews_category_selection']['config']['treeConfig']['parentField'] = 'parent';
        $configurationArray['columns']['index_extnews_category_selection']['config']['foreign_table'] = 'sys_category';
        $configurationArray['columns']['index_extnews_category_selection']['config']['foreign_table_where'] = '';
    }
}
return $configurationArray;
<?php

defined('TYPO3_MODE') or die;
/** @noinspection PhpUndefinedVariableInspection */
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]);
if (TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl') && (!isset($extensionConfiguration['setRealurlConfigByDefault']) || $extensionConfiguration['setRealurlConfigByDefault'] == 1)) {
    /** @noinspection PhpIncludeInspection */
    require_once TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/Realurl/realurl_conf.php';
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin('Evoweb.' . $_EXTKEY, 'Form', array('FeuserCreate' => 'form, preview, proxy, save, confirm, accept, decline, refuse, removeImage', 'FeuserEdit' => 'form, preview, proxy, save, confirm, accept, removeImage', 'FeuserPassword' => 'form, save'), array('FeuserCreate' => 'form, preview, proxy, save, confirm, accept, decline, refuse, removeImage', 'FeuserEdit' => 'form, preview, proxy, save, confirm, accept, removeImage', 'FeuserPassword' => 'form, save'));
$TYPO3_CONF_VARS['FE']['eID_include']['sf_register'] = 'EXT:sf_register/Classes/Api/Ajax.php';
define('SFREGISTERCACHEIDENTIFIER', 'cache_' . $_EXTKEY . '_extending');
// Register cache sf_register
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][SFREGISTERCACHEIDENTIFIER] = array('frontend' => \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, 'backend' => \TYPO3\CMS\Core\Cache\Backend\FileBackend::class, 'options' => array());
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerTypeConverter(\Evoweb\SfRegister\Property\TypeConverter\FrontendUserConverter::class);
if (TYPO3_MODE === 'FE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
    /**
     * Signal slot dispatcher
     *
     * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher
     */
    $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
    $signalSlotDispatcher->connect(\Evoweb\SfRegister\Controller\FeuserController::class, 'initializeAction', \Evoweb\SfRegister\Signal\FeuserControllerSignal::class, 'initializeAction');
}
    /**
     * This function was called from indexer object and saves content to index table
     *
     * @return string content which will be displayed in backend
     */
    public function startIndexing()
    {
        $tagChar = $this->pObj->extConf['prePostTagChar'];
        $now = strtotime('today');
        // get YAC records from specified pid
        $fields = '*';
        $table = 'tx_keyac_dates';
        $where = 'pid IN (' . $this->indexerConfig['sysfolder'] . ') ';
        $where .= ' AND hidden=0 AND deleted=0 ';
        // do not index passed events?
        if ($this->indexerConfig['index_passed_events'] == 'no') {
            $keYacProductsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_yac_products');
            if ($keYacProductsIsLoaded) {
                // special query if ke_yac_products loaded (VNR)
                $where .= '
					AND ((
						tx_keyacproducts_type<>"product"
						AND (startdat >= "' . time() . '" OR enddat >= "' . time() . '")
					) OR (tx_keyacproducts_type="product" AND tx_keyacproducts_product<>""))';
            } else {
                // "normal" YAC events
                $where .= ' AND (startdat >= "' . time() . '" OR enddat >= "' . time() . '")';
            }
        }
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where, $groupBy = '', $orderBy = '', $limit = '');
        $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
        if ($resCount) {
            while ($yacRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                // prepare content for storing in index table
                $title = strip_tags($yacRecord['title']);
                $tags = '';
                $params = '&tx_keyac_pi1[showUid]=' . intval($yacRecord['uid']);
                $abstract = str_replace('<br />', chr(13), $yacRecord['teaser']);
                $abstract = str_replace('<br>', chr(13), $abstract);
                $abstract = str_replace('</p>', chr(13), $abstract);
                $abstract = strip_tags($abstract);
                $content = strip_tags($yacRecord['bodytext']);
                $fullContent = $abstract . "\n" . $content;
                $targetPID = $this->indexerConfig['targetpid'];
                // get tags
                $yacRecordTags = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $yacRecord['tx_keyacsearchtags_tags'], true);
                $tags = '';
                $clearTextTags = '';
                if (count($yacRecordTags)) {
                    foreach ($yacRecordTags as $key => $tagUid) {
                        if ($tags) {
                            $tags .= ',' . $tagChar . $this->getTag($tagUid) . $tagChar;
                        } else {
                            $tags = $tagChar . $this->getTag($tagUid) . $tagChar;
                        }
                        $clearTextTags .= chr(13) . $this->getTag($tagUid, true);
                    }
                }
                // add clearText Tags to content
                if (!empty($clearTextTags)) {
                    $fullContent .= chr(13) . $clearTextTags;
                }
                // make it possible to modify the indexerConfig via hook
                $indexerConfig = $this->indexerConfig;
                // hook for custom modifications of the indexed data, e. g. the tags
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyYACIndexEntry'])) {
                    foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyYACIndexEntry'] as $_classRef) {
                        $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                        $_procObj->modifyYACIndexEntry($title, $abstract, $fullContent, $params, $tags, $yacRecord, $targetPID, $additionalFields, $indexerConfig);
                    }
                }
                // store data in index table
                $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'ke_yac', $targetPID, $fullContent, $tags, $params, $abstract, $yacRecord['sys_language_uid'], $yacRecord['starttime'], $yacRecord['endtime'], $yacRecord['fe_group'], false, $additionalFields);
            }
        }
        $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '": ' . $resCount . ' YAC records have been indexed.</b></p>' . "\n";
        $content .= $this->showErrors();
        $content .= $this->showTime();
        return $content;
    }
 /**
  * This function was called from indexer object and saves content to index table
  *
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     $content = '';
     $this->conf['useHRDatesSingle'] = $this->indexerConfig['index_news_useHRDatesSingle'];
     $this->conf['useHRDatesSingleWithoutDay'] = $this->indexerConfig['index_news_useHRDatesSingleWithoutDay'];
     // get all the tt_news entries to index
     // don't index hidden or deleted news, BUT
     // get the news with frontend user group access restrictions
     // or time (start / stop) restrictions.
     // Copy those restrictions to the index.
     $fields = '*';
     $table = 'tt_news';
     $indexPids = $this->getPidList($this->indexerConfig['startingpoints_recursive'], $this->indexerConfig['sysfolder'], $table);
     if ($this->indexerConfig['index_use_page_tags']) {
         // add the tags of each page to the global page array
         $this->pageRecords = $this->getPageRecords($indexPids);
         $this->addTagsToRecords($indexPids);
     }
     $where = 'pid IN (' . implode(',', $indexPids) . ') ';
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     } else {
         $where .= t3lib_befunc::BEenableFields($table);
         $where .= t3lib_befunc::deleteClause($table);
     }
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $counter = 0;
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
         while ($newsRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // if mode equals 'choose categories for indexing' (2). 1 = All
             if ($this->indexerConfig['index_news_category_mode'] == '2') {
                 if (TYPO3_VERSION_INTEGER >= 7000000) {
                     $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_news_cat') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_news_cat');
                 } else {
                     $enableFields = t3lib_befunc::BEenableFields('tt_news_cat') . t3lib_befunc::deleteClause('tt_news_cat');
                 }
                 $resCat = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tt_news_cat.uid', 'tt_news', 'tt_news_cat_mm', 'tt_news_cat', ' AND tt_news.uid = ' . $newsRecord['uid'] . $enableFields, '', '', '');
                 if ($GLOBALS['TYPO3_DB']->sql_num_rows($resCat)) {
                     $isInList = false;
                     while ($newsCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resCat)) {
                         // if category was found in list, set isInList to true and break further processing.
                         if (TYPO3_VERSION_INTEGER >= 7000000) {
                             if (TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->indexerConfig['index_news_category_selection'], $newsCat['uid'])) {
                                 $isInList = true;
                                 break;
                             }
                         } else {
                             if (t3lib_div::inList($this->indexerConfig['index_news_category_selection'], $newsCat['uid'])) {
                                 $isInList = true;
                                 break;
                             }
                         }
                     }
                     // if category was not found stop further processing and loop with next news record
                     if (!$isInList) {
                         continue;
                     }
                 }
             }
             // compile the information which should go into the index
             $type = 'tt_news';
             $title = strip_tags($newsRecord['title']);
             $abstract = strip_tags($newsRecord['short']);
             $content = strip_tags($newsRecord['bodytext']);
             // add keywords to content if not empty
             if (!empty($newsRecord['keywords'])) {
                 $content .= "\n" . $newsRecord['keywords'];
             }
             // create content
             $fullContent = $abstract . "\n" . $content;
             // create params and custom single view page:
             // if it is a default news (type = 0), add params
             // if it is an internal page (type = 1), put that into the "targetpid" field
             // if it is an external url (type = 2), put that into the "params" field
             if ($newsRecord['type'] == 1) {
                 $singleViewPage = $newsRecord['page'];
                 $params = '';
             } else {
                 if ($newsRecord['type'] == 2) {
                     $type = 'external:tt_news';
                     $singleViewPage = '';
                     $params = $newsRecord['ext_url'];
                 } else {
                     // get target page from category if set (first assigned category)
                     if (TYPO3_VERSION_INTEGER < 6002000) {
                         $ttnewsIsLoaded = t3lib_extMgm::isLoaded('tt_news');
                     } else {
                         $ttnewsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tt_news');
                     }
                     if ($ttnewsIsLoaded) {
                         $singleViewPage = $this->getSingleViewPageFromCategories($newsRecord['uid']);
                     }
                     $paramsSingleView = $this->getParamsForHrDateSingleView($newsRecord['datetime']);
                     $paramsSingleView['tx_ttnews']['tt_news'] = $newsRecord['uid'];
                     $params = '&' . http_build_query($paramsSingleView, NULL, '&');
                     $params = rawurldecode($params);
                 }
             }
             // create tags
             if ($this->indexerConfig['index_use_page_tags']) {
                 $tags = $this->pageRecords[intval($newsRecord['pid'])]['tags'];
             } else {
                 $tags = '';
             }
             // add additional fields
             $additionalFields = array();
             // crdate is always given, but can be overwritten
             $additionalFields['sortdate'] = $newsRecord['crdate'];
             // last changed date
             if (isset($newsRecord['datetime']) && $newsRecord['datetime'] > 0) {
                 $additionalFields['sortdate'] = $newsRecord['datetime'];
             }
             // fill orig_uid and orig_pid
             $additionalFields['orig_uid'] = $newsRecord['uid'];
             $additionalFields['orig_pid'] = $newsRecord['pid'];
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             // overwrite default targetpid value from indexerconfig
             // only if $singleViewPage is set
             if ($singleViewPage) {
                 $indexerConfig['targetpid'] = $singleViewPage;
             }
             // hook for custom modifications of the indexed data, e. g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyNewsIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyNewsIndexEntry'] as $_classRef) {
                     if (TYPO3_VERSION_INTEGER >= 7000000) {
                         $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     } else {
                         $_procObj =& t3lib_div::getUserObj($_classRef);
                     }
                     $_procObj->modifyNewsIndexEntry($title, $abstract, $fullContent, $params, $tags, $newsRecord, $additionalFields, $indexerConfig);
                 }
             }
             // ... and store them
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, $type, $indexerConfig['targetpid'], $fullContent, $tags, $params, $abstract, $newsRecord['sys_language_uid'], $newsRecord['starttime'], $newsRecord['endtime'], $newsRecord['fe_group'], false, $additionalFields);
             $counter++;
         }
         $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '":</b><br />' . "\n" . $counter . ' news have been indexed.</p>' . "\n";
         $content .= $this->showErrors();
         $content .= $this->showTime();
     }
     return $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();
     // 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);
 }
 /**
  * This function was called from indexer object and saves content to index table
  *
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     $tagChar = $this->pObj->extConf['prePostTagChar'];
     // get categories
     $categories = $this->getCategories();
     // get dam records from categories
     $fields = 'DISTINCT tx_dam.*';
     $table = 'tx_dam_mm_cat, tx_dam';
     $where = '1=1';
     if (is_array($categories) && count($categories)) {
         if ($this->indexerConfig['index_dam_without_categories']) {
             $table = 'tx_dam_mm_cat RIGHT JOIN tx_dam ON (tx_dam_mm_cat.uid_local = tx_dam.uid)';
             $where .= ' AND uid_foreign IN (' . implode(',', $categories) . ')';
             $where .= ' OR tx_dam.category = 0';
         } else {
             $where .= ' AND tx_dam_mm_cat.uid_local = tx_dam.uid';
             $where .= ' AND uid_foreign IN (' . implode(',', $categories) . ')';
         }
     }
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_dam');
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_dam');
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
     if ($resCount) {
         while ($damRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $additionalFields = array();
             // prepare content for storing in index table
             $title = strip_tags($damRecord['title']);
             $params = '&tx_dam[uid]=' . intval($damRecord['uid']);
             $abstract = '';
             $content = strip_tags($damRecord['description']);
             $title = strip_tags($damRecord['title']);
             $keywords = strip_tags($damRecord['keywords']);
             $filename = strip_tags($damRecord['file_name']);
             $fullContent = $content . "\n" . $keywords . "\n" . $filename;
             $targetPID = $this->indexerConfig['targetpid'];
             // get tags for this record
             // needs extension ke_search_dam_tags
             $keSearchDamTagsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_search_dam_tags');
             if ($keSearchDamTagsIsLoaded) {
                 $damRecordTags = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $damRecord['tx_kesearchdamtags_tags'], true);
                 $tags = '';
                 $clearTextTags = '';
                 if (count($damRecordTags)) {
                     foreach ($damRecordTags as $key => $tagUid) {
                         if ($tags) {
                             $tags .= ',' . $tagChar . $this->getTag($tagUid) . $tagChar;
                         } else {
                             $tags = $tagChar . $this->getTag($tagUid) . $tagChar;
                         }
                         $clearTextTags .= chr(13) . $this->getTag($tagUid, true);
                     }
                 }
             } else {
                 $tags = '';
             }
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             // hook for custom modifications of the indexed data, e. g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyDAMIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyDAMIndexEntry'] as $_classRef) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     $_procObj->modifyDAMIndexEntry($title, $abstract, $fullContent, $params, $tags, $damRecord, $targetPID, $clearTextTags, $additionalFields, $indexerConfig);
                 }
             }
             // add clearText Tags to content, make them searchable
             // by fulltext search
             if (!empty($clearTextTags)) {
                 $fullContent .= $clearTextTags;
             }
             // store data in index table
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'dam', $indexerConfig['targetpid'], $fullContent, $tags, $params, $abstract, $damRecord['sys_language_uid'], $damRecord['starttime'], $damRecord['endtime'], $damRecord['fe_group'], false, $additionalFields);
         }
     }
     $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '": ' . $resCount . ' DAM records have been indexed.</b></p>' . "\n";
     $content .= $this->showErrors();
     $content .= $this->showTime();
     return $content;
 }
 /**
  * inits the "old school" marker based templates (static or ajax)
  *
  * @return string
  */
 public function initMarkerTemplate()
 {
     // 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();
         }
     }
     // Spinner Image
     if ($this->conf['spinnerImageFile']) {
         $spinnerSrc = $this->conf['spinnerImageFile'];
     } 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();
 }
 /**
  * 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);
 }
 /**
  * Counts searchword and -phrase if ke_stats is installed
  *
  * @param   string $searchphrase
  * @return  void
  * @author  Christian Buelter <*****@*****.**>
  * @since   Tue Mar 01 2011 12:34:25 GMT+0100
  */
 public function countSearchWordWithKeStats($searchphrase = '')
 {
     $searchphrase = trim($searchphrase);
     $keStatsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_stats');
     if ($keStatsIsLoaded && !empty($searchphrase)) {
         $keStatsObj = TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj('EXT:ke_stats/pi1/class.tx_kestats_pi1.php:tx_kestats_pi1');
         $keStatsObj->initApi();
         // count words
         $wordlist = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $searchphrase, true);
         foreach ($wordlist as $singleword) {
             $keStatsObj->increaseCounter('ke_search Words', 'element_title,year,month', $singleword, 0, $this->firstStartingPoint, $GLOBALS['TSFE']->sys_page->sys_language_uid, 0, 'extension');
         }
         // count phrase
         $keStatsObj->increaseCounter('ke_search Phrases', 'element_title,year,month', $searchphrase, 0, $this->firstStartingPoint, $GLOBALS['TSFE']->sys_page->sys_language_uid, 0, 'extension');
         unset($wordlist);
         unset($singleword);
         unset($keStatsObj);
     }
 }
 /**
  * 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);
 }
Example #13
0
 /**
  * Init Function: here all the needed configuration values are stored in class variables..
  */
 function init()
 {
     $this->db = $GLOBALS['TYPO3_DB'];
     $this->tsfe = $GLOBALS['TSFE'];
     $this->pi_loadLL();
     // Loading language-labels
     $this->pi_setPiVarDefaults();
     // Set default piVars from TS
     $this->SIM_ACCESS_TIME = $GLOBALS['SIM_ACCESS_TIME'];
     // fallback for TYPO3 < 4.2
     if (!$this->SIM_ACCESS_TIME) {
         $simTime = $GLOBALS['SIM_EXEC_TIME'];
         $this->SIM_ACCESS_TIME = $simTime - $simTime % 60;
     }
     $this->initCaching();
     $this->local_cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     // Local cObj.
     $this->enableFields = $this->getEnableFields('tt_news');
     if ($this->tt_news_uid === 0) {
         // no tt_news_uid set by displayCurrentRecord
         $this->tt_news_uid = intval($this->piVars['tt_news']);
         // Get the submitted uid of a news (if any)
     }
     if (!isset($this->conf['compatVersion']) || !preg_match('/^\\d+\\.\\d+\\.\\d+$/', $this->conf['compatVersion'])) {
         $this->conf['compatVersion'] = $this->hObj->getCurrentVersion();
     }
     $this->token = md5(microtime());
     if (TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')) {
         $this->versioningEnabled = true;
     }
     // load available syslanguages
     $this->initLanguages();
     // sys_language_mode defines what to do if the requested translation is not found
     $this->sys_language_mode = $this->conf['sys_language_mode'] ? $this->conf['sys_language_mode'] : $this->tsfe->sys_language_mode;
     if ($this->conf['searchFieldList']) {
         // get fieldnames from the tt_news db-table
         $this->fieldNames = array_keys($this->db->admin_get_fields('tt_news'));
         $searchFieldList = $this->hObj->validateFields($this->conf['searchFieldList'], $this->fieldNames);
         if ($searchFieldList) {
             $this->searchFieldList = $searchFieldList;
         }
     }
     // Archive:
     $archiveMode = trim($this->conf['archiveMode']);
     // month, quarter or year listing in AMENU
     $this->config['archiveMode'] = $archiveMode ? $archiveMode : 'month';
     // arcExclusive : -1=only non-archived; 0=don't care; 1=only archived
     $arcExclusive = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'archive', 'sDEF');
     $this->arcExclusive = $arcExclusive ? $arcExclusive : intval($this->conf['archive']);
     $this->config['datetimeDaysToArchive'] = intval($this->conf['datetimeDaysToArchive']);
     $this->config['datetimeHoursToArchive'] = intval($this->conf['datetimeHoursToArchive']);
     $this->config['datetimeMinutesToArchive'] = intval($this->conf['datetimeMinutesToArchive']);
     if ($this->conf['useHRDates']) {
         $this->hObj->convertDates();
     }
     // list of pages where news records will be taken from
     if (!$this->conf['dontUsePidList']) {
         $this->initPidList();
     }
     // itemLinkTarget is only used for categoryLinkMode 3 (catselector) in framesets
     $this->conf['itemLinkTarget'] = trim($this->conf['itemLinkTarget']);
     // id of the page where the search results should be displayed
     $this->config['searchPid'] = intval($this->conf['searchPid']);
     // pages in Single view will be divided by this token
     $this->config['pageBreakToken'] = trim($this->conf['pageBreakToken']) ? trim($this->conf['pageBreakToken']) : '<---newpage--->';
     $this->config['singleViewPointerName'] = trim($this->conf['singleViewPointerName']) ? trim($this->conf['singleViewPointerName']) : 'sViewPointer';
     $maxWordsInSingleView = intval($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'maxWordsInSingleView', 's_misc'));
     $maxWordsInSingleView = $maxWordsInSingleView ? $maxWordsInSingleView : intval($this->conf['maxWordsInSingleView']);
     $this->config['maxWordsInSingleView'] = $maxWordsInSingleView ? $maxWordsInSingleView : 0;
     $this->config['useMultiPageSingleView'] = $this->conf['useMultiPageSingleView'];
     // pid of the page with the single view. the old var PIDitemDisplay is still processed if no other value is found
     $singlePid = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'PIDitemDisplay', 's_misc');
     $this->config['singlePid'] = $singlePid ? $singlePid : intval($this->cObj->stdWrap($this->conf['singlePid'], $this->conf['singlePid.']));
     if (!$this->config['singlePid']) {
         $this->errors[] = 'No singlePid defined';
     }
     // pid to return to when leaving single view
     $backPid = intval($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'backPid', 's_misc'));
     $backPid = $backPid ? $backPid : intval($this->conf['backPid']);
     $backPid = $backPid ? $backPid : intval($this->piVars['backPid']);
     $backPid = $backPid ? $backPid : $this->tsfe->id;
     $this->config['backPid'] = $backPid;
     // max items per page
     $FFlimit = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'listLimit', 's_template'), 0, 1000);
     $limit = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->cObj->stdWrap($this->conf['limit'], $this->conf['limit.']), 0, 1000);
     $limit = $limit ? $limit : 50;
     $this->config['limit'] = $FFlimit ? $FFlimit : $limit;
     $latestLimit = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->cObj->stdWrap($this->conf['latestLimit'], $this->conf['latestLimit.']), 0, 1000);
     $latestLimit = $latestLimit ? $latestLimit : 10;
     $this->config['latestLimit'] = $FFlimit ? $FFlimit : $latestLimit;
     // orderBy and groupBy statements for the list Query
     $orderBy = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'listOrderBy', 'sDEF');
     $orderByTS = trim($this->conf['listOrderBy']);
     $orderBy = $orderBy ? $orderBy : $orderByTS;
     $this->config['orderBy'] = $orderBy;
     if ($orderBy) {
         $ascDesc = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'ascDesc', 'sDEF');
         $this->config['ascDesc'] = $ascDesc;
         if ($this->config['ascDesc']) {
             // remove ASC/DESC from 'orderBy' if it is already set from TS
             $this->config['orderBy'] = preg_replace('/( DESC| ASC)\\b/i', '', $this->config['orderBy']);
         }
     }
     $this->config['groupBy'] = trim($this->conf['listGroupBy']);
     // if this is set, the first image is handled as preview image, which is only shown in list view
     $fImgPreview = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'firstImageIsPreview', 's_misc');
     $this->config['firstImageIsPreview'] = $fImgPreview ? $fImgPreview : $this->conf['firstImageIsPreview'];
     $forcefImgPreview = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'forceFirstImageIsPreview', 's_misc');
     $this->config['forceFirstImageIsPreview'] = $forcefImgPreview ? $fImgPreview : $this->conf['forceFirstImageIsPreview'];
     // List start id
     //		$listStartId = intval($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'listStartId', 's_misc'));
     //		$this->config['listStartId'] = /*$listStartId?$listStartId:*/intval($this->conf['listStartId']);
     // supress pagebrowser
     $noPageBrowser = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'noPageBrowser', 's_template');
     $this->config['noPageBrowser'] = $noPageBrowser ? $noPageBrowser : $this->conf['noPageBrowser'];
     // image sizes/optionSplit given from FlexForms
     $this->config['FFimgH'] = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'imageMaxHeight', 's_template'));
     $this->config['FFimgW'] = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'imageMaxWidth', 's_template'));
     // Get number of alternative Layouts (loop layout in LATEST and LIST view) default is 2:
     $altLayouts = intval($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'alternatingLayouts', 's_template'));
     $altLayouts = $altLayouts ? $altLayouts : intval($this->conf['alternatingLayouts']);
     $this->alternatingLayouts = $altLayouts ? $altLayouts : 2;
     $altLayouts = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'altLayoutsOptionSplit', 's_template'));
     $this->config['altLayoutsOptionSplit'] = $altLayouts ? $altLayouts : trim($this->conf['altLayoutsOptionSplit']);
     // Get cropping length
     $croppingLenghtOptionSplit = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'croppingLenghtOptionSplit', 's_template'));
     $this->config['croppingLenghtOptionSplit'] = $croppingLenghtOptionSplit ? $croppingLenghtOptionSplit : trim($this->conf['croppingLenghtOptionSplit']);
     $this->config['croppingLenght'] = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'croppingLenght', 's_template'));
     $this->initTemplate();
     // Configure caching
     $this->allowCaching = $this->conf['allowCaching'] ? 1 : 0;
     if (!$this->allowCaching) {
         $this->tsfe->set_no_cache();
     }
     // get siteUrl for links in rss feeds. the 'dontInsert' option seems to be needed in some configurations depending on the baseUrl setting
     if (!$this->conf['displayXML.']['dontInsertSiteUrl']) {
         $this->config['siteUrl'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     }
     if ($this->debugTimes) {
         $this->hObj->getParsetime(__METHOD__);
     }
 }