diff --git a/Classes/Controller/YoutubeController.php b/Classes/Controller/YoutubeController.php index a056354303fcb2a1f5f27651fe659e9c1390b234..d8273139e5c2342d3c8dcefeaa8c949f847fcd75 100644 --- a/Classes/Controller/YoutubeController.php +++ b/Classes/Controller/YoutubeController.php @@ -48,11 +48,6 @@ class YoutubeController extends ActionController { */ protected $youtubeService; - /** - * @var EventDispatcherInterface - */ - protected $eventDispatcher; - /** * Injects the YouTube service * @@ -106,6 +101,13 @@ class YoutubeController extends ActionController { } } + $typo3Version = VersionNumberUtility::getCurrentTypo3Version(); + if (version_compare($typo3Version, '13.0.0', '<')) { + $disableYoutubeCache = (bool) GeneralUtility::_GP('disableYoutubeCache'); + } else { + $disableYoutubeCache = (bool) ($this->request->getParsedBody()['disableYoutubeCache'] ?? $this->request->getQueryParams()['disableYoutubeCache'] ?? null); + } + // Add third-party filters $filterInstances = $this->handleFrontendFilters($filterValues); @@ -121,7 +123,7 @@ class YoutubeController extends ActionController { // Use the possibly modified parameters $jsonArray = $this->youtubeService->getJsonAsArray( - new FilterParameterBag($youtubeParameters, $filterInstances) + new FilterParameterBag($youtubeParameters, $filterInstances, $disableYoutubeCache) ); // Dispatch the AfterYoutubeCallEvent diff --git a/Classes/EventListeners/AfterBackendPageRenderEventListener.php b/Classes/EventListeners/AfterBackendPageRenderEventListener.php index d2f9cbb333f7ba71bb0d77cf11d03e79ccba821d..ff87fabe238ed9d79916ac5289ef28b8d8d5f968 100644 --- a/Classes/EventListeners/AfterBackendPageRenderEventListener.php +++ b/Classes/EventListeners/AfterBackendPageRenderEventListener.php @@ -36,7 +36,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; class AfterBackendPageRenderEventListener { public function __invoke(AfterBackendPageRenderEvent $event) { if (!LicenceCheckService::isTYPO3VersionSupported() - || LicenceCheckService::isInDevelopmentContext() + || LicenceCheckService::isInDevelopmentContext() ) { return; } diff --git a/Classes/Filter/FilterParameterBag.php b/Classes/Filter/FilterParameterBag.php index 5ac7816eb421dd8c18e82ff91da1609efd23d307..3d40f7cb745fa7743468e1dd91a8edcfb7d55b5f 100644 --- a/Classes/Filter/FilterParameterBag.php +++ b/Classes/Filter/FilterParameterBag.php @@ -28,10 +28,12 @@ namespace SGalinski\SgYoutube\Filter; class FilterParameterBag { protected array $parameters; protected array $filterInstances; + protected bool $disableCache = FALSE; - public function __construct(array $parameters = [], array $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) { @@ -61,4 +63,14 @@ class FilterParameterBag { 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/LicenceCheckService.php b/Classes/Service/LicenceCheckService.php index 3c2a33df202058cbc185b3869c0fa105ef1f784a..fd80df762d0b63c399164ca95b4643caeec26a1c 100644 --- a/Classes/Service/LicenceCheckService.php +++ b/Classes/Service/LicenceCheckService.php @@ -130,12 +130,13 @@ class LicenceCheckService { '7.2.0' => 1717678615, // Tue, 06 Jun 2023 14:57:50 GMT '8.0.0' => 1729271668, // Tue, 18 Oct 2024 20:57:50 GMT+3 '8.0.1' => 1732058531, // Tue, 19 Nov 2024 23:15:50 GMT+3 + '8.1.0' => 1733341275, // Wed, 04 Dez 2024 20:57:50 GMT+3 ]; /** * The current extension version */ - public const CURRENT_VERSION = '8.0.1'; + public const CURRENT_VERSION = '8.1.0'; /** * @param mixed $validUntil A timestamp, which says the lifetime of this key. diff --git a/Classes/Service/YoutubeService.php b/Classes/Service/YoutubeService.php index 7f2039d65287ae6f5b8d680bf011817f776629f3..05deb35d1c2f0e7ddb2218f10e576a5666b97475 100644 --- a/Classes/Service/YoutubeService.php +++ b/Classes/Service/YoutubeService.php @@ -329,7 +329,9 @@ class YoutubeService { $url = $parameterBag->get('url', $this->getApiUrl($parameters, $parameterBag->getFilterInstances())); $cacheKey = 'sg_youtube' . sha1($url); - $disableYoutubeCache = (bool) GeneralUtility::_GP('disableYoutubeCache'); + + $disableYoutubeCache = $parameterBag->getDisableCache(); + if (!$disableYoutubeCache) { $cachedResult = $this->cache->get($cacheKey); if ($cachedResult) { diff --git a/Classes/Utility/FlexFormUtility.php b/Classes/Utility/FlexFormUtility.php index 37f0d72093c92a29e38de03430dc767883c5362f..3513e02251eb64cc74024119065c164ee597ce3a 100644 --- a/Classes/Utility/FlexFormUtility.php +++ b/Classes/Utility/FlexFormUtility.php @@ -47,6 +47,7 @@ class FlexFormUtility { // Get the TypoScript configuration for the site $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class); $typoScriptArray = $fullTypoScript; + $pluginSettings = $typoScriptService->convertTypoScriptArrayToPlainArray( $typoScriptArray['plugin.']['tx_sgyoutube.']['settings.'] ); diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 54ee5b429a6a407b76d7ab34704d8f944d39542e..aaca4ae40372188c33a4940db9685c22d96ab4ef 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -6,8 +6,12 @@ use TYPO3\CMS\Extbase\Utility\ExtensionUtility; $pluginSignature = ExtensionUtility::registerPlugin( 'SgYoutube', 'Youtube', - 'YouTube Videos' + 'YouTube Videos', + 'extension-sg_youtube', + 'plugins', + 'LLL:EXT:sg_youtube/Resources/Private/Language/locallang.xlf:youtubePluginDescription' ); + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform'; ExtensionManagementUtility::addPiFlexFormValue( $pluginSignature, diff --git a/composer.json b/composer.json index cc49a60a49e2b1fa041d709c412da818fb55c3d3..c7cd8e277c468dec79df22417fc05073ccf750a3 100644 --- a/composer.json +++ b/composer.json @@ -4,9 +4,9 @@ "description": "A solution for embedding YouTube videos, playlists, or channels easily into TYPO3 pages.", "homepage": "https://www.sgalinski.de", "license": "GPL-2.0-or-later", - "version": "8.0.1", + "version": "8.1.0", "require": { - "typo3/cms-core": "^12.4.0" + "typo3/cms-core": "^12.4 || ^13.4" }, "replace": { "sgalinski/sg_youtube": "self.version" diff --git a/ext_emconf.php b/ext_emconf.php index 267ca344049c6ae71a86ae350ba636117b8cfb04..fcbc2ab1524a94a9d0e14cb04797882f2937b7f2 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -32,10 +32,10 @@ $EM_CONF['sg_youtube'] = [ 'author_email' => 'stefan@sgalinski.de', 'author_company' => 'sgalinski Internet Services (https://www.sgalinski.de)', 'state' => 'stable', - 'version' => '8.0.1', + 'version' => '8.1.0', '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 a824a264d7074eb60c3782a135805bc0141b5f7c..6bfb8ebd4de1a55f54357548c072fbdbc9b5b19a 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -5,6 +5,7 @@ use SGalinski\SgYoutube\Form\Element\LicenceStatus; use SGalinski\SgYoutube\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_youtube']['uncached'] ?? FALSE) { // Uncached version @@ -29,10 +30,13 @@ if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_youtube']['uncached'] ?? FALSE ); } -// include Plugin sg_twitter -ExtensionManagementUtility::addPageTSConfig( - '@import "EXT:sg_youtube/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig"' -); +$currentTypo3Version = VersionNumberUtility::getCurrentTypo3Version(); +if (version_compare($currentTypo3Version, '13.0.0', '<')) { +// include Plugin sg_youtube + ExtensionManagementUtility::addPageTSConfig( + '@import "EXT:sg_youtube/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig"' + ); +} // Caching $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sgyoutube_cache'] ??= [];