From 25077f14e6405ae0c8730e1edc03bf0493873e64 Mon Sep 17 00:00:00 2001 From: Georgi Mateev <georgi.mateev@sgalinski.de> Date: Wed, 4 Dec 2024 21:38:13 +0200 Subject: [PATCH] [TASK] TYPO3 v13 Support --- Classes/Controller/VimeoController.php | 8 +++ Classes/Filter/FilterParameterBag.php | 66 +++++++++++++--------- Classes/Service/VimeoService.php | 2 +- Configuration/TCA/Overrides/tt_content.php | 5 +- ext_emconf.php | 2 +- ext_localconf.php | 12 ++-- 6 files changed, 61 insertions(+), 34 deletions(-) diff --git a/Classes/Controller/VimeoController.php b/Classes/Controller/VimeoController.php index 8f73628..74144e9 100644 --- a/Classes/Controller/VimeoController.php +++ b/Classes/Controller/VimeoController.php @@ -40,6 +40,7 @@ use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection; use TYPO3\CMS\Core\Resource\FileReference; use TYPO3\CMS\Core\Resource\FileRepository; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Core\Utility\VersionNumberUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Service\ImageService; @@ -98,6 +99,13 @@ class VimeoController extends ActionController { } } + $typo3Version = VersionNumberUtility::getCurrentTypo3Version(); + if (version_compare($typo3Version, '13.0.0', '<')) { + $disableVimeoCache = (bool) GeneralUtility::_GP('disableVimeoCache'); + } else { + $disableVimeoCache = (bool) ($this->request->getParsedBody()['disableVimeoCache'] ?? $this->request->getQueryParams()['disableVimeoCache'] ?? null); + } + // Add third-party filters $filterInstances = $this->handleFrontendFilters($filterValues); diff --git a/Classes/Filter/FilterParameterBag.php b/Classes/Filter/FilterParameterBag.php index e49e22c..aa9a76f 100644 --- a/Classes/Filter/FilterParameterBag.php +++ b/Classes/Filter/FilterParameterBag.php @@ -26,39 +26,51 @@ namespace SGalinski\SgVimeo\Filter; class FilterParameterBag { - protected array $parameters; - protected array $filterInstances; + protected array $parameters; + protected array $filterInstances; + protected bool $disableCache = FALSE; - public function __construct(array $parameters = [], array $filterInstances = []) { - $this->parameters = $parameters; - $this->filterInstances = $filterInstances; - } + public function __construct(array $parameters = [], array $filterInstances = [], bool $disableCache = FALSE) { + $this->parameters = $parameters; + $this->filterInstances = $filterInstances; + $this->disableCache = $disableCache; + } - public function get(string $key, $default = NULL) { - return $this->parameters[$key] ?? $default; - } + public function get(string $key, $default = NULL) { + return $this->parameters[$key] ?? $default; + } - public function set(string $key, $value): void { - $this->parameters[$key] = $value; - } + public function set(string $key, $value): void { + $this->parameters[$key] = $value; + } - public function all(): array { - return $this->parameters; - } + public function all(): array { + return $this->parameters; + } - public function remove(string $key): void { - unset($this->parameters[$key]); - } + public function remove(string $key): void { + unset($this->parameters[$key]); + } - public function merge(array $parameters): void { - $this->parameters = array_merge($this->parameters, $parameters); - } + public function merge(array $parameters): void { + $this->parameters = array_merge($this->parameters, $parameters); + } - public function getFilterInstances(): array { - return $this->filterInstances; - } + public function getFilterInstances(): array { + return $this->filterInstances; + } - public function setFilterInstances(array $filterInstances): void { - $this->filterInstances = $filterInstances; - } + public function setFilterInstances(array $filterInstances): void { + $this->filterInstances = $filterInstances; + } + + public function getDisableCache(): bool + { + return $this->disableCache; + } + + public function setDisableCache(bool $disableCache): void + { + $this->disableCache = $disableCache; + } } diff --git a/Classes/Service/VimeoService.php b/Classes/Service/VimeoService.php index 4377bc4..4d6877c 100644 --- a/Classes/Service/VimeoService.php +++ b/Classes/Service/VimeoService.php @@ -145,7 +145,7 @@ class VimeoService implements LoggerAwareInterface { $response = []; $this->maxResultsPerPage = $maxResults; $cacheKey = 'sg_vimeo' . sha1($vimeoId . $maxResults . $queryString . $filtersHash); - $disableVimeoCache = (bool) GeneralUtility::_GP('disableVimeoCache'); + $disableVimeoCache = $parameterBag->getDisableCache(); if (!$disableVimeoCache) { $cachedResult = $this->cache->get($cacheKey); if ($cachedResult) { diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index d06cac8..66a0345 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -6,7 +6,10 @@ use TYPO3\CMS\Extbase\Utility\ExtensionUtility; $pluginSignature = ExtensionUtility::registerPlugin( 'SgVimeo', 'Vimeo', - 'Vimeo Videos' + 'Vimeo Videos', + 'extension-sg_vimeo', + 'plugins', + 'LLL:EXT:sg_vimeo/Resources/Private/Language/locallang.xlf:vimeoPluginDescription' ); $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform'; ExtensionManagementUtility::addPiFlexFormValue( diff --git a/ext_emconf.php b/ext_emconf.php index 088d564..8d217af 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -35,7 +35,7 @@ $EM_CONF['sg_vimeo'] = [ 'version' => '5.0.1', 'constraints' => [ 'depends' => [ - 'typo3' => '12.4.0-12.4.99', + 'typo3' => '12.4.0-13.4.99', 'php' => '8.1.0-8.3.99', ], 'conflicts' => [], diff --git a/ext_localconf.php b/ext_localconf.php index 04869ea..374ee20 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -6,6 +6,7 @@ use SGalinski\SgVimeo\Form\Element\LicenceStatus; use SGalinski\SgVimeo\Hooks\LicenceCheckHook; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Extbase\Utility\ExtensionUtility; +use TYPO3\CMS\Core\Utility\VersionNumberUtility; if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_vimeo']['uncached'] ?? FALSE) { // Uncached version @@ -30,10 +31,13 @@ if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_vimeo']['uncached'] ?? FALSE) ); } -// include Plugin sg_twitter -ExtensionManagementUtility::addPageTSConfig( - '@import "EXT:sg_vimeo/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig"' -); +$currentTypo3Version = VersionNumberUtility::getCurrentTypo3Version(); +if (version_compare($currentTypo3Version, '13.0.0', '<')) { +// include Plugin sg_vimeo + ExtensionManagementUtility::addPageTSConfig( + '@import "EXT:sg_vimeo/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig"' + ); +} // Caching $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sgvimeo_cache'] ??= []; -- GitLab