/**
  * Returns sub array of settings for given array namespace
  * (e.g. key1.key2.key3 returns settings['key1']['key2']['key3'])
  *
  * If no key is given, whole settings array is returned.
  *
  * If key does not exist, empty array is returned.
  *
  * @param string $key Key of settings array to be returned
  * @return mixed
  */
 public function getSettings($key = '')
 {
     if ($key != '') {
         return NamespaceUtility::getArrayContentByArrayAndNamespace($this->settings, $key);
     } else {
         return $this->settings;
     }
 }
 /** @test */
 public function removeDataFromNamespaceTree()
 {
     $sampleArray = ['key1' => ['key2' => ['key3' => 'testData1', 'key4' => 'testData2'], 'key5' => 'testData3']];
     $testArray = $sampleArray;
     unset($testArray['key1']['key2']['key3']);
     $nameSpaceString = 'key1.key2.key3';
     $alteredArray = NamespaceUtility::removeDataFromNamespaceTree($nameSpaceString, $sampleArray);
     $this->assertEquals($alteredArray, $testArray);
 }
Example #3
0
 /**
  * Extracts merged GP vars for a given namespace. Merges Post vars over Get vars
  *
  * @param string $namespace
  * @return array Merged get and post vars for given namespace
  */
 public function extractPgVarsByNamespace($namespace)
 {
     return NamespaceUtility::getArrayContentByArrayAndNamespace($this->getMergedPgVars(), $namespace);
 }
Example #4
0
 /**
  * Get the TCA settings by namespace
  *
  * @param $nameSpace
  * @param null $table
  * @return array
  */
 public function getSettingsByNamespace($nameSpace, $table = null)
 {
     if ($table) {
         $this->setTable($table);
     }
     $settings = NamespaceUtility::getArrayContentByArrayAndNamespace($GLOBALS['TCA'][$this->table], $nameSpace);
     return $settings;
 }
 /**
  * Initializes TS rbac service (invoked from objectManager)
  */
 public function initializeObject()
 {
     $fullTypoScript = GeneralUtility::makeInstance(TypoScriptService::class)->convertTypoScriptArrayToPlainArray($this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT));
     $this->typoScriptRbacSettings = NamespaceUtility::getArrayContentByArrayAndNamespace($fullTypoScript, 'plugin.tx_ptextbase.settings.rbac');
     $this->initGroupsToObjectAndActionsArray();
 }
Example #6
0
 /**
  * Get an argument array out of a string
  * 
  * @param string $argumentString
  * @return array
  */
 public function getArgumentArray($argumentString)
 {
     $argumentArray = array();
     $argumentChunks = GeneralUtility::trimExplode(',', $argumentString);
     foreach ($argumentChunks as $argument) {
         if (strstr($argument, ':')) {
             list($key, $value) = GeneralUtility::trimExplode(':', $argument);
             $argumentArray = NamespaceUtility::saveDataInNamespaceTree($key, $argumentArray, $value);
         } else {
             $key = $argument;
             $argumentArray[$key] = false;
         }
     }
     return $argumentArray;
 }
 /**
  * @param string $exportIdentifier
  * @return string
  * @throws Exception
  */
 public function downloadAction($exportIdentifier)
 {
     $exportSettingsPath = $this->extlistTypoScriptSettingsPath . '.export.exportConfigs.' . $exportIdentifier;
     $exportSettings = \PunktDe\PtExtbase\Utility\NamespaceUtility::getArrayContentByArrayAndNamespace($this->settings, $exportSettingsPath);
     if (!is_array($exportSettings) || empty($exportSettings)) {
         throw new Exception('No export settings found within the path ' . $exportSettingsPath, 1331644291);
     }
     $exportConfig = new Tx_PtExtlist_Domain_Configuration_Export_ExportConfig($this->configurationBuilder, $exportSettings);
     if (array_key_exists('exportListSettingsPath', $exportSettings)) {
         $exportListSettings = \PunktDe\PtExtbase\Utility\NamespaceUtility::getArrayContentByArrayAndNamespace($this->settings, $exportSettings['exportListSettingsPath']);
     } else {
         $exportListSettings = $this->configurationBuilder->getSettings();
     }
     $extListContext = Tx_PtExtlist_ExtlistContext_ExtlistContextFactory::getContextByCustomConfiguration($exportListSettings, $this->listIdentifier, false);
     $list = $extListContext->getList(true);
     $view = $this->objectManager->get($exportConfig->getViewClassName());
     $view->setConfigurationBuilder($extListContext->getConfigurationBuilder());
     $view->setExportConfiguration($exportConfig);
     $view->assign('listHeader', $list->getListHeader());
     $view->assign('listCaptions', $list->getRenderedListHeader());
     $view->assign('listData', $list->getRenderedListData());
     $view->assign('aggregateRows', $list->getRenderedAggregateListData());
     return $view->render();
 }
 /**
  * Remove session data by given namespace
  *
  * @param string $namespaceString
  */
 public function removeSessionDataByNamespace($namespaceString)
 {
     $this->sessionData = NamespaceUtility::removeDataFromNamespaceTree($namespaceString, $this->sessionData);
 }
Example #9
0
 /**
  * @return boolean
  */
 protected function getLoadLanguagesFromConfiguration()
 {
     $nameSpace = implode('.', ['TYPO3_CONF_VARS.EXTCONF.pt_extbase.ajaxDispatcher.apiConfiguration', $this->extensionName, $this->controllerName, 'loadLanguages']);
     return NamespaceUtility::getArrayContentByArrayAndNamespace($GLOBALS, $nameSpace);
 }