/**
  * Overwrite configuration with
  *      plugin.tx_femanager.settings.new.storeInDatabase
  *
  * @return void
  */
 public function initializeFinisher()
 {
     $configuration = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings);
     if (!empty($configuration['new.']['storeInDatabase.'])) {
         $this->configuration = $configuration['new.']['storeInDatabase.'];
     }
 }
Exemple #2
0
 /**
  * Parse an configuration with ContentObjectRenderer::cObjGetSingle()
  * and return the result.
  *
  * @param array $configuration
  * @return array
  * @internal
  */
 public function resolvePossibleTypoScriptConfiguration(array $configuration = []) : array
 {
     $configuration = $this->extbaseTypoScriptService->convertPlainArrayToTypoScriptArray($configuration);
     $configuration = $this->resolveTypoScriptConfiguration($configuration);
     $configuration = $this->extbaseTypoScriptService->convertTypoScriptArrayToPlainArray($configuration);
     return $configuration;
 }
 /**
  * Etracker code action.
  *
  * @return string
  */
 public function codeAction()
 {
     if (empty($this->settings['securityCode'])) {
         return '';
     }
     $cObject = $this->configurationManager->getContentObject();
     $params = array();
     $securityCode = trim($this->settings['securityCode']);
     // area
     $area = '';
     if (!empty($this->settings['area'])) {
         $area = trim($this->settings['area']);
     }
     if (!empty($this->settings['areaStdWrap'])) {
         $area = $cObject->stdWrap($area, $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings['areaStdWrap']));
     }
     if (!empty($area)) {
         $params['et_areas'] = $area;
     }
     // page name
     if (!empty($this->settings['pageName'])) {
         $pageName = $this->settings['pageName'];
     } else {
         $pageName = !empty($this->getTyposcriptFrontendController()->altPageTitle) ? $this->getTyposcriptFrontendController()->altPageTitle : $this->getTyposcriptFrontendController()->page['title'];
     }
     if (!empty($this->settings['pageNameStdWrap'])) {
         $pageName = $cObject->stdWrap($pageName, $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings['pageNameStdWrap']));
     }
     if (!empty($this->settings['pageNamePrefix'])) {
         $prefixGlue = !empty($this->settings['pageNamePrefixGlue']) ? $this->settings['pageNamePrefixGlue'] : '';
         $pageName = $this->settings['pageNamePrefix'] . ' ' . (!empty($prefixGlue) ? $prefixGlue . ' ' : '') . $pageName;
     }
     if (!empty($this->settings['prefixDomainAndLanguageKey'])) {
         $host = strtolower(GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'));
         $langKey = $this->getTyposcriptFrontendController()->sys_language_isocode ? strtolower($this->getTyposcriptFrontendController()->sys_language_isocode) : '';
         if (!empty($this->settings['defaultLanguageKey']) && empty($langKey)) {
             $langKey = trim($this->settings['defaultLanguageKey']);
         }
         $pageName = '[' . $host . (!empty($langKey) ? '/' . $langKey : '') . '] ' . $pageName;
     }
     if (!empty($this->settings['rootPageId']) && $this->getTyposcriptFrontendController()->id == $this->settings['rootPageId']) {
         $pageName = '__INDEX__' . $pageName;
     }
     if (!empty($pageName)) {
         $params['et_pagename'] = $pageName;
     }
     // utf8 decode fix
     if ($this->settings['enableUTF8DecodeFix']) {
         foreach ($params as $key => $value) {
             $params[$key] = utf8_decode($value);
         }
     }
     return Etracker::getCode($securityCode, $params);
 }
 /**
  * Loads the Extbase Framework configuration.
  *
  * The Extbase framework configuration HAS TO be retrieved using this method, as they are come from different places than the normal settings.
  * Framework configuration is, in contrast to normal settings, needed for the Extbase framework to operate correctly.
  *
  * @param string $extensionName if specified, the configuration for the given extension will be returned (plugin.tx_extensionname)
  * @param string $pluginName if specified, the configuration for the given plugin will be returned (plugin.tx_extensionname_pluginname)
  * @return array the Extbase framework configuration
  */
 public function getConfiguration($extensionName = null, $pluginName = null)
 {
     // 1st level cache
     $configurationCacheKey = strtolower(($extensionName ?: $this->extensionName) . '_' . ($pluginName ?: $this->pluginName));
     if (isset($this->configurationCache[$configurationCacheKey])) {
         return $this->configurationCache[$configurationCacheKey];
     }
     $frameworkConfiguration = $this->getExtbaseConfiguration();
     if (!isset($frameworkConfiguration['persistence']['storagePid'])) {
         $frameworkConfiguration['persistence']['storagePid'] = $this->getDefaultBackendStoragePid();
     }
     // only merge $this->configuration and override switchableControllerActions when retrieving configuration of the current plugin
     if ($extensionName === null || $extensionName === $this->extensionName && $pluginName === $this->pluginName) {
         $pluginConfiguration = $this->getPluginConfiguration($this->extensionName, $this->pluginName);
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($pluginConfiguration, $this->configuration);
         $pluginConfiguration['controllerConfiguration'] = $this->getSwitchableControllerActions($this->extensionName, $this->pluginName);
         if (isset($this->configuration['switchableControllerActions'])) {
             $this->overrideSwitchableControllerActions($pluginConfiguration, $this->configuration['switchableControllerActions']);
         }
     } else {
         $pluginConfiguration = $this->getPluginConfiguration($extensionName, $pluginName);
         $pluginConfiguration['controllerConfiguration'] = $this->getSwitchableControllerActions($extensionName, $pluginName);
     }
     \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($frameworkConfiguration, $pluginConfiguration);
     // only load context specific configuration when retrieving configuration of the current plugin
     if ($extensionName === null || $extensionName === $this->extensionName && $pluginName === $this->pluginName) {
         $frameworkConfiguration = $this->getContextSpecificFrameworkConfiguration($frameworkConfiguration);
     }
     if (!empty($frameworkConfiguration['persistence']['storagePid'])) {
         if (is_array($frameworkConfiguration['persistence']['storagePid'])) {
             /**
              * We simulate the frontend to enable the use of cObjects in
              * stdWrap. Than we convert the configuration to normal TypoScript
              * and apply the stdWrap to the storagePid
              */
             if (!$this->environmentService->isEnvironmentInFrontendMode()) {
                 \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::simulateFrontendEnvironment($this->getContentObject());
             }
             $conf = $this->typoScriptService->convertPlainArrayToTypoScriptArray($frameworkConfiguration['persistence']);
             $frameworkConfiguration['persistence']['storagePid'] = $GLOBALS['TSFE']->cObj->stdWrap($conf['storagePid'], $conf['storagePid.']);
             if (!$this->environmentService->isEnvironmentInFrontendMode()) {
                 \TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility::resetFrontendEnvironment();
             }
         }
         if (!empty($frameworkConfiguration['persistence']['recursive'])) {
             // All implementations of getTreeList allow to pass the ids negative to include them into the result
             // otherwise only childpages are returned
             $storagePids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid']);
             array_walk($storagePids, function (&$storagePid) {
                 if ($storagePid > 0) {
                     $storagePid = -$storagePid;
                 }
             });
             $frameworkConfiguration['persistence']['storagePid'] = $this->getRecursiveStoragePids(implode(',', $storagePids), (int) $frameworkConfiguration['persistence']['recursive']);
         }
     }
     // 1st level cache
     $this->configurationCache[$configurationCacheKey] = $frameworkConfiguration;
     return $frameworkConfiguration;
 }
 /**
  * Initialize
  */
 public function initializeFinisher()
 {
     $configuration = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings);
     if (!empty($configuration['dbEntry.'])) {
         $this->configuration = $configuration['dbEntry.'];
     }
 }
 /**
  * Initialize
  */
 public function initializeFinisher()
 {
     $configuration = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings);
     if (!empty($configuration['dbEntry.'])) {
         $this->configuration = $configuration['dbEntry.'];
     }
     if ($this->isConfigurationAvailable()) {
         $this->addArrayToDataArray(['uid' => $this->mail->getUid()]);
         $this->addArrayToDataArray($this->mailRepository->getVariablesWithMarkersFromMail($this->mail));
     }
 }
 function add_ts_setup_dots($arr)
 {
     return $this->typoscriptService->convertPlainArrayToTypoScriptArray($arr);
 }
 /**
  * Load settings and apply stdWrap to them
  */
 protected function loadSettings()
 {
     if (!is_array($this->settings['results.'])) {
         $this->settings['results.'] = array();
     }
     $typoScriptArray = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings['results']);
     $this->settings['results.']['summaryCropAfter'] = MathUtility::forceIntegerInRange($GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['summaryCropAfter'], $typoScriptArray['summaryCropAfter.']), 10, 5000, 180);
     $this->settings['results.']['summaryCropSignifier'] = $GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['summaryCropSignifier'], $typoScriptArray['summaryCropSignifier.']);
     $this->settings['results.']['titleCropAfter'] = MathUtility::forceIntegerInRange($GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['titleCropAfter'], $typoScriptArray['titleCropAfter.']), 10, 500, 50);
     $this->settings['results.']['titleCropSignifier'] = $GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['titleCropSignifier'], $typoScriptArray['titleCropSignifier.']);
     $this->settings['results.']['markupSW_summaryMax'] = MathUtility::forceIntegerInRange($GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['markupSW_summaryMax'], $typoScriptArray['markupSW_summaryMax.']), 10, 5000, 300);
     $this->settings['results.']['markupSW_postPreLgd'] = MathUtility::forceIntegerInRange($GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['markupSW_postPreLgd'], $typoScriptArray['markupSW_postPreLgd.']), 1, 500, 60);
     $this->settings['results.']['markupSW_postPreLgd_offset'] = MathUtility::forceIntegerInRange($GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['markupSW_postPreLgd_offset'], $typoScriptArray['markupSW_postPreLgd_offset.']), 1, 50, 5);
     $this->settings['results.']['markupSW_divider'] = $GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['markupSW_divider'], $typoScriptArray['markupSW_divider.']);
     $this->settings['results.']['hrefInSummaryCropAfter'] = MathUtility::forceIntegerInRange($GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['hrefInSummaryCropAfter'], $typoScriptArray['hrefInSummaryCropAfter.']), 10, 400, 60);
     $this->settings['results.']['hrefInSummaryCropSignifier'] = $GLOBALS['TSFE']->cObj->stdWrap($typoScriptArray['hrefInSummaryCropSignifier'], $typoScriptArray['hrefInSummaryCropSignifier.']);
 }
 /**
  * Return icon for file extension
  *
  * @param string $imageType File extension / item type
  * @param string $alt Title attribute value in icon.
  * @param array $specRowConf TypoScript configuration specifically for search result.
  * @return string <img> tag for icon
  * @todo Define visibility
  */
 public function makeItemTypeIcon($imageType, $alt, $specRowConf)
 {
     // Build compound key if item type is 0, iconRendering is not used
     // and specialConfiguration.[pid].pageIcon was set in TS
     if ($imageType === '0' && $specRowConf['_pid'] && is_array($specRowConf['pageIcon']) && !is_array($this->settings['iconRendering'])) {
         $imageType .= ':' . $specRowConf['_pid'];
     }
     if (!isset($this->iconFileNameCache[$imageType])) {
         $this->iconFileNameCache[$imageType] = '';
         // If TypoScript is used to render the icon:
         if (is_array($this->settings['iconRendering'])) {
             /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj */
             $cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
             $cObj->setCurrentVal($imageType);
             $typoScriptArray = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings['iconRendering']);
             $this->iconFileNameCache[$imageType] = $cObj->cObjGetSingle($this->settings['iconRendering']['_typoScriptNodeValue'], $typoScriptArray);
         } else {
             // Default creation / finding of icon:
             $icon = '';
             if ($imageType === '0' || substr($imageType, 0, 2) == '0:') {
                 if (is_array($specRowConf['pageIcon'])) {
                     $this->iconFileNameCache[$imageType] = $GLOBALS['TSFE']->cObj->cObjGetSingle('IMAGE', $specRowConf['pageIcon']);
                 } else {
                     $icon = 'EXT:indexed_search/pi/res/pages.gif';
                 }
             } elseif ($this->externalParsers[$imageType]) {
                 $icon = $this->externalParsers[$imageType]->getIcon($imageType);
             }
             if ($icon) {
                 $fullPath = GeneralUtility::getFileAbsFileName($icon);
                 if ($fullPath) {
                     $info = @getimagesize($fullPath);
                     $iconPath = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($fullPath);
                     $this->iconFileNameCache[$imageType] = is_array($info) ? '<img src="' . $iconPath . '" ' . $info[3] . ' title="' . htmlspecialchars($alt) . '" alt="" />' : '';
                 }
             }
         }
     }
     return $this->iconFileNameCache[$imageType];
 }
 /**
  * Parse given TypoScript configuration
  *
  * @param array $configuration TypoScript configuration
  * @param boolean $isPlain Is a plain "Fluid like" configuration array
  * @return array Parsed configuration
  */
 public static function parse(array $configuration, $isPlain = TRUE)
 {
     if (empty(self::$contentObject)) {
         self::initialize();
     }
     // Convert to classic TypoScript array
     if ($isPlain) {
         $configuration = \TYPO3\CMS\Extbase\Service\TypoScriptService::convertPlainArrayToTypoScriptArray($configuration);
     }
     // Parse configuration
     $configuration = self::parseTypoScriptArray($configuration);
     $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::removeDotsFromTS($configuration);
     return $configuration;
 }