Beispiel #1
0
 /**
  * @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);
 }
Beispiel #2
0
 /**
  * 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;
 }
 /**
  * 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 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']);
 }
Beispiel #6
0
 /**
  * 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']);
     }
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * @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'];
 }
Beispiel #11
0
 /**
  * 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;
 }
 /**
  * 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);
 }
Beispiel #15
0
 /**
  * @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;
 }
 /**
  * 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']);
 }
 /**
  * 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']);
     }
 }
Beispiel #18
0
 /**
  * @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);
     }
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * Get current configuration of an extension. Will return the configuration as a valued object
  *
  * @param string $extensionKey
  * @return array
  */
 public function getCurrentConfiguration($extensionKey)
 {
     $mergedConfiguration = $this->getDefaultConfigurationFromExtConfTemplateAsValuedArray($extensionKey);
     $currentExtensionConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]);
     $currentExtensionConfig = is_array($currentExtensionConfig) ? $currentExtensionConfig : array();
     $currentExtensionConfig = $this->convertNestedToValuedConfiguration($currentExtensionConfig);
     \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($mergedConfiguration, $currentExtensionConfig);
     return $mergedConfiguration;
 }
Beispiel #23
0
 /**
  * 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'];
 }
Beispiel #24
0
 /**
  * Get current configuration of an extension. Will return the configuration as a valued object
  *
  * @param string $extensionKey
  * @return array
  */
 public function getCurrentConfiguration($extensionKey)
 {
     $mergedConfiguration = $this->getDefaultConfigurationFromExtConfTemplateAsValuedArray($extensionKey);
     // No objects allowed in extConf at all - it is safe to deny that during unserialize()
     $currentExtensionConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey], ['allowed_classes' => false]);
     $currentExtensionConfig = is_array($currentExtensionConfig) ? $currentExtensionConfig : [];
     $currentExtensionConfig = $this->convertNestedToValuedConfiguration($currentExtensionConfig);
     \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($mergedConfiguration, $currentExtensionConfig);
     return $mergedConfiguration;
 }
 /**
  * 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;
     }
 }
 /**
  * Implements array_merge_recursive_overrule() in a cross-version way.
  *
  * This code is a copy from realurl, written by Dmitry Dulepov <*****@*****.**>.
  *
  * @param array $array1
  * @param array $array2
  * @return array
  */
 public static function array_merge_recursive_overrule($array1, $array2)
 {
     if (class_exists('\\TYPO3\\CMS\\Core\\Utility\\ArrayUtility')) {
         /** @noinspection PhpUndefinedClassInspection PhpUndefinedNamespaceInspection */
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($array1, $array2);
     } else {
         /** @noinspection PhpDeprecationInspection */
         $array1 = t3lib_div::array_merge_recursive_overrule($array1, $array2);
     }
     return $array1;
 }
 /**
  * Initialize cache instance to be ready to use
  *
  * @return void
  */
 protected function initializeCache()
 {
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $cacheManager = $objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager');
     if (!$cacheManager->hasCache($this->extensionKey)) {
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$this->extensionKey])) {
             ArrayUtility::mergeRecursiveWithOverrule($this->cacheConfiguration[$this->extensionKey], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$this->extensionKey]);
         }
         $cacheManager->setCacheConfigurations($this->cacheConfiguration);
     }
     $this->cacheInstance = $cacheManager->getCache($this->extensionKey);
 }
 /**
  * Returns a singleton instance of this class
  * @param array $settings The current settings for this extension.
  * @param array $overwriteSettings Overwrite the default settings
  * @return Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder   Singleton instance of this class
  */
 public static function getInstance($settings = null, $overwriteSettings = null)
 {
     if (is_array($settings) && count($settings)) {
         $configurationBuilderMock = new Tx_PtExtlist_Tests_Domain_Configuration_ConfigurationBuilderMock($settings);
     } else {
         $settings = array('listIdentifier' => 'test', 'abc' => '1', 'prototype' => array('backend' => array('mysql' => array('dataBackendClass' => 'Tx_PtExtlist_Domain_DataBackend_MySqlDataBackend_MySqlDataBackend', 'dataMapperClass' => 'Tx_PtExtlist_Domain_DataBackend_Mapper_ArrayMapper', 'dataSourceClass' => 'Tx_PtExtlist_Domain_DataBackend_DataSource_MySqlDataSource', 'queryInterpreterClass' => 'Tx_PtExtlist_Domain_DataBackend_MySqlDataBackend_MySqlInterpreter_MySqlInterpreter')), 'column' => array('xy' => 'z')), 'listConfig' => array('test' => array('default' => array('sortingColumn' => 'column3'), 'headerPartial' => 'List/ListHeader', 'bodyPartial' => 'List/ListBody', 'aggregateRowsPartial' => 'List/AggregateRows', 'useIterationListData' => 1, 'backendConfig' => array('dataBackendClass' => 'Tx_PtExtlist_Domain_DataBackend_Typo3DataBackend_Typo3DataBackend', 'dataMapperClass' => 'Tx_PtExtlist_Domain_DataBackend_Mapper_ArrayMapper', 'dataSourceClass' => 'Tx_PtExtlist_Domain_DataBackend_DataSource_Typo3DataSource', 'queryInterpreterClass' => 'Tx_PtExtlist_Domain_DataBackend_MySqlDataBackend_MySqlInterpreter_MySqlInterpreter', 'dataSource' => array('testKey' => 'testValue', 'username' => 'user', 'password' => 'pass', 'host' => 'localhost', 'port' => 3306, 'databaseName' => 'typo3'), 'baseFromClause' => 'companies', 'baseGroupByClause' => 'company', 'baseWhereClause' => 'employees > 0'), 'abc' => '2', 'def' => '3', 'controller' => array('Export' => array('download' => array('view' => 'export.exportConfigs.test'))), 'fields' => array('field1' => array('table' => 'tableName1', 'field' => 'fieldName1', 'isSortable' => '0', 'access' => '1,2,3,4'), 'field2' => array('table' => 'tableName2', 'field' => 'fieldName2', 'isSortable' => '1', 'access' => '1,2,3,4'), 'field3' => array('special' => 'special', 'isSortable' => '1', 'access' => '1,2,3,4'), 'field4' => array('table' => 'tableName4', 'field' => 'fieldName4')), 'columns' => array(10 => array('columnIdentifier' => 'column1', 'fieldIdentifier' => 'field1', 'label' => 'Column 1', 'isSortable' => '0', 'excelExport' => array('wrap' => 0, 'vertical' => 'top')), 20 => array('columnIdentifier' => 'column2', 'fieldIdentifier' => 'field2', 'label' => 'Column 2', 'isSortable' => '1', 'isVisible' => '0', 'sorting' => 'field1, field2', 'showInHeader' => 0), 30 => array('columnIdentifier' => 'column3', 'fieldIdentifier' => 'field3', 'label' => 'Column 3', 'isSortable' => '1', 'sorting' => 'field1 asc, field2 !DeSc', 'accessGroups' => '1,2,3,4', 'cellCSSClass' => 'class'), 40 => array('columnIdentifier' => 'column4', 'fieldIdentifier' => 'field4', 'label' => 'Column 4'), 50 => array('columnIdentifier' => 'column5', 'fieldIdentifier' => 'field4', 'label' => 'Column 5', 'sortingFields' => array(10 => array('field' => 'field1', 'direction' => 'desc', 'forceDirection' => 1, 'label' => 'Sorting label 1'), 20 => array('field' => 'field2', 'direction' => 'asc', 'forceDirection' => 0, 'label' => 'Sorting label 2'), 30 => array('field' => 'field3', 'direction' => 'desc', 'forceDirection' => 0, 'label' => 'Sorting label 3'))), 60 => array('columnIdentifier' => 'column6', 'fieldIdentifier' => 'field4', 'label' => 'Column 6', 'objectMapper' => array('class' => 'Tx_PtExtlist_Domain_Model_Bookmark_Bookmark', 'mapping' => array('label' => 'name')))), 'rendererChain' => array('enabled' => 1, 'rendererConfigs' => array(100 => array('rendererClassName' => 'Tx_PtExtlist_Tests_Domain_Renderer_DummyRenderer'))), 'filters' => array('testfilterbox' => array('filterConfigs' => array('10' => array('filterIdentifier' => 'filter1', 'filterClassName' => 'Tx_PtExtlist_Domain_Model_Filter_StringFilter', 'fieldIdentifier' => 'field1', 'partialPath' => 'Filter/StringFilter', 'defaultValue' => 'default'), '20' => array('filterIdentifier' => 'filter2', 'filterClassName' => 'Tx_PtExtlist_Domain_Model_Filter_StringFilter', 'fieldIdentifier' => 'field1', 'partialPath' => 'Filter/StringFilter', 'accessGroups' => '1,2,3')))), 'pager' => array('itemsPerPage' => '10', 'pagerConfigs' => array('default' => array('templatePath' => 'EXT:pt_extlist/', 'pagerClassName' => 'Tx_PtExtlist_Domain_Model_Pager_DefaultPager', 'enabled' => '1'))), 'aggregateData' => array('sumField1' => array('fieldIdentifier' => 'field1', 'method' => 'sum', 'scope' => 'page'), 'avgField2' => array('fieldIdentifier' => 'field2', 'method' => 'avg')), 'aggregateRows' => array(10 => array('column2' => array('aggregateDataIdentifier' => 'sumField1'))), 'export' => array('exportConfigs' => array('test' => array('downloadType' => 'D', 'fileName' => 'testfile', 'fileExtension' => 'ext', 'addDateToFilename' => 1, 'pager' => array('enabled' => 0), 'viewClassName' => 'Tx_PtExtlist_View_Export_CsvListView'))))));
         if (is_array($overwriteSettings)) {
             \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($settings, $overwriteSettings);
         }
         $configurationBuilderMock = new Tx_PtExtlist_Tests_Domain_Configuration_ConfigurationBuilderMock($settings);
         $configurationBuilderMock->settings = $configurationBuilderMock->origSettings['listConfig'][$configurationBuilderMock->origSettings['listIdentifier']];
     }
     return $configurationBuilderMock;
 }