/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { $this->id = intval(GeneralUtility::_GET('id')); $this->tsParser = new TsParserUtility(); // extension configuration $extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['themes']); $extensionConfiguration['categoriesToShow'] = GeneralUtility::trimExplode(',', $extensionConfiguration['categoriesToShow']); $extensionConfiguration['constantsToHide'] = GeneralUtility::trimExplode(',', $extensionConfiguration['constantsToHide']); // mod.tx_themes.constantCategoriesToShow.value $externalConstantCategoriesToShow = $GLOBALS['BE_USER']->getTSConfig('mod.tx_themes.constantCategoriesToShow', BackendUtility::getPagesTSconfig($this->id)); if ($externalConstantCategoriesToShow['value']) { $this->externalConfig['constantCategoriesToShow'] = GeneralUtility::trimExplode(',', $externalConstantCategoriesToShow['value']); ArrayUtility::mergeRecursiveWithOverrule($extensionConfiguration['categoriesToShow'], $this->externalConfig['constantCategoriesToShow']); } else { $this->externalConfig['constantCategoriesToShow'] = array(); } // mod.tx_themes.constantsToHide.value $externalConstantsToHide = $GLOBALS['BE_USER']->getTSConfig('mod.tx_themes.constantsToHide', BackendUtility::getPagesTSconfig($this->id)); if ($externalConstantsToHide['value']) { $this->externalConfig['constantsToHide'] = GeneralUtility::trimExplode(',', $externalConstantsToHide['value']); ArrayUtility::mergeRecursiveWithOverrule($extensionConfiguration['constantsToHide'], $this->externalConfig['constantsToHide']); } else { $this->externalConfig['constantsToHide'] = array(); } $this->allowedCategories = $extensionConfiguration['categoriesToShow']; $this->deniedFields = $extensionConfiguration['constantsToHide']; // initialize normally used values }
/** * Download a file * * @param string $file Path to the file * @param array $configuration configuration used to render the filelink cObject * @param boolean $hideError define if an error should be displayed if file not found * @param string $class optional class * @param string $target target * @param string $alt alt text * @param string $title title text * @param integer $secure news uid * @return string * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException */ public function render($file, $configuration = array(), $hideError = FALSE, $class = '', $target = '', $alt = '', $title = '', $secure = 0) { if (!is_file($file)) { $errorMessage = sprintf('Given file "%s" for %s is not valid', htmlspecialchars($file), get_class()); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($errorMessage, 'moox_news', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING); if (!$hideError) { throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException('Given file is not a valid file: ' . htmlspecialchars($file)); } } $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_cObj'); $fileInformation = pathinfo($file); $fileInformation['file'] = $file; $fileInformation['size'] = filesize($file); $cObj->data = $fileInformation; // set a basic configuration for cObj->filelink $tsConfiguration = array('path' => $fileInformation['dirname'] . '/', 'ATagParams' => 'class="download-link basic-class ' . strtolower($fileInformation['extension']) . (!empty($class) ? ' ' . $class : '') . '"', 'labelStdWrap.' => array('cObject.' => array('value' => $this->renderChildren()))); // Fallback if no configuration given if (!is_array($configuration)) { $configuration = array('labelStdWrap.' => array('cObject' => 'TEXT')); } else { /** @var $typoscriptService \TYPO3\CMS\Extbase\Service\TypoScriptService */ $typoscriptService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService'); $configuration = $typoscriptService->convertPlainArrayToTypoScriptArray($configuration); } // merge default configuration with optional configuration \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($tsConfiguration, $configuration); if (!empty($target)) { $tsConfiguration['target'] = $target; } if (!empty($alt)) { $tsConfiguration['altText'] = $alt; } if (!empty($title)) { $tsConfiguration['titleText'] = $title; } $link = $cObj->filelink($fileInformation['basename'], $tsConfiguration); $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['moox_news']); $securityExcludedFileTypes = array(); if ($extConf['securityExcludedFileTypes'] != "") { $securityExcludedFileTypes = explode(",", $extConf['securityExcludedFileTypes']); } $securityFileLocators = array(); if ($extConf['securityFileLocators'] != "") { $securityFileLocators = explode(",", $extConf['securityFileLocators']); } if ($extConf['securityUrlIndicator'] != "") { $securityUrlIndicator = $extConf['securityUrlIndicator']; } else { $securityUrlIndicator = "mxsecured"; } if ($secure > 0 && !in_array($fileInformation['extension'], $securityExcludedFileTypes)) { foreach ($securityFileLocators as $securityFileLocator) { $dividerPos = strpos($link, $securityFileLocator); if ($dividerPos !== FALSE) { $link = str_replace($securityFileLocator, $securityFileLocator . $securityUrlIndicator . '/' . base_convert($secure + 999999, 10, 21) . '/' . $GLOBALS["TSFE"]->id . '/', $link); } } } return $link; }
/** * Renders the application defined cObject FORM * which overrides the TYPO3 default cObject FORM * * Convert FORM to COA_INT - COA_INT.10 = FORM_INT * If FORM_INT is also dedected by the ContentObjectRenderer, and now * the Extbaseplugin "Form" is initalized. At this time the * controller "Frontend" action "execute" do the rest. * * @param string $typoScriptObjectName Name of the object * @param array $typoScript TS configuration for this cObject * @param string $typoScriptKey A string label used for the internal debugging tracking. * @param ContentObjectRenderer $contentObject reference * @return string HTML output */ public function cObjGetSingleExt($typoScriptObjectName, array $typoScript, $typoScriptKey, ContentObjectRenderer $contentObject) { $content = ''; if ($typoScriptObjectName === 'FORM' && !empty($typoScript['useDefaultContentObject']) && ExtensionManagementUtility::isLoaded('compatibility6')) { $content = $contentObject->getContentObject($typoScriptObjectName)->render($typoScript); } elseif ($typoScriptObjectName === 'FORM') { $mergedTypoScript = null; if ($contentObject->data['CType'] === 'mailform') { $bodytext = $contentObject->data['bodytext']; /** @var $typoScriptParser TypoScriptParser */ $typoScriptParser = GeneralUtility::makeInstance(TypoScriptParser::class); $typoScriptParser->parse($bodytext); $mergedTypoScript = (array) $typoScriptParser->setup; ArrayUtility::mergeRecursiveWithOverrule($mergedTypoScript, $typoScript); // Disables content elements since TypoScript is handled that could contain insecure settings: $mergedTypoScript[Configuration::DISABLE_CONTENT_ELEMENT_RENDERING] = true; } $newTypoScript = array('10' => 'FORM_INT', '10.' => is_array($mergedTypoScript) ? $mergedTypoScript : $typoScript); $content = $contentObject->cObjGetSingle('COA_INT', $newTypoScript); // Only apply stdWrap to TypoScript that was NOT created by the wizard: if (isset($typoScript['stdWrap.'])) { $content = $contentObject->stdWrap($content, $typoScript['stdWrap.']); } } elseif ($typoScriptObjectName === 'FORM_INT') { $extbase = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class); $content = $extbase->run('', array('pluginName' => 'Form', 'extensionName' => 'Form', 'vendorName' => 'TYPO3\\CMS', 'controller' => 'Frontend', 'action' => 'show', 'settings' => array('typoscript' => $typoScript), 'persistence' => array(), 'view' => array())); } return $content; }
/** * @return mixed */ public function render() { // Get page via pageUid argument or current id $pageUid = intval($this->arguments['pageUid']); if (0 === $pageUid) { $pageUid = $GLOBALS['TSFE']->id; } $page = $this->pageSelect->getPage($pageUid); // Add the page overlay $languageUid = intval($GLOBALS['TSFE']->sys_language_uid); if (0 !== $languageUid) { $pageOverlay = $this->pageSelect->getPageOverlay($pageUid, $languageUid); if (TRUE === is_array($pageOverlay)) { if (TRUE === method_exists('TYPO3\\CMS\\Core\\Utility\\ArrayUtility', 'mergeRecursiveWithOverrule')) { ArrayUtility::mergeRecursiveWithOverrule($page, $pageOverlay, FALSE, FALSE); } else { $page = GeneralUtility::array_merge_recursive_overrule($page, $pageOverlay, FALSE, FALSE); } } } $content = NULL; // Check if field should be returned or assigned $field = $this->arguments['field']; if (TRUE === empty($field)) { $content = $page; } elseif (TRUE === isset($page[$field])) { $content = $page[$field]; } return $this->renderChildrenWithVariableOrReturnInput($content); }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { $this->id = intval(GeneralUtility::_GET('id')); $this->tsParser = new TsParserUtility(); // extension configuration /** @var \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility $configurationUtility */ $configurationUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility'); $extensionConfiguration = $configurationUtility->getCurrentConfiguration('themes'); #$extensionConfiguration['categoriesToShow'] = GeneralUtility::trimExplode(',', $extensionConfiguration['categoriesToShow']); #$extensionConfiguration['constantsToHide'] = GeneralUtility::trimExplode(',', $extensionConfiguration['constantsToHide']); // mod.tx_themes.constantCategoriesToShow.value $externalConstantCategoriesToShow = $this->getBackendUser()->getTSConfig('mod.tx_themes.constantCategoriesToShow', BackendUtility::getPagesTSconfig($this->id)); if ($externalConstantCategoriesToShow['value']) { $this->externalConfig['constantCategoriesToShow'] = GeneralUtility::trimExplode(',', $externalConstantCategoriesToShow['value']); $categoriesToShow = GeneralUtility::trimExplode(',', $extensionConfiguration['categoriesToShow']['value']); ArrayUtility::mergeRecursiveWithOverrule($categoriesToShow, $this->externalConfig['constantCategoriesToShow']); } else { $this->externalConfig['constantCategoriesToShow'] = array(); } // mod.tx_themes.constantsToHide.value $externalConstantsToHide = $this->getBackendUser()->getTSConfig('mod.tx_themes.constantsToHide', BackendUtility::getPagesTSconfig($this->id)); if ($externalConstantsToHide['value']) { $this->externalConfig['constantsToHide'] = GeneralUtility::trimExplode(',', $externalConstantsToHide['value']); ArrayUtility::mergeRecursiveWithOverrule($extensionConfiguration['constantsToHide'], $this->externalConfig['constantsToHide']); } else { $this->externalConfig['constantsToHide'] = array(); } $this->allowedCategories = $categoriesToShow; $this->deniedFields = $extensionConfiguration['constantsToHide']; // initialize normally used values }
/** * Add an own language object with needed labels * * @param array $resultArray * @return array */ protected function createJavaScriptLanguageLabels(array $resultArray) { /** @var $languageFactory LocalizationFactory */ $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class); $language = $GLOBALS['LANG']->lang; $localizationArray = $languageFactory->getParsedData('EXT:document_node_type/Resources/Private/Language/locallang_form.xlf', $language, 'utf-8', 1); if (is_array($localizationArray) && !empty($localizationArray)) { if (!empty($localizationArray[$language])) { $xlfLabelArray = $localizationArray['default']; ArrayUtility::mergeRecursiveWithOverrule($xlfLabelArray, $localizationArray[$language], true, false); } else { $xlfLabelArray = $localizationArray['default']; } } else { $xlfLabelArray = []; } $labelArray = []; foreach ($xlfLabelArray as $key => $value) { if (isset($value[0]['target'])) { $labelArray[$key] = $value[0]['target']; } else { $labelArray[$key] = ''; } } $javaScriptString = 'var BootstrapSwitchElement = BootstrapSwitchElement || {};' . LF; $javaScriptString .= 'BootstrapSwitchElement.lang = ' . json_encode($labelArray) . LF; $resultArray['additionalJavaScriptPost'][] = $javaScriptString; return $resultArray; }
/** * @return void */ public function initializeAction() { $this->objects = $this->widgetConfiguration['objects']; \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->configuration, $this->widgetConfiguration['configuration'], FALSE); $this->numberOfObjects = count($this->objects); $this->numberOfPages = ceil($this->numberOfObjects / (int) $this->configuration['itemsPerPage']); }
/** * Perform necessary database schema migrations * * @param SchemaUpdateType[] $schemaUpdateTypes List of permitted schema update types * @return SchemaUpdateResult Result of the schema update */ public function updateSchema(array $schemaUpdateTypes) { $expectedSchema = $this->expectedSchemaService->getExpectedDatabaseSchema(); $currentSchema = $this->schemaMigrationService->getFieldDefinitions_database(); $addCreateChange = $this->schemaMigrationService->getDatabaseExtra($expectedSchema, $currentSchema); $dropRename = $this->schemaMigrationService->getDatabaseExtra($currentSchema, $expectedSchema); $updateStatements = array(); ArrayUtility::mergeRecursiveWithOverrule($updateStatements, $this->schemaMigrationService->getUpdateSuggestions($addCreateChange)); ArrayUtility::mergeRecursiveWithOverrule($updateStatements, $this->schemaMigrationService->getUpdateSuggestions($dropRename, 'remove')); $updateResult = new SchemaUpdateResult(); foreach ($schemaUpdateTypes as $schemaUpdateType) { $statementTypes = $this->getStatementTypes($schemaUpdateType); foreach ($statementTypes as $statementType) { if (isset($updateStatements[$statementType])) { $statements = $updateStatements[$statementType]; $result = $this->schemaMigrationService->performUpdateQueries($statements, array_combine(array_keys($statements), array_fill(0, count($statements), TRUE))); if ($result === TRUE) { $updateResult->addPerformedUpdates($schemaUpdateType, count($statements)); } elseif (is_array($result)) { $updateResult->addErrors($schemaUpdateType, $result); } } } } return $updateResult; }
/** * Set the options for this object * * @param array $parameters Configuration array * @return void */ protected function setOptions(array $parameters) { if (is_array($parameters)) { $keys = ArrayUtility::filterAndSortByNumericKeys($parameters); foreach ($keys as $key) { $class = $parameters[$key]; if ((int) $key && strpos($key, '.') === false) { if (isset($parameters[$key . '.']) && $class === 'CHECKBOX') { $childElementArguments = $parameters[$key . '.']; if (isset($childElementArguments['checked'])) { $childElementArguments['attributes']['selected'] = 'selected'; unset($childElementArguments['checked']); } if (isset($childElementArguments['value'])) { $childElementArguments['attributes']['value'] = $childElementArguments['value']; unset($childElementArguments['value']); } if (isset($childElementArguments['label.'])) { $childElementArguments['text'] = $childElementArguments['label.']['value']; unset($childElementArguments['label.']); } $this->configuration['options'][] = $childElementArguments; } } } } }
/** * The main method called by the controller * * Iterates over the configured post processors and calls them with their * own settings * * @return string HTML messages from the called processors */ public function process() { $html = ''; if (is_array($this->postProcessorTypoScript)) { $keys = ArrayUtility::filterAndSortByNumericKeys($this->postProcessorTypoScript); foreach ($keys as $key) { if (!(int) $key || strpos($key, '.') !== false) { continue; } $className = false; $processorName = $this->postProcessorTypoScript[$key]; $processorArguments = array(); if (isset($this->postProcessorTypoScript[$key . '.'])) { $processorArguments = $this->postProcessorTypoScript[$key . '.']; } if (class_exists($processorName, true)) { $className = $processorName; } else { $classNameExpanded = 'TYPO3\\CMS\\Form\\PostProcess\\' . ucfirst(strtolower($processorName)) . 'PostProcessor'; if (class_exists($classNameExpanded, true)) { $className = $classNameExpanded; } } if ($className !== false) { $processor = $this->objectManager->get($className, $this->form, $processorArguments); if ($processor instanceof PostProcessorInterface) { $processor->setControllerContext($this->controllerContext); $html .= $processor->process(); } } } } return $html; }
/** * Inline parent TCA may override some TCA of children. * * @param array $result * @return array */ public function addData(array $result) { // Replace types definition of inline child if foreign_types is defined in inlineParentConfig if (isset($result['inlineParentConfig']['foreign_types'])) { foreach ($result['inlineParentConfig']['foreign_types'] as $type => $config) { $result['processedTca']['types'][$type] = $config; } } // Override config section of foreign_selector field pointer if given if (isset($result['inlineParentConfig']['foreign_selector']) && is_string($result['inlineParentConfig']['foreign_selector']) && isset($result['inlineParentConfig']['foreign_selector_fieldTcaOverride']) && is_array($result['inlineParentConfig']['foreign_selector_fieldTcaOverride']) && isset($result['processedTca']['columns'][$result['inlineParentConfig']['foreign_selector']]) && is_array($result['processedTca']['columns'][$result['inlineParentConfig']['foreign_selector']])) { ArrayUtility::mergeRecursiveWithOverrule($result['processedTca']['columns'][$result['inlineParentConfig']['foreign_selector']], $result['inlineParentConfig']['foreign_selector_fieldTcaOverride']); } // Set default values for (new) child if foreign_record_defaults is defined in inlineParentConfig if (isset($result['inlineParentConfig']['foreign_record_defaults']) && is_array($result['inlineParentConfig']['foreign_record_defaults'])) { $foreignTableConfig = $GLOBALS['TCA'][$result['inlineParentConfig']['foreign_table']]; // The following system relevant fields can't be set by foreign_record_defaults $notSetableFields = ['uid', 'pid', 't3ver_oid', 't3ver_id', 't3ver_label', 't3ver_wsid', 't3ver_state', 't3ver_stage', 't3ver_count', 't3ver_tstamp', 't3ver_move_id']; // Optional configuration fields used in child table. If set, they must not be overridden, either $configurationKeysForNotSettableFields = ['crdate', 'cruser_id', 'delete', 'origUid', 'transOrigDiffSourceField', 'transOrigPointerField', 'tstamp']; foreach ($configurationKeysForNotSettableFields as $configurationKey) { if (isset($foreignTableConfig['ctrl'][$configurationKey])) { $notSetableFields[] = $foreignTableConfig['ctrl'][$configurationKey]; } } foreach ($result['inlineParentConfig']['foreign_record_defaults'] as $fieldName => $defaultValue) { if (isset($foreignTableConfig['columns'][$fieldName]) && !in_array($fieldName, $notSetableFields, true)) { $result['processedTca']['columns'][$fieldName]['config']['default'] = $defaultValue; } } } return $result; }
/** * Generates a frameset based on input configuration in a TypoScript array. * * @param array $setup The TypoScript properties of the PAGE object property "frameSet.". See link. * @return string A <frameset> tag. * @see \TYPO3\CMS\Frontend\Page\PageGenerator::renderContentWithHeader() */ public function make($setup) { $content = ''; if (is_array($setup)) { $sKeyArray = ArrayUtility::filterAndSortByNumericKeys($setup); foreach ($sKeyArray as $theKey) { $theValue = $setup[$theKey]; if ((int) $theKey && ($conf = $setup[$theKey . '.'])) { switch ($theValue) { case 'FRAME': $typeNum = (int) $GLOBALS['TSFE']->tmpl->setup[$conf['obj'] . '.']['typeNum']; if (!$conf['src'] && !$typeNum) { $typeNum = -1; } $content .= '<frame' . $this->frameParams($conf, $typeNum) . ' />' . LF; break; case 'FRAMESET': $frameset = GeneralUtility::makeInstance(__CLASS__); $content .= $frameset->make($conf) . LF; break; } } } return '<frameset' . $this->framesetParams($setup) . '>' . LF . $content . '</frameset>'; } return ''; }
/** * @return void */ public function initializeAction() { $this->objects = $this->widgetConfiguration['objects']; ArrayUtility::mergeRecursiveWithOverrule($this->configuration, $this->widgetConfiguration['configuration'], FALSE); $this->numberOfPages = ceil(count($this->objects) / (int) $this->configuration['itemsPerPage']); $this->maximumNumberOfLinks = (int) $this->configuration['maximumNumberOfLinks']; }
/** * Merge type specific page TS to pageTsConfig * * @param array $result * @return array */ public function addData(array $result) { $mergedTsConfig = $result['pageTsConfig']; if (empty($result['pageTsConfig']['TCEFORM.']) || !is_array($result['pageTsConfig']['TCEFORM.'])) { $result['pageTsConfig'] = $mergedTsConfig; return $result; } $mergedTsConfig = $result['pageTsConfig']; $type = $result['recordTypeValue']; $table = $result['tableName']; // Merge TCEFORM.[table name].[field].types.[type] over TCEFORM.[table name].[field] if (!empty($result['pageTsConfig']['TCEFORM.'][$table . '.']) && is_array($result['pageTsConfig']['TCEFORM.'][$table . '.'])) { foreach ($result['pageTsConfig']['TCEFORM.'][$table . '.'] as $fieldNameWithDot => $fullFieldConfiguration) { $newFieldConfiguration = $fullFieldConfiguration; if (!empty($fullFieldConfiguration['types.']) && is_array($fullFieldConfiguration['types.'])) { $typeSpecificConfiguration = $newFieldConfiguration['types.']; unset($newFieldConfiguration['types.']); if (!empty($typeSpecificConfiguration[$type . '.']) && is_array($typeSpecificConfiguration[$type . '.'])) { ArrayUtility::mergeRecursiveWithOverrule($newFieldConfiguration, $typeSpecificConfiguration[$type . '.']); } } $mergedTsConfig['TCEFORM.'][$table . '.'][$fieldNameWithDot] = $newFieldConfiguration; } } $result['pageTsConfig'] = $mergedTsConfig; return $result; }
/** * Initializes the languages. * * @return void */ public static function initialize() { /** @var $instance Locales */ $instance = GeneralUtility::makeInstance(Locales::class); $instance->isoMapping = array_flip($instance->isoReverseMapping); // Allow user-defined locales if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user'] as $locale => $name) { if (!isset($instance->languages[$locale])) { $instance->languages[$locale] = $name; } } } // Initializes the locale dependencies with TYPO3 supported locales $instance->localeDependencies = array(); foreach ($instance->languages as $locale => $name) { if (strlen($locale) === 5) { $instance->localeDependencies[$locale] = array(substr($locale, 0, 2)); } } // Merge user-provided locale dependencies if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['dependencies']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['dependencies'])) { ArrayUtility::mergeRecursiveWithOverrule($instance->localeDependencies, $GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['dependencies']); } }
/** * Construcor of this object */ public function __construct($pObj) { parent::__construct($pObj); $this->templavoilaIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('templavoila'); if ($this->templavoilaIsLoaded) { $enableFields = BackendUtility::BEenableFields('pages') . BackendUtility::deleteClause('pages'); $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid,title', 'pages', 'pid = 0' . $enableFields); $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\NullTimeTracker(); $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $row['uid'], 0); $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $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.'])) { \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($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; $cTypes = array(); foreach ($this->indexCTypes as $value) { $cTypes[] = 'CType="' . $value . '"'; } $this->whereClauseForCType = implode(' OR ', $cTypes); // get all available sys_language_uid records $this->sysLanguages = BackendUtility::getSystemLanguages(); }
/** * Render URL from typolink configuration * * @param string $parameter * @param array $configuration * @return string Rendered page URI */ public function render($parameter = null, $configuration = array()) { $typoLinkConfiguration = array('parameter' => $parameter ? $parameter : $this->contentObject->data['pid']); if (!empty($configuration)) { ArrayUtility::mergeRecursiveWithOverrule($typoLinkConfiguration, $configuration); } return $this->contentObject->typoLink_URL($typoLinkConfiguration); }
/** * Init action of the controller * * @return void */ public function initializeAction() { ArrayUtility::mergeRecursiveWithOverrule($this->configuration, (array) $this->settings['pagination'], TRUE); $this->field = FALSE === empty($this->widgetConfiguration['field']) ? $this->widgetConfiguration['field'] : 'name'; $this->objects = $this->widgetConfiguration['objects']; $this->query = $this->objects->getQuery(); $this->characters = explode(',', $this->configuration['characters']); }
/** * @param FileReference $fileReference * @return array */ public function getResource($fileReference) { $file = $fileReference->getOriginalFile(); $fileReferenceProperties = $fileReference->getProperties(); $fileProperties = ResourceUtility::getFileArray($file); ArrayUtility::mergeRecursiveWithOverrule($fileProperties, $fileReferenceProperties, true, false, false); return $fileProperties; }
/** * Initializes the view helper before invoking the render method. * * Override this method to solve tasks before the view helper content is rendered. * * @return void * @api */ public function initialize() { $this->_extendedSettings = \Tollwerk\TwAntibot\Utility\Utility::settings(); $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer(); $settings = $templateVariableContainer->get('settings'); if (is_array($settings) && !empty($settings['antibot']) && is_array($settings['antibot'])) { \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->_extendedSettings, $settings['antibot']); } }
/** * Rendering the cObject, QTOBJECT * * @param array $conf Array of TypoScript properties * @return string Output */ public function render($conf = array()) { $params = $prefix = ''; if ($GLOBALS['TSFE']->baseUrl) { $prefix = $GLOBALS['TSFE']->baseUrl; } if ($GLOBALS['TSFE']->absRefPrefix) { $prefix = $GLOBALS['TSFE']->absRefPrefix; } $type = isset($conf['type.']) ? $this->cObj->stdWrap($conf['type'], $conf['type.']) : $conf['type']; // If file is audio and an explicit path has not been set, // take path from audio fallback property if ($type == 'audio' && empty($conf['file'])) { $conf['file'] = $conf['audioFallback']; } $filename = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file']; $typeConf = $conf[$type . '.']; // Add QTobject js-file $GLOBALS['TSFE']->getPageRenderer()->addJsFile($this->getPathToLibrary('flashmedia/qtobject/qtobject.js')); $replaceElementIdString = str_replace('.', '', uniqid('mmqt', TRUE)); $GLOBALS['TSFE']->register['MMQTID'] = $replaceElementIdString; $qtObject = 'QTObject' . $replaceElementIdString; // Merge with default parameters $conf['params.'] = array_merge((array) $typeConf['default.']['params.'], (array) $conf['params.']); if (is_array($conf['params.']) && is_array($typeConf['mapping.']['params.'])) { ArrayUtility::remapArrayKeys($conf['params.'], $typeConf['mapping.']['params.']); foreach ($conf['params.'] as $key => $value) { $params .= $qtObject . '.addParam("' . $key . '", "' . $value . '");' . LF; } } $params = ($params ? substr($params, 0, -2) : '') . LF . $qtObject . '.write("' . $replaceElementIdString . '");'; $alternativeContent = isset($conf['alternativeContent.']) ? $this->cObj->stdWrap($conf['alternativeContent'], $conf['alternativeContent.']) : $conf['alternativeContent']; $layout = str_replace(array('###ID###', '###QTOBJECT###'), array($replaceElementIdString, '<div id="' . $replaceElementIdString . '">' . $alternativeContent . '</div>'), isset($conf['layout.']) ? $this->cObj->stdWrap($conf['layout'], $conf['layout.']) : $conf['layout']); $width = isset($conf['width.']) ? $this->cObj->stdWrap($conf['width'], $conf['width.']) : $conf['width']; if (!$width) { $width = $conf[$type . '.']['defaultWidth']; } $height = isset($conf['height.']) ? $this->cObj->stdWrap($conf['height'], $conf['height.']) : $conf['height']; if (!$height) { $height = $conf[$type . '.']['defaultHeight']; } $fullFilename = $filename; // If the file name doesn't contain a scheme, prefix with appropriate data if (strpos($filename, '://') === FALSE && !empty($prefix)) { $fullFilename = $prefix . $filename; } $embed = 'var ' . $qtObject . ' = new QTObject("' . $fullFilename . '", "' . $replaceElementIdString . '", "' . $width . '", "' . $height . '");'; $content = $layout . ' <script type="text/javascript"> ' . $embed . ' ' . $params . ' </script>'; if (isset($conf['stdWrap.'])) { $content = $this->cObj->stdWrap($content, $conf['stdWrap.']); } return $content; }
/** * @param mixed $identity * @return mixed */ public function getResource($identity) { $fileReference = $this->resourceFactory->getFileReferenceObject(intval($identity)); $file = $fileReference->getOriginalFile(); $fileReferenceProperties = $fileReference->getProperties(); $fileProperties = ResourceUtility::getFileArray($file); ArrayUtility::mergeRecursiveWithOverrule($fileProperties, $fileReferenceProperties, TRUE, FALSE, FALSE); return $fileProperties; }
/** * @param $array1 * @param $array2 * @return array */ protected function mergeArrays($array1, $array2) { if (6.2 <= (double) substr(TYPO3_version, 0, 3)) { ArrayUtility::mergeRecursiveWithOverrule($array1, $array2); return $array1; } else { return GeneralUtility::array_merge_recursive_overrule($array1, $array2); } }
/** * Merge columnsOverrides * * @param array $result * @return array */ public function addData(array $result) { $type = $result['recordTypeValue']; if (isset($result['processedTca']['types'][$type]['columnsOverrides']) && is_array($result['processedTca']['types'][$type]['columnsOverrides'])) { ArrayUtility::mergeRecursiveWithOverrule($result['processedTca']['columns'], $result['processedTca']['types'][$type]['columnsOverrides']); unset($result['processedTca']['types'][$type]['columnsOverrides']); } return $result; }
/** * Implements array_merge_recursive_overrule() in a cross-version way * This code is a copy from realurl, written by Dmitry Dulepov <*****@*****.**>. * * @access public * * @param array $array1: First array * @param array $array2: Second array * * @return array Merged array with second array overruling first one */ public static function array_merge_recursive_overrule($array1, $array2) { if (class_exists('\\TYPO3\\CMS\\Core\\Utility\\ArrayUtility')) { \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($array1, $array2); } else { $array1 = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($array1, $array2); } return $array1; }
/** * Initialize the action and get correct configuration * * @return void */ public function initializeAction() { $this->objects = $this->widgetConfiguration['objects']; \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->configuration, (array) $this->widgetConfiguration['configuration'], true); $this->numberOfPages = ceil(count($this->objects) / (int) $this->configuration['itemsPerPage']); $this->pagesBefore = (int) $this->configuration['pagesBefore']; $this->pagesAfter = (int) $this->configuration['pagesAfter']; $this->lessPages = (bool) $this->configuration['lessPages']; $this->forcedNumberOfLinks = (int) $this->configuration['forcedNumberOfLinks']; }
/** * Configures the pages.abstract RTE * * @param array $configuration Extension configuration * * @return void */ public static function configure(array $configuration) { try { self::$configuration = ArrayUtility::getValueByPath($configuration, 'pages./abstract./rte.'); self::disableGlobally(); self::setVisibleButtons(); self::setHiddenButtons(); } catch (\Exception $e) { } }
/** * Constructor */ public function __construct() { $urlParameters = $_GET; \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($urlParameters, $_POST); $this->currentPage = max(1, intval($urlParameters['page'])); unset($urlParameters['page']); unset($urlParameters['cmd']); $this->baseURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT') . '?' . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $urlParameters); $this->resultsPerPage = self::RESULTS_PER_PAGE_DEFAULT; }
/** * @return void */ public function initializeAction() { $this->objects = $this->widgetConfiguration['objects']; \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->configuration, $this->widgetConfiguration['configuration'], TRUE); $itemsPerPage = (int) $this->configuration['itemsPerPage']; if ($itemsPerPage === 0) { throw new RuntimeException('The itemsPerPage is 0 which is not allowed. Please also add "list.paginate.itemsPerPage" to the TS setting settings.overrideFlexformSettingsIfEmpty!', 1400741142); } $this->numberOfPages = ceil(count($this->objects) / (int) $this->configuration['itemsPerPage']); $this->maximumNumberOfLinks = (int) $this->configuration['maximumNumberOfLinks']; }
function insertViewVariables(&$view, $setting) { $data = array('categories' => array('2' => 'Für Kinder', '3' => 'Für Erwachsene')); if (get_class($view) == 'TYPO3\\CMS\\Fluid\\View\\TemplateView') { $view->assignMultiple($data); } else { $tmp = array_merge($view); \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($tmp, $data); $view = $tmp; } }