Skip to content
Snippets Groups Projects
Commit 1355c69d authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[TASK] Release version 6.0.0

parent 77a8dffc
No related branches found
Tags 6.0.6
No related merge requests found
......@@ -21,6 +21,7 @@
namespace SGalinski\SgYoutube\Controller;
use Exception;
use Psr\Http\Message\ResponseInterface;
use SGalinski\SgYoutube\Service\CachedImageService;
use SGalinski\SgYoutube\Service\YoutubeService;
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
......@@ -40,7 +41,7 @@ class YoutubeController extends ActionController {
protected $youtubeService;
/**
* Injects the YouTube service. Is lot faster to use the inject method than the inject annotation!
* Injects the YouTube service
*
* @param YoutubeService $youtubeService
* @return void
......@@ -52,7 +53,7 @@ class YoutubeController extends ActionController {
/**
* Renders the YouTube video view
*
* @return NULL|string
* @return void|string|ResponseInterface
*/
public function indexAction() {
$id = $this->settings['id'] ?? '';
......@@ -61,7 +62,7 @@ class YoutubeController extends ActionController {
$apiKey = $this->settings['apiKey'] ?? '';
$thumbnailType = $this->settings['thumbnailType'] ?? 'byAspectRatio';
$aspectRatio = $this->settings['aspectRatio'] ?? '16:9';
$showApiResult = (bool)($this->settings['showApiResult'] ?? FALSE);
$showApiResult = (bool) ($this->settings['showApiResult'] ?? FALSE);
$debugOutput = '';
$filterIds = explode(',', $filterIds);
......@@ -70,7 +71,7 @@ class YoutubeController extends ActionController {
}
unset($filterId);
$maxResultsWithFilters = (string)((int)$maxResults + count($filterIds));
$maxResultsWithFilters = (string) ((int) $maxResults + count($filterIds));
try {
$jsonArray = $this->youtubeService->getJsonAsArray($id, $maxResultsWithFilters, $apiKey);
......@@ -102,11 +103,15 @@ class YoutubeController extends ActionController {
$jsonArray['items'] = $this->mapJsonArrayWithPossibleCustomThumbnails($jsonArray['items']);
} catch (Exception $exception) {
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '12.0.0', '>=')) {
if (version_compare(
\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(),
'12.0.0',
'>='
)) {
return $this->htmlResponse('<div style="color: red;">' . $exception->getMessage() . '</div>');
} else {
return '<div style="color: red;">' . $exception->getMessage() . '</div>';
}
return '<div style="color: red;">' . $exception->getMessage() . '</div>';
}
$cachedImageService = GeneralUtility::makeInstance(CachedImageService::class, 'youtube');
......@@ -121,8 +126,8 @@ class YoutubeController extends ActionController {
'feed' => $jsonArray['items'],
'response' => $jsonArray,
'debugOutput' => $debugOutput,
'showTitle' => (int)($this->settings['showTitle'] ?? 1),
'showDescription' => (int)($this->settings['showDescription'] ?? 1),
'showTitle' => (int) ($this->settings['showTitle'] ?? 1),
'showDescription' => (int) ($this->settings['showDescription'] ?? 1),
'pluginContentData' => $this->configurationManager->getContentObject()->data
]
);
......@@ -139,7 +144,7 @@ class YoutubeController extends ActionController {
* @return array
*/
protected function mapJsonArrayWithPossibleCustomThumbnails(array $jsonArray): array {
$contentElementUid = (int)$this->configurationManager->getContentObject()->data['uid'];
$contentElementUid = (int) $this->configurationManager->getContentObject()->data['uid'];
if ($contentElementUid <= 0) {
return $jsonArray;
}
......@@ -165,7 +170,7 @@ class YoutubeController extends ActionController {
$cropString = $fileObject->getProperty('crop');
}
$cropVariantCollection = CropVariantCollection::create((string)$cropString);
$cropVariantCollection = CropVariantCollection::create((string) $cropString);
$cropArea = $cropVariantCollection->getCropArea();
$processingInstructions = [
'crop' => $cropArea->isEmpty() ? NULL : $cropArea->makeAbsoluteBasedOnFile($fileObject),
......
......@@ -57,7 +57,7 @@ class PluginRenderer {
&$drawItem,
&$headerContent,
&$itemContent,
array &$row
array &$row
): void {
trigger_error(
'Using the old style of rendering backend previews is deprecated and will not longer work when TYPO3 10'
......@@ -83,7 +83,7 @@ class PluginRenderer {
*/
protected function adaptPluginHeaderContent(&$headerContent, $row): void {
$headerContent = '<h4>' . $this->getPluginNameForHeaderContent(
(int)$row['pid'],
(int) $row['pid'],
$row['list_type']
) . $headerContent . '</h4>';
}
......
......@@ -26,7 +26,6 @@
namespace SGalinski\SgYoutube\Service;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Http\RequestFactory;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -179,7 +178,7 @@ class LicenceCheckService {
* @return string
*/
public static function getLicenseKey() {
return (string)ExtensionSettingsService::getSetting(ExtensionSettingsService::SETTING_LICENSE);
return (string) ExtensionSettingsService::getSetting(ExtensionSettingsService::SETTING_LICENSE);
}
/**
......@@ -232,8 +231,10 @@ class LicenceCheckService {
* @return mixed|null
*/
public static function getLastKey() {
$registry = GeneralUtility::makeInstance(Registry::class);
return $registry->get(self::REGISTRY_NAMESPACE, self::LAST_LICENSE_KEY_CHECKED_KEY);
return GeneralUtility::makeInstance(Registry::class)->get(
self::REGISTRY_NAMESPACE,
self::LAST_LICENSE_KEY_CHECKED_KEY
);
}
/**
......@@ -242,7 +243,7 @@ class LicenceCheckService {
* @param bool $isValid
*/
protected static function setValidLicense($isValid) {
$isValid = (bool)$isValid;
$isValid = (bool) $isValid;
$registry = GeneralUtility::makeInstance(Registry::class);
$registry->set(self::REGISTRY_NAMESPACE, self::IS_KEY_VALID_KEY, $isValid);
}
......@@ -254,7 +255,7 @@ class LicenceCheckService {
*/
protected static function getValidLicense() {
$registry = GeneralUtility::makeInstance(Registry::class);
return (bool)$registry->get(self::REGISTRY_NAMESPACE, self::IS_KEY_VALID_KEY);
return (bool) $registry->get(self::REGISTRY_NAMESPACE, self::IS_KEY_VALID_KEY);
}
/**
......@@ -273,8 +274,10 @@ class LicenceCheckService {
* @return mixed|null
*/
protected static function getLastWarningTimestamp() {
$registry = GeneralUtility::makeInstance(Registry::class);
return $registry->get(self::REGISTRY_NAMESPACE, self::LAST_WARNING_TIMESTAMP_KEY);
return GeneralUtility::makeInstance(Registry::class)->get(
self::REGISTRY_NAMESPACE,
self::LAST_WARNING_TIMESTAMP_KEY
);
}
/**
......@@ -293,8 +296,10 @@ class LicenceCheckService {
* @return mixed|null
*/
protected static function getValidLicenseUntilTimestamp() {
$registry = GeneralUtility::makeInstance(Registry::class);
return $registry->get(self::REGISTRY_NAMESPACE, self::HAS_VALID_LICENSE_UNTIL_TIMESTAMP_KEY);
return GeneralUtility::makeInstance(Registry::class)->get(
self::REGISTRY_NAMESPACE,
self::HAS_VALID_LICENSE_UNTIL_TIMESTAMP_KEY
);
}
/**
......@@ -313,8 +318,10 @@ class LicenceCheckService {
* @return mixed|null
*/
protected static function getLicenseCheckedInVersion() {
$registry = GeneralUtility::makeInstance(Registry::class);
return $registry->get(self::REGISTRY_NAMESPACE, self::LICENSE_CHECKED_IN_VERSION_KEY);
return GeneralUtility::makeInstance(Registry::class)->get(
self::REGISTRY_NAMESPACE,
self::LICENSE_CHECKED_IN_VERSION_KEY
);
}
/**
......@@ -331,8 +338,10 @@ class LicenceCheckService {
* @return mixed|null
*/
public static function getLastLicenseCheckTimestamp() {
$registry = GeneralUtility::makeInstance(Registry::class);
return $registry->get(self::REGISTRY_NAMESPACE, self::LAST_CHECKED_TIMESTAMP_KEY);
return GeneralUtility::makeInstance(Registry::class)->get(
self::REGISTRY_NAMESPACE,
self::LAST_CHECKED_TIMESTAMP_KEY
);
}
/**
......@@ -349,8 +358,10 @@ class LicenceCheckService {
* @return mixed|null
*/
protected static function getLastAjaxNotificationCheckTimestamp() {
$registry = GeneralUtility::makeInstance(Registry::class);
return $registry->get(self::REGISTRY_NAMESPACE, self::LAST_AJAX_TIMESTAMP_KEY);
return GeneralUtility::makeInstance(Registry::class)->get(
self::REGISTRY_NAMESPACE,
self::LAST_AJAX_TIMESTAMP_KEY
);
}
/**
......@@ -428,7 +439,7 @@ class LicenceCheckService {
]
);
self::$lastHttpResponseCode = (int)$response->getStatusCode();
self::$lastHttpResponseCode = (int) $response->getStatusCode();
if (self::$lastHttpResponseCode !== 200 && self::$lastHttpResponseCode !== 201) {
return FALSE;
......@@ -461,7 +472,7 @@ class LicenceCheckService {
]
);
self::$lastHttpResponseCode = (int)$response->getStatusCode();
self::$lastHttpResponseCode = (int) $response->getStatusCode();
if (self::$lastHttpResponseCode !== 200 && self::$lastHttpResponseCode !== 201) {
return self::ERROR_INVALID_RESPONSE_CODE;
......@@ -476,7 +487,7 @@ class LicenceCheckService {
return self::ERROR_INVALID_LICENSE_KEY;
}
return (int)$jsonData['serial']['validUntil'];
return (int) $jsonData['serial']['validUntil'];
} catch (\Exception $exception) {
self::$lastException = $exception->getMessage();
}
......@@ -490,15 +501,7 @@ class LicenceCheckService {
* @return bool
*/
public static function isInDevelopmentContext() {
$versionNumber = VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version());
if ($versionNumber >= 9000000) {
// Since TYPO3 9LTS
$context = \TYPO3\CMS\Core\Core\Environment::getContext();
} else {
// Prior to TYPO3 9LTS
$context = \TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext();
}
return $context->isDevelopment();
return \TYPO3\CMS\Core\Core\Environment::getContext()->isDevelopment();
}
/**
......@@ -507,7 +510,9 @@ class LicenceCheckService {
* @return bool
*/
public static function isTYPO3VersionSupported() {
$versionNumber = VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version());
$versionNumber = VersionNumberUtility::convertVersionNumberToInteger(
VersionNumberUtility::getCurrentTypo3Version()
);
return $versionNumber >= self::EARLIEST_SUPPORTED_VERSION;
}
......@@ -567,7 +572,8 @@ class LicenceCheckService {
$date = date('d.m.Y', self::getValidUntil());
if ($isAjaxCheck) {
$lastWarningTimestamp = (int)self::getLastWarningTimestamp(); // relevant only for the AJAX notifications
$lastWarningTimestamp = (int) self::getLastWarningTimestamp(
); // relevant only for the AJAX notifications
}
if (!$isAjaxCheck || ($lastWarningTimestamp + self::AMOUNT_OF_DAYS_UNTIL_WARNING * 24 * 60 * 60 < $GLOBALS['EXEC_TIME'])) {
......@@ -623,7 +629,7 @@ class LicenceCheckService {
return self::STATE_LICENSE_NOT_SET;
}
if ((bool)preg_match('/^([A-Z\d]{6}-?){4}$/', $key)) {
if ((bool) preg_match('/^([A-Z\d]{6}-?){4}$/', $key)) {
return self::STATE_LICENSE_VALID;
}
......@@ -645,7 +651,7 @@ class LicenceCheckService {
return FALSE;
}
if ((int)$demoData['amount'] > self::DEMO_MODE_MAX_AMOUNT) {
if ((int) $demoData['amount'] > self::DEMO_MODE_MAX_AMOUNT) {
return FALSE;
}
......@@ -675,7 +681,7 @@ class LicenceCheckService {
$amount = 1;
$demoData = self::getDemoModeData();
if ($demoData && isset($demoData['amount'])) {
$amount += (int)$demoData['amount'];
$amount += (int) $demoData['amount'];
}
$registry = GeneralUtility::makeInstance(Registry::class);
......@@ -696,7 +702,7 @@ class LicenceCheckService {
return TRUE;
}
return (int)$demoData['amount'] < self::DEMO_MODE_MAX_AMOUNT;
return (int) $demoData['amount'] < self::DEMO_MODE_MAX_AMOUNT;
}
/**
......
......@@ -30,8 +30,6 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
/**
* Class RenderSvgViewHelper
*
* @package SGalinski\SgYoutube\ViewHelpers
*/
class RenderSvgViewHelper extends AbstractTagBasedViewHelper {
/**
......@@ -61,7 +59,6 @@ class RenderSvgViewHelper extends AbstractTagBasedViewHelper {
$this->registerArgument('use', 'string', 'Inline CSS styles', FALSE);
}
/**
* Render the SVG file as an inline SVG element.
*
......@@ -81,7 +78,6 @@ class RenderSvgViewHelper extends AbstractTagBasedViewHelper {
$src = $path ?? $this->directoryPath . '/' . $name . '.svg';
// Get the content of the SVG file
$content = file_get_contents($src);
......@@ -118,19 +114,20 @@ class RenderSvgViewHelper extends AbstractTagBasedViewHelper {
$this->addOrReplaceAttribute($svg, 'title', $title);
}
// // Set the ID of the SVG element
// $svg->attributes()->id = $id;
// Extract the SVG contents
$contents = $this->getContents($svg, TRUE);
// Check if the SVG has already been rendered and use the <use> tag if possible
if ($this->viewHelperVariableContainer->exists('Vendor\\Extension\\ViewHelpers\\SvgViewHelper', 'svgIds')) {
$svgIds = $this->viewHelperVariableContainer->get('Vendor\\Extension\\ViewHelpers\\SvgViewHelper', 'svgIds');
$svgIds = $this->viewHelperVariableContainer->get(
'Vendor\\Extension\\ViewHelpers\\SvgViewHelper',
'svgIds'
);
if (isset($svgIds[$id])) {
$use = $svg->addChild('use');
$use->addAttribute('href', '#' . $id);
if ($use) {
$use->addAttribute('href', '#' . $id);
}
return $svg->asXML();
}
} else {
......@@ -150,28 +147,28 @@ class RenderSvgViewHelper extends AbstractTagBasedViewHelper {
return $svg->asXML();
//Todo: we don't really want this, do we?
if (!empty($width) && !empty($height)) {
$resultWithoutCssClass = str_replace($cssClass, '', $result);
$cssClasses = $this->processWrapperClasses($cssClassPlain);
return "<span $cssClasses style='width: $width; height: $height;'>$resultWithoutCssClass</span>";
}
if (!empty($width)) {
$resultWithoutCssClass = str_replace($cssClass, '', $result);
$cssClasses = $this->processWrapperClasses($cssClassPlain);
return "<span $cssClasses style='width: $width;'>$resultWithoutCssClass</span>";
}
if (!empty($height)) {
$resultWithoutCssClass = str_replace($cssClass, '', $result);
$cssClasses = $this->processWrapperClasses($cssClassPlain);
return "<span $cssClasses style='height: $height;'>$resultWithoutCssClass</span>";
}
return $result;
// if (!empty($width) && !empty($height)) {
// $resultWithoutCssClass = str_replace($cssClass, '', $result);
// $cssClasses = $this->processWrapperClasses($cssClassPlain);
//
// return "<span $cssClasses style='width: $width; height: $height;'>$resultWithoutCssClass</span>";
// }
//
// if (!empty($width)) {
// $resultWithoutCssClass = str_replace($cssClass, '', $result);
// $cssClasses = $this->processWrapperClasses($cssClassPlain);
//
// return "<span $cssClasses style='width: $width;'>$resultWithoutCssClass</span>";
// }
//
// if (!empty($height)) {
// $resultWithoutCssClass = str_replace($cssClass, '', $result);
// $cssClasses = $this->processWrapperClasses($cssClassPlain);
//
// return "<span $cssClasses style='height: $height;'>$resultWithoutCssClass</span>";
// }
//
// return $result;
}
/**
......@@ -230,7 +227,9 @@ class RenderSvgViewHelper extends AbstractTagBasedViewHelper {
$contents .= $child->asXML() . "\n";
if ($removeNode) {
$dom = dom_import_simplexml($child);
$dom->parentNode->removeChild($dom);
if ($dom) {
$dom->parentNode->removeChild($dom);
}
}
}
......@@ -245,7 +244,7 @@ class RenderSvgViewHelper extends AbstractTagBasedViewHelper {
* @return void
*/
private function xmlAdopt(\SimpleXMLElement $root, \SimpleXMLElement $newElement): void {
$node = $root->addChild($newElement->getName(), (string)$newElement);
$node = $root->addChild($newElement->getName(), (string) $newElement);
foreach ($newElement->attributes() as $attr => $value) {
/** @noinspection NullPointerExceptionInspection */
......@@ -268,8 +267,8 @@ class RenderSvgViewHelper extends AbstractTagBasedViewHelper {
*/
private function addOrReplaceAttribute(
\SimpleXMLElement $element,
string $attributeName,
string $attributeValue
string $attributeName,
string $attributeValue
): void {
if (isset($element[$attributeName])) {
$element[$attributeName] = $attributeValue; // Replace existing attribute value
......
......@@ -4,7 +4,7 @@
"description": "Embed YouTube Videos of a Playlist or Channel",
"homepage": "https://www.sgalinski.de",
"license": "GPL-2.0-or-later",
"version": "5.3.0",
"version": "6.0.0",
"require": {
"typo3/cms-core": "^10.4.0 || ^11.5.0 || ^12.4.0"
},
......
......@@ -35,7 +35,7 @@ $EM_CONF['sg_youtube'] = [
'internal' => '',
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '5.3.0',
'version' => '6.0.0',
'constraints' => [
'depends' => [
'typo3' => '10.4.0-12.4.99',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment