/** * 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 Tx_PtExtbase_Utility_NameSpace::getArrayContentByArrayAndNamespace($this->settings, $key); } else { return $this->settings; } }
/** * Renders link for an album * * @param Tx_Yag_Domain_Model_Album $album Album object to render link for * @param Tx_Yag_Domain_Model_Gallery $gallery Gallery object to render link for * @param integer $pageUid * @param integer $pageType type of the target page. See typolink.parameter * @param integer $pageType type of the target page. See typolink.parameter * @param boolean $noCache set this to disable caching for the target page. You should not need this. * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this. * @param string $section the anchor to be added to the URI * @param string $format The requested format, e.g. ".html" * @return string Rendered link for album * @throws Exception */ public function render(Tx_Yag_Domain_Model_Album $album = null, Tx_Yag_Domain_Model_Gallery $gallery = null, $pageUid = null, $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $format = '') { // TODO implement gallery download if ($album instanceof Tx_Yag_Domain_Model_Album) { $namespace = Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getObjectNamespace() . '.albumUid'; $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($namespace, array(), $album->getUid()); } Tx_PtExtbase_State_Session_SessionPersistenceManagerFactory::getInstance()->addSessionRelatedArguments($arguments); return parent::render('downloadAsZip', $arguments, 'ItemList', null, null, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format); }
/** * Renders link for an album * * @param int $galleryUid UID of album to render link for * @param \Tx_Yag_Domain_Model_Gallery $gallery Album object to render link for * @param int $pageUid (Optional) ID of page to render link for. If null, current page is used * @param int $pageType * @param bool $noCache * @param bool $noCacheHash * @param string $section * @param string $format * @throws Exception * @return string Rendered link for gallery * */ public function render($galleryUid = null, \Tx_Yag_Domain_Model_Gallery $gallery = null, $pageUid = null, $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $format = '') { if ($galleryUid === null && $gallery === null) { throw new Exception('You have to set "galleryUid" or "gallery" as parameter. Both parameters can not be empty when using galleryLinkViewHelper', 1295575455); } if ($galleryUid === null) { $galleryUid = $gallery->getUid(); } $namespace = \Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getObjectNamespace() . '.galleryUid'; $arguments = \Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($namespace, array(), $galleryUid); return parent::render('index', $arguments, 'Gallery', null, null, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format); }
protected function getSelectableThemes() { $configurationManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'); /** @var $configurationManager \TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager */ $settings = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 'Yag', 'pi1'); $themes = \Tx_PtExtbase_Utility_NameSpace::getArrayContentByArrayAndNamespace($settings, 'themes'); $selectableThemes = array(); foreach ($themes as $themeIdentifier => $theme) { $themeTitle = array_key_exists('title', $theme) ? $theme['title'] : $themeIdentifier; $selectableThemes[$themeIdentifier] = $themeTitle; } return $selectableThemes; }
/** * Renders the link to an image * * @param array $arguments Arguments * @param integer $pageUid target page. See TypoLink destination * @param integer $pageType type of the target page. See typolink.parameter * @param boolean $noCache set this to disable caching for the target page. You should not need this. * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this. * @param string $section the anchor to be added to the URI * @param string $format The requested format, e.g. ".html" * @param boolean $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed. * @param array $additionalParams additional query parameters that won't be prefixed like $arguments (overrule $arguments) * @param boolean $absolute If set, the URI of the rendered link is absolute * @param boolean $addQueryString If set, the current query parameters will be kept in the URI * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE * @return string Rendered link */ public function render($pageUid = null, $pageType = 0, array $arguments = array(), $noCache = false, $noCacheHash = false, $section = '', $format = '', $linkAccessRestrictedPages = false, array $additionalParams = array(), $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = array()) { $objectNameSpace = $namespace = Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getObjectNamespace(); $arguments = array(); if (isset($this->arguments['album'])) { $albumUid = $this->arguments['album']->getUid(); $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($objectNameSpace . '.albumUid', $arguments, $albumUid); } if (isset($this->arguments['gallery'])) { $galleryUid = $this->arguments['gallery']->getUid(); $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($objectNameSpace . '.galleryUid', $arguments, $galleryUid); } Tx_PtExtbase_State_Session_SessionPersistenceManagerFactory::getInstance()->addSessionRelatedArguments($arguments); return parent::render('show', $arguments, 'Item', null, null, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format, $linkAccessRestrictedPages, $additionalParams, $absolute, $addQueryString, $argumentsToBeExcludedFromQueryString); }
/** * Renders link for an album * * @param integer $albumUid UID of album to render link for * @param Tx_Yag_Domain_Model_Album $album Album object to render link for * @param Tx_Yag_Domain_Model_Gallery $gallery Gallery object to render link for * @param integer pageUid (Optional) ID of page to render link for. If null, current page is used * @param integer $pageType type of the target page. See typolink.parameter * @param integer $pageType type of the target page. See typolink.parameter * @param boolean $noCache set this to disable caching for the target page. You should not need this. * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this. * @param string $section the anchor to be added to the URI * @param string $format The requested format, e.g. ".html" * @return string Rendered link for album * @throws Exception */ public function render($albumUid = 0, Tx_Yag_Domain_Model_Album $album = NULL, Tx_Yag_Domain_Model_Gallery $gallery = NULL, $pageUid = NULL, $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $format = '') { if ($albumUid == 0 && $album === NULL) { throw new Exception('You have to set "albumUid" or "album" as parameter. Both parameters can not be empty when using albumLinkViewHelper', 1295575454); } if ($albumUid == 0) { $albumUid = $album->getUid(); } $baseNamespace = Tx_Yag_Domain_Context_YagContextFactory::getInstance()->getObjectNamespace(); $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($baseNamespace . '.albumUid', array(), $albumUid); if ($gallery !== NULL) { $arguments = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($baseNamespace . '.galleryUid', $arguments, $gallery->getUid()); } return parent::render('submitFilter', $arguments, 'ItemList', NULL, NULL, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format); }
/** * * @param null $key settings key * @return array */ public function getJSCompliantSettings($key = NULL) { $settings = Tx_PtExtbase_Utility_NameSpace::getArrayContentByArrayAndNamespace($this->settings, $key); return $this->convertToJSCompliantSettings($settings); }
/** @test */ public function removeDataFromNamespaceTree() { $sampleArray = array('key1' => array('key2' => array('key3' => 'testData1', 'key4' => 'testData2'), 'key5' => 'testData3')); $testArray = $sampleArray; unset($testArray['key1']['key2']['key3']); $nameSpaceString = 'key1.key2.key3'; $alteredArray = Tx_PtExtbase_Utility_NameSpace::removeDataFromNamespaceTree($nameSpaceString, $sampleArray); $this->assertEquals($alteredArray, $testArray); }
/** * Get an argument array out of a string * * @param string $argumentString * @return array */ public function getArgumentArray($argumentString) { $argumentArray = array(); $argumentChunks = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $argumentString); foreach ($argumentChunks as $argument) { if (strstr($argument, ':')) { list($key, $value) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $argument); $argumentArray = Tx_PtExtbase_Utility_NameSpace::saveDataInNamespaceTree($key, $argumentArray, $value); } else { $key = $argument; $argumentArray[$key] = false; } } return $argumentArray; }
/** * 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 = Tx_PtExtbase_Utility_NameSpace::getArrayContentByArrayAndNamespace($GLOBALS['TCA'][$this->table], $nameSpace); return $settings; }
/** * Initializes TS rbac service (invoked from objectManager) */ public function initializeObject() { $fullTypoScript = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService')->convertTypoScriptArrayToPlainArray($this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)); $this->typoScriptRbacSettings = Tx_PtExtbase_Utility_NameSpace::getArrayContentByArrayAndNamespace($fullTypoScript, 'plugin.tx_ptextbase.settings.rbac'); $this->initGroupsToObjectAndActionsArray(); }
/** * Remove session data by given namespace * * @param string $namespaceString */ public function removeSessionDataByNamespace($namespaceString) { $this->sessionData = Tx_PtExtbase_Utility_NameSpace::removeDataFromNamespaceTree($namespaceString, $this->sessionData); }
/** * @return boolean */ protected function getRenderTyposcriptFromConfiguration() { $nameSpace = implode('.', array('TYPO3_CONF_VARS.EXTCONF.pt_extbase.ajaxDispatcher.apiConfiguration', $this->extensionName, $this->controllerName, 'renderTyposcript')); return Tx_PtExtbase_Utility_NameSpace::getArrayContentByArrayAndNamespace($GLOBALS, $nameSpace); }
/** * 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 Tx_PtExtbase_Utility_NameSpace::getArrayContentByArrayAndNamespace($this->getMergedPgVars(), $namespace); }
/** * @param string $exportIdentifier * @return string * @throws Exception */ public function downloadAction($exportIdentifier) { $exportSettingsPath = $this->extlistTypoScriptSettingsPath . '.export.exportConfigs.' . $exportIdentifier; $exportSettings = Tx_PtExtbase_Utility_NameSpace::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 = Tx_PtExtbase_Utility_NameSpace::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(); }