From 766022f8f27018785dae4dabcdf8181c2161adc3 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sat, 8 Oct 2022 05:43:30 +0000 Subject: [PATCH] Apply fixes from StyleCI --- Classes/Domain/Model/Theme.php | 1 - ...omainRepositoryThemeRepositoryInitHook.php | 1 - Classes/ViewHelpers/ConstantViewHelper.php | 136 +++++++++--------- 3 files changed, 69 insertions(+), 69 deletions(-) diff --git a/Classes/Domain/Model/Theme.php b/Classes/Domain/Model/Theme.php index 4ccc45c..8c8f4ba 100755 --- a/Classes/Domain/Model/Theme.php +++ b/Classes/Domain/Model/Theme.php @@ -205,4 +205,3 @@ public function addTypoScriptForFe(&$params, TemplateService &$pObj, $extensions } } } - diff --git a/Classes/Hooks/ThemesDomainRepositoryThemeRepositoryInitHook.php b/Classes/Hooks/ThemesDomainRepositoryThemeRepositoryInitHook.php index 6be8227..5952df2 100755 --- a/Classes/Hooks/ThemesDomainRepositoryThemeRepositoryInitHook.php +++ b/Classes/Hooks/ThemesDomainRepositoryThemeRepositoryInitHook.php @@ -76,4 +76,3 @@ public function init(&$params, $pObj) } } } - diff --git a/Classes/ViewHelpers/ConstantViewHelper.php b/Classes/ViewHelpers/ConstantViewHelper.php index 249ea9f..6779728 100644 --- a/Classes/ViewHelpers/ConstantViewHelper.php +++ b/Classes/ViewHelpers/ConstantViewHelper.php @@ -1,6 +1,7 @@ * @package themes - * + * * @deprecated readd constantsviewhelper to ensure compatibility to old themes - * + * */ -class ConstantViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper { +class ConstantViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper +{ /** * Initialize arguments. @@ -24,76 +26,76 @@ public function initializeArguments() $this->registerArgument('constant', 'string', 'the constant path', false, ''); } - /** - * Gets a constant - * - * @param string $constant The name of the constant - * @return string Constant-Value - * - * = Examples = - * - * - * - * - * - * http://yourdomain.tld/ - * (depending on your domain) - * - */ - public function render() + /** + * Gets a constant + * + * @param string $constant The name of the constant + * @return string Constant-Value + * + * = Examples = + * + * + * + * + * + * http://yourdomain.tld/ + * (depending on your domain) + * + */ + public function render() { $constant = $this->arguments['constant']; - $pageWithTheme = \KayStrobach\Themes\Utilities\FindParentPageWithThemeUtility::find($this->getFrontendController()->id); - $pageLanguage = (int)GeneralUtility::_GP('L'); - // instantiate the cache - /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */ - $cache = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('themes_cache'); - $cacheLifeTime = 60 * 60 * 24 * 7 * 365 * 20; - $cacheIdentifierString = 'theme-of-page-' . $pageWithTheme . '-of-language-' . $pageLanguage; - $cacheIdentifier = sha1($cacheIdentifierString); + $pageWithTheme = \KayStrobach\Themes\Utilities\FindParentPageWithThemeUtility::find($this->getFrontendController()->id); + $pageLanguage = (int)GeneralUtility::_GP('L'); + // instantiate the cache + /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */ + $cache = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('themes_cache'); + $cacheLifeTime = 60 * 60 * 24 * 7 * 365 * 20; + $cacheIdentifierString = 'theme-of-page-' . $pageWithTheme . '-of-language-' . $pageLanguage; + $cacheIdentifier = sha1($cacheIdentifierString); - // If flatSetup is available, cache it - $flatSetup = $this->getFrontendController()->tmpl->flatSetup; - if ((isset($flatSetup) && (is_array($flatSetup)) && (count($flatSetup) > 0))) { - $cache->set( - $cacheIdentifier, - $flatSetup, - array( - 'page-' . $this->getFrontendController()->id - ), - $cacheLifeTime - ); - } else { - $flatSetup = $cache->get($cacheIdentifier); - } + // If flatSetup is available, cache it + $flatSetup = $this->getFrontendController()->tmpl->flatSetup; + if ((isset($flatSetup) && (is_array($flatSetup)) && (count($flatSetup) > 0))) { + $cache->set( + $cacheIdentifier, + $flatSetup, + array( + 'page-' . $this->getFrontendController()->id + ), + $cacheLifeTime + ); + } else { + $flatSetup = $cache->get($cacheIdentifier); + } - // If flatSetup not available and not cached, generate it! - if (!isset($flatSetup) || !is_array($flatSetup)) { - $this->getFrontendController()->tmpl->generateConfig(); - $flatSetup = $this->getFrontendController()->tmpl->flatSetup; - $cache->set( - $cacheIdentifier, - $flatSetup, - array( - 'page-' . $this->getFrontendController()->id - ), - $cacheLifeTime - ); - } + // If flatSetup not available and not cached, generate it! + if (!isset($flatSetup) || !is_array($flatSetup)) { + $this->getFrontendController()->tmpl->generateConfig(); + $flatSetup = $this->getFrontendController()->tmpl->flatSetup; + $cache->set( + $cacheIdentifier, + $flatSetup, + array( + 'page-' . $this->getFrontendController()->id + ), + $cacheLifeTime + ); + } - // check if there is a value and return it - if ((is_array($flatSetup)) && (array_key_exists($constant, $flatSetup))) { - return $this->getFrontendController()->tmpl->substituteConstants($flatSetup[$constant]); - } - return NULL; - } + // check if there is a value and return it + if ((is_array($flatSetup)) && (array_key_exists($constant, $flatSetup))) { + return $this->getFrontendController()->tmpl->substituteConstants($flatSetup[$constant]); + } + return null; + } - /** - * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController - */ - public function getFrontendController() + /** + * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController + */ + public function getFrontendController() { - return $GLOBALS['TSFE']; - } + return $GLOBALS['TSFE']; + } }