/**
  * Handler for unknown types.
  *
  * @return array As defined in initializeResultArray() of AbstractNode
  */
 public function render()
 {
     $resultArray = $this->initializeResultArray();
     $languageService = $this->getLanguageService();
     $row = $this->data['databaseRow'];
     $parameterArray = $this->data['parameterArray'];
     // If ratios are set do not add default options
     if (isset($parameterArray['fieldConf']['config']['ratios'])) {
         unset($this->defaultConfig['ratios']);
     }
     $config = ArrayUtility::arrayMergeRecursiveOverrule($this->defaultConfig, $parameterArray['fieldConf']['config']);
     // By default we allow all image extensions that can be handled by the GFX functionality
     if ($config['allowedExtensions'] === null) {
         $config['allowedExtensions'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'];
     }
     if ($config['readOnly']) {
         $options = array();
         $options['parameterArray'] = array('fieldConf' => array('config' => $config), 'itemFormElValue' => $parameterArray['itemFormElValue']);
         $options['renderType'] = 'none';
         return $this->nodeFactory->create($options)->render();
     }
     $file = $this->getFile($row, $config['file_field']);
     if (!$file) {
         return $resultArray;
     }
     $content = '';
     $preview = '';
     if (GeneralUtility::inList(mb_strtolower($config['allowedExtensions']), mb_strtolower($file->getExtension()))) {
         // Get preview
         $preview = $this->getPreview($file, $parameterArray['itemFormElValue']);
         // Check if ratio labels hold translation strings
         foreach ((array) $config['ratios'] as $ratio => $label) {
             $config['ratios'][$ratio] = $languageService->sL($label, true);
         }
         $formFieldId = StringUtility::getUniqueId('formengine-image-manipulation-');
         $wizardData = array('zoom' => $config['enableZoom'] ? '1' : '0', 'ratios' => json_encode($config['ratios']), 'file' => $file->getUid());
         $wizardData['token'] = GeneralUtility::hmac(implode('|', $wizardData), 'ImageManipulationWizard');
         $buttonAttributes = array('data-url' => BackendUtility::getAjaxUrl('wizard_image_manipulation', $wizardData), 'data-severity' => 'notice', 'data-image-name' => $file->getNameWithoutExtension(), 'data-image-uid' => $file->getUid(), 'data-file-field' => $config['file_field'], 'data-field' => $formFieldId);
         $button = '<button class="btn btn-default t3js-image-manipulation-trigger"';
         foreach ($buttonAttributes as $key => $value) {
             $button .= ' ' . $key . '="' . htmlspecialchars($value) . '"';
         }
         $button .= '><span class="t3-icon fa fa-crop"></span>';
         $button .= $languageService->sL('LLL:EXT:lang/locallang_wizards.xlf:imwizard.open-editor', true);
         $button .= '</button>';
         $inputField = '<input type="hidden" ' . 'id="' . $formFieldId . '" ' . 'name="' . $parameterArray['itemFormElName'] . '" ' . 'value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
         $content .= $inputField . $button;
         $content .= $this->getImageManipulationInfoTable($parameterArray['itemFormElValue']);
         $resultArray['requireJsModules'][] = array('TYPO3/CMS/Backend/ImageManipulation' => 'function(ImageManipulation){ImageManipulation.initializeTrigger()}');
     }
     $content .= '<p class="text-muted"><em>' . $languageService->sL('LLL:EXT:lang/locallang_wizards.xlf:imwizard.supported-types-message', true) . '<br />';
     $content .= mb_strtoupper(implode(', ', GeneralUtility::trimExplode(',', $config['allowedExtensions'])));
     $content .= '</em></p>';
     $item = '<div class="media">';
     $item .= $preview;
     $item .= '<div class="media-body">' . $content . '</div>';
     $item .= '</div>';
     $resultArray['html'] = $item;
     return $resultArray;
 }
 /**
  * Creates a new configuration object.
  *
  * @return MW_Config_Interface Configuration object
  */
 protected function getConfig()
 {
     $settings = (array) $this->settings;
     if (isset($this->settings['typo3']['tsconfig'])) {
         $tsconfig = Base::parseTS($this->settings['typo3']['tsconfig']);
         $settings = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($settings, $tsconfig);
     }
     return Base::getConfig($settings);
 }
Esempio n. 3
0
 /**
  * Merges setup and flexform settings.
  * @param  array  $settings [description]
  * @return void
  */
 public function mergeSettings(array $settings)
 {
     if (isset($settings['setup']) && is_array($settings['setup'])) {
         $this->array = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($this->array, $settings['setup'], FALSE, FALSE);
     }
     if (isset($settings['flexform']) && is_array($settings['flexform'])) {
         $this->array = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($this->array, $settings['flexform'], FALSE, FALSE);
     }
 }
Esempio n. 4
0
 /**
  * Constructs a new Repository
  *
  * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
  */
 public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
 {
     $this->cicbaseConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cicbase']);
     $overrides = Arr::safePath($GLOBALS, 'TYPO3_CONF_VARS.EXTCONF.cicbase.document.awsConfs');
     if ($overrides) {
         $this->cicbaseConfiguration = ArrayUtility::arrayMergeRecursiveOverrule($this->cicbaseConfiguration, $overrides, FALSE, FALSE);
     }
     parent::__construct($objectManager);
 }
 /**
  * action list
  *
  * @return void
  */
 public function listAction()
 {
     $galleriesArray = explode(',', $this->settings['galleries']);
     $allUsedTags = [];
     $galleries = $this->galleryRepository->findByArrayUid($galleriesArray);
     foreach ($galleries as $gallery) {
         $allUsedTags = ArrayUtility::arrayMergeRecursiveOverrule($allUsedTags, TagService::getTagsFromGallery($gallery));
     }
     $this->view->assign('galleries', $galleries);
     $this->view->assign('allUsedTags', $allUsedTags);
 }
Esempio n. 6
0
 protected function getMergedConfiguration($pid, $node, $cType)
 {
     // Get configuration ctype specific configuration
     $cTypeConfig = $GLOBALS["BE_USER"]->getTSConfig('themes.content.' . $node . '.' . $cType, \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid));
     $this->ctypeProperties = $cTypeConfig['properties'];
     // Get default configuration
     $defaultConfig = $GLOBALS["BE_USER"]->getTSConfig('themes.content.' . $node . '.default', \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid));
     $this->defaultProperties = $defaultConfig['properties'];
     // Merge configurations
     $config = ArrayUtility::arrayMergeRecursiveOverrule($cTypeConfig, $defaultConfig);
     return $config;
 }
Esempio n. 7
0
 /**
  * @return void
  */
 public function initializeAction()
 {
     $this->objects = $this->widgetConfiguration['objects'];
     if (version_compare(TYPO3_branch, '6.2', '<')) {
         \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($this->configuration, $this->widgetConfiguration['configuration'], FALSE);
     } else {
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->configuration, $this->widgetConfiguration['configuration'], FALSE);
     }
     if ($this->configuration['sliceSub']) {
         $this->numberOfPages = ceil(array_sum(array_map("count", $this->objects)) / (int) $this->configuration['itemsPerPage']);
     } else {
         $this->numberOfPages = ceil(count($this->objects) / (int) $this->configuration['itemsPerPage']);
     }
     $this->maximumNumberOfLinks = (int) $this->configuration['maximumNumberOfLinks'];
 }
Esempio n. 8
0
 /**
  * Creates a new configuration object.
  *
  * @param array $paths Paths to the configuration directories
  * @param array $local Multi-dimensional associative list with local configuration
  * @return \Aimeos\MW\Config\Iface Configuration object
  */
 public static function get(array $paths, array $local = array())
 {
     if (self::$config === null) {
         // Using extension config directories
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'])) {
             ksort($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs']);
             foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'] as $dir) {
                 if (($absPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($dir)) !== '') {
                     $paths[] = $absPath;
                 }
             }
         }
         $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths);
         if (function_exists('apc_store') === true && (bool) \Aimeos\Aimeos\Base::getExtConfig('useAPC', false) === true) {
             $conf = new \Aimeos\MW\Config\Decorator\APC($conf, \Aimeos\Aimeos\Base::getExtConfig('apcPrefix', 't3:'));
         }
         self::$config = $conf;
     }
     if (isset($local['typo3']['tsconfig'])) {
         $tsconfig = \Aimeos\Aimeos\Base::parseTS($local['typo3']['tsconfig']);
         $local = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($local, $tsconfig);
     }
     return new \Aimeos\MW\Config\Decorator\Memory(self::$config, $local);
 }
Esempio n. 9
0
 /**
  * @param array $overwrites
  */
 public function setOverrides($overwrites)
 {
     foreach ($overwrites as $key => $overwrite) {
         if (empty($overwrite)) {
             unset($overwrites[$key]);
         }
     }
     $this->overrides = ArrayUtility::arrayMergeRecursiveOverrule($this->overrides, $overwrites);
 }
Esempio n. 10
0
 /**
  * Replace the variables in the given format string with fileName or properties of the
  * itemMeta object.
  *
  * @param Tx_Yag_Domain_Model_Item $item
  * @param string $format
  * @param array $additionalVars
  * @return Tx_Yag_Domain_Model_Item $item;
  */
 protected function processStringFromMetaData(Tx_Yag_Domain_Model_Item $item, $format, $additionalVars = array())
 {
     if ($item->getItemMeta() instanceof Tx_Yag_Domain_Model_ItemMeta) {
         $vars = $item->getItemMeta()->getAttributeArray();
     } else {
         $vars = array();
     }
     $vars['origFileName'] = $item->getOriginalFilename();
     $vars['fileName'] = $this->processTitleFromFileName($item->getOriginalFilename());
     $vars = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($vars, $additionalVars);
     $formattedString = Tx_PtExtlist_Utility_RenderValue::renderDataByConfigArray($vars, $format);
     return $formattedString;
 }
 /**
  * First checks if all the validation are correctly filled.
  *
  * @return    array    The validation of the field.
  */
 public function getValidation()
 {
     $this->checkValidationArrayConfiguration($this->localValidation);
     $this->checkValidationArrayConfiguration($this->validation);
     return ArrayUtility::arrayMergeRecursiveOverrule($this->localValidation, $this->validation);
 }
Esempio n. 12
0
 /**
  * Get a freshly built request object pointing to the Referrer.
  *
  * @return Request the referring request, or NULL if no referrer found
  */
 public function getReferringRequest()
 {
     if (isset($this->internalArguments['__referrer']) && is_array($this->internalArguments['__referrer'])) {
         $referrerArray = $this->internalArguments['__referrer'];
         $referringRequest = new \TYPO3\CMS\Extbase\Mvc\Web\Request();
         $arguments = array();
         if (isset($referrerArray['arguments'])) {
             $serializedArgumentsWithHmac = $referrerArray['arguments'];
             $serializedArguments = $this->hashService->validateAndStripHmac($serializedArgumentsWithHmac);
             $arguments = unserialize(base64_decode($serializedArguments));
             unset($referrerArray['arguments']);
         }
         $referringRequest->setArguments(\TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($arguments, $referrerArray));
         return $referringRequest;
     }
     return NULL;
 }
Esempio n. 13
0
 /**
  * Builds a web request object from the raw HTTP information and the configuration
  *
  * @return \TYPO3\CMS\Extbase\Mvc\Web\Request The web request as an object
  */
 public function build()
 {
     $this->loadDefaultValues();
     $pluginNamespace = $this->extensionService->getPluginNamespace($this->extensionName, $this->pluginName);
     $parameters = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($pluginNamespace);
     $files = $this->untangleFilesArray($_FILES);
     if (isset($files[$pluginNamespace]) && is_array($files[$pluginNamespace])) {
         $parameters = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($parameters, $files[$pluginNamespace]);
     }
     $controllerName = $this->resolveControllerName($parameters);
     $actionName = $this->resolveActionName($controllerName, $parameters);
     /** @var $request \TYPO3\CMS\Extbase\Mvc\Web\Request */
     $request = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Request::class);
     if ($this->vendorName !== null) {
         $request->setControllerVendorName($this->vendorName);
     }
     $request->setPluginName($this->pluginName);
     $request->setControllerExtensionName($this->extensionName);
     $request->setControllerName($controllerName);
     $request->setControllerActionName($actionName);
     $request->setRequestUri(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
     $request->setBaseUri(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'));
     $request->setMethod($this->environmentService->getServerRequestMethod());
     if (is_string($parameters['format']) && $parameters['format'] !== '') {
         $request->setFormat(filter_var($parameters['format'], FILTER_SANITIZE_STRING));
     } else {
         $request->setFormat($this->defaultFormat);
     }
     foreach ($parameters as $argumentName => $argumentValue) {
         $request->setArgument($argumentName, $argumentValue);
     }
     return $request;
 }
Esempio n. 14
0
 /**
  * @return void
  */
 public function initializeAction()
 {
     $this->objects = $this->widgetConfiguration['objects'];
     $this->configuration = ArrayUtility::arrayMergeRecursiveOverrule($this->configuration, $this->widgetConfiguration['configuration'], TRUE);
 }
Esempio n. 15
0
 /**
  * @test
  *
  * @param array $inputArray1
  * @param array $inputArray2
  * @param bool $dontAddNewKeys
  * @param bool $emptyValuesOverride
  * @param array $expected
  *
  * @dataProvider arrayMergeRecursiveOverruleData
  */
 public function arrayMergeRecursiveOverruleMergesSimpleArrays(array $inputArray1, array $inputArray2, $dontAddNewKeys, $emptyValuesOverride, array $expected)
 {
     $this->assertSame($expected, \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($inputArray1, $inputArray2, $dontAddNewKeys, $emptyValuesOverride));
 }