/**
  * Returns the TypoScript configuration value at a the given path.
  * Example: config.tx_myext.some_conf
  *
  * @param    string        $path      The path to the configuration value.
  * @param    int|null|bool $pageUid   The uid of the page you want the TypoScript configuration from. If "null" is given, only the static configuration is returned.
  * @param    string        $delimiter The delimiter for the path. Default is ".".
  * @return    mixed|null
  */
 public static function getConfigurationFromPath($path, $pageUid = null, $delimiter = '.')
 {
     $result = null;
     $cacheIdentifier = md5($path . (string) $pageUid);
     $cacheInstance = CacheManager::getCacheInstance(CacheManager::CACHE_MAIN);
     if ($cacheInstance) {
         if ($cacheInstance->has($cacheIdentifier)) {
             $result = $cacheInstance->get($cacheIdentifier);
         } elseif (ArrayUtility::isValidPath(self::getTypoScriptConfiguration($pageUid), $path, $delimiter)) {
             $result = ArrayUtility::getValueByPath(self::getTypoScriptConfiguration($pageUid), $path, $delimiter);
             $cacheInstance->set($cacheIdentifier, $result);
         }
     }
     return $result;
 }
 /**
  * Gets backend layout identifiers to be excluded
  *
  * @param array $pageTSconfig
  * @return array
  */
 protected function getIdentifiersToBeExcluded(array $pageTSconfig)
 {
     $identifiersToBeExcluded = array();
     if (ArrayUtility::isValidPath($pageTSconfig, 'options./backendLayout./exclude')) {
         $identifiersToBeExcluded = GeneralUtility::trimExplode(',', ArrayUtility::getValueByPath($pageTSconfig, 'options./backendLayout./exclude'), true);
     }
     return $identifiersToBeExcluded;
 }
 /**
  * Get the value within the settings of the duplication process, at the
  * given path.
  * If $path begins with "data:", the function will search for the
  * duplication data at the given index (string after "data:"), and return
  * the value, if found.
  *
  * @param	string	$path		The path within the settings, if none given, the full settings will be returned.
  * @param	string	$delimiter	The delimiter for path, default ".".
  * @return	mixed	The settings of the process at the given path, or the duplication data value (see function documentation).
  */
 public function getProcessSettings($path = null, $delimiter = '.')
 {
     if ($path) {
         $setting = ArrayUtility::isValidPath($this->settings, $path, $delimiter) ? ArrayUtility::getValueByPath($this->settings, $path, $delimiter) : null;
         if ($setting) {
             if (strpos($setting, 'data:') !== false) {
                 $settingDataKey = substr($setting, 5);
                 if ($this->getDuplicationData($settingDataKey)) {
                     $setting = $this->getDuplicationData($settingDataKey);
                 }
             }
         }
         return $setting;
     }
     return $this->settings;
 }
 /**
  * Check if access / write to given path in local configuration is allowed.
  *
  * @param string $path Path to search for
  * @return boolean TRUE if access is allowed
  */
 protected function isValidLocalConfigurationPath($path)
 {
     // Early return for white listed paths
     foreach ($this->whiteListedLocalConfigurationPaths as $whiteListedPath) {
         if (Utility\GeneralUtility::isFirstPartOfStr($path, $whiteListedPath)) {
             return TRUE;
         }
     }
     return Utility\ArrayUtility::isValidPath($this->getDefaultConfiguration(), $path);
 }
 /**
  * @param    string $path      The path within the settings, if none given, the full settings will be returned.
  * @param    string $delimiter The delimiter for path, default ".".
  * @return mixed    The settings of the field.
  */
 public function getSettings($path = null, $delimiter = '.')
 {
     if ($path) {
         $setting = \TYPO3\CMS\Core\Utility\ArrayUtility::isValidPath($this->settings, $path, $delimiter) ? \TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath($this->settings, $path, $delimiter) : null;
         return $setting;
     }
     return $this->settings;
 }
 /**
  * @test
  */
 public function isValidPathReturnsFalseIfPathDoesNotExist()
 {
     $this->assertFalse(ArrayUtility::isValidPath(array('foo' => 'bar'), 'bar'));
 }
 /**
  * Calls a defined TypoScript library.
  *
  * @param	array	$arguments	Array containing the request arguments.
  * @param	int		$id			The page uid.
  * @return	string	The result of the TypoScript library.
  * @throws \Exception
  */
 private function callTypoScriptLibrary($arguments, $id)
 {
     $pageConfiguration = self::getPageConfiguration($id);
     if (ArrayUtility::isValidPath($pageConfiguration, $arguments['typoScriptLib'], '.')) {
         $typoScriptLib = ArrayUtility::getValueByPath($pageConfiguration, $arguments['typoScriptLib'], '.');
         if (!array_key_exists('_typoScriptNodeValue', $typoScriptLib)) {
             throw new \Exception('The TypoScript libraty "' . $arguments['typoScriptLib'] . '" does not have a Content Object type.', 1429113764);
         }
         $result = $this->callContentObject($typoScriptLib, $arguments['arguments']);
         return $result;
     } else {
         throw new \Exception('TypoScript library "' . $arguments['typoScriptLib'] . '" was not found.', 1429113004);
     }
 }
 /**
  * Returns a string containing all the constants configuration for the
  * pages.
  *
  * @param	int		$pageUid				The page uid.
  * @param	array	$pageUidAssociation		Association of uid for the given page.
  * @return	string
  */
 private static function getTemplateConstantsUidAssociationString($pageUid, array $pageUidAssociation)
 {
     $constantsString = '';
     $pagesPaths = TypoScriptUtility::getExtensionConfigurationFromPath('constantsPaths.pagesPaths');
     if (!is_array($pagesPaths)) {
     } else {
         $constants = TypoScriptUtility::getTypoScriptConstants($pageUid);
         foreach ($pagesPaths as $path) {
             if (ArrayUtility::isValidPath($constants, $path, '.')) {
                 $pagesValues = ArrayUtility::getValueByPath($constants, $path, '.');
                 if (is_array($pagesValues)) {
                     foreach ($pagesValues as $pageName => $pageValue) {
                         if (array_key_exists($pageValue, $pageUidAssociation)) {
                             $constantsString .= $path . '.' . $pageName . ' = ' . $pageUidAssociation[$pageValue] . CRLF;
                         }
                     }
                 }
             }
         }
     }
     return $constantsString;
 }
 /**
  * Check if access / write to given path in local configuration is allowed.
  *
  * @param string $path Path to search for
  * @return boolean TRUE if access is allowed
  */
 protected static function isValidLocalConfigurationPath($path)
 {
     // Early return for white listed paths
     foreach (static::$whiteListedLocalConfigurationPaths as $whiteListedPath) {
         if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($path, $whiteListedPath)) {
             return TRUE;
         }
     }
     return \TYPO3\CMS\Core\Utility\ArrayUtility::isValidPath(static::getDefaultConfiguration(), $path);
 }