Commit 0a9705ab authored by Stefan Galinski's avatar Stefan Galinski 🎮
Browse files

[FEATURE] PHP 8 Compatibility

parent cd000c9e
......@@ -433,6 +433,7 @@ class OptinController extends ActionController {
$newOptinId = $dataHandler->substNEWwithIDs[$newOptinKey];
$this->redirectToTCAEdit((int) $newOptinId);
$this->redirect('index');
}
/**
......
......@@ -73,42 +73,62 @@ class HandleTemplateAfterTcaSave {
}
$templateService = GeneralUtility::makeInstance(TemplateService::class);
foreach ($dataHandler->datamap[self::TABLE_NAME] as $uid => $data) {
if ((boolean) $data['template_overwritten']) {
foreach ($dataHandler->datamap[self::TABLE_NAME] as $data) {
if (isset($data['template_overwritten']) && $data['template_overwritten']) {
$template = $data['template_html'];
} else {
if (!isset($data['template_selection'])) {
$data['template_selection'] = 0;
}
$template = $templateService->getMustacheContent(
TemplateService::TYPE_TEMPLATE, (int) $data['template_selection']
);
}
if ((boolean) $data['banner_overwritten']) {
if (isset($data['banner_overwritten']) && $data['banner_overwritten']) {
$bannerTemplate = $data['banner_html'];
} else {
if (!isset($data['banner_selection'])) {
$data['banner_selection'] = 0;
}
$bannerTemplate = $templateService->getMustacheContent(
TemplateService::TYPE_BANNER, (int) $data['banner_selection']
);
}
if ((boolean) $data['iframe_overwritten']) {
if (isset($data['iframe_overwritten']) && $data['iframe_overwritten']) {
$iframeTemplate = $data['iframe_html'];
} else {
if (!isset($data['iframe_selection'])) {
$data['iframe_selection'] = 0;
}
$iframeTemplate = $templateService->getMustacheContent(
TemplateService::TYPE_IFRAME, (int) $data['iframe_selection']
);
}
if ((boolean) $data['iframe_replacement_overwritten']) {
if (isset($data['iframe_replacement_overwritten']) && $data['iframe_replacement_overwritten']) {
$iframeReplacementTemplate = $data['iframe_replacement_html'];
} else {
if (!isset($data['iframe_replacement_selection'])) {
$data['iframe_replacement_selection'] = 0;
}
$iframeReplacementTemplate = $templateService->getMustacheContent(
TemplateService::TYPE_IFRAME_REPLACEMENT, (int) $data['iframe_replacement_selection']
);
}
if ((boolean) $data['iframe_whitelist_overwritten']) {
if (isset($data['iframe_whitelist_overwritten']) && $data['iframe_whitelist_overwritten']) {
$iframeWhitelistTemplate = $data['iframe_whitelist_regex'];
} else {
if (!isset($data['iframe_whitelist_selection'])) {
$data['iframe_whitelist_selection'] = 0;
}
$iframeWhitelistTemplate = $templateService->getMustacheContent(
TemplateService::TYPE_IFRAME_WHITELIST, (int) $data['iframe_whitelist_selection']
);
......
......@@ -54,7 +54,7 @@ class HandleVersionChange {
$id,
DataHandler $dataHandler
) {
if ((bool) $fieldArray['update_version_checkbox']) {
if (isset($fieldArray['update_version_checkbox']) && $fieldArray['update_version_checkbox']) {
$id = (int) $id;
$currentVersion = VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
$sqlQuery = "UPDATE $table SET version = version + 1 WHERE uid = $id OR l10n_parent = $id";
......
......@@ -44,7 +44,6 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
use TYPO3\CMS\Frontend\Page\PageGenerator;
/**
* Class SGalinski\SgCookieOptin\Service\TemplateService
*/
......@@ -76,10 +75,9 @@ class StaticFileGenerationService implements SingletonInterface {
* @throws \TYPO3\CMS\Core\Http\ImmediateResponseException
*/
public function generateFiles(int $siteRootId, $originalRecord) {
if (!LicenceCheckService::isInDevelopmentContext()
&& !LicenceCheckService::isInDemoMode()
&& !LicenceCheckService::hasValidLicense()
&& !LicenceCheckService::isInDemoMode()
&& !LicenceCheckService::hasValidLicense()
) {
return;
}
......@@ -204,11 +202,11 @@ class StaticFileGenerationService implements SingletonInterface {
$translatedRecord = $originalRecord;
if ($languageUid > 0) {
if ($currentVersion >= 11000000) {
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
} else {
$pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
}
if ($currentVersion >= 11000000) {
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
} else {
$pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
}
$translatedRecord = $pageRepository->getRecordOverlay(self::TABLE_NAME, $originalRecord, $languageUid);
}
......@@ -225,8 +223,10 @@ class StaticFileGenerationService implements SingletonInterface {
GeneralUtility::fixPermissions($sitePath . $folder, TRUE);
// reset the TSFE to it's previous state to not influence remaining code
$GLOBALS['TSFE'] = $originalTSFE;
if ($currentVersion < 9000000) {
// reset the TSFE to it's previous state to not influence remaining code
$GLOBALS['TSFE'] = $originalTSFE;
}
}
/**
......@@ -298,7 +298,10 @@ class StaticFileGenerationService implements SingletonInterface {
return [];
}
$tableColumn = $tableData['columns'][$field];
$tableColumn = NULL;
if (isset($tableData['columns'][$field])) {
$tableColumn = $tableData['columns'][$field];
}
if (!is_array($tableColumn)) {
return [];
}
......
......@@ -104,13 +104,10 @@ class TemplateService implements SingletonInterface {
*
* @param int $type
* @param int $templateId
*
* @return string
*/
public function getMustacheContent($type, $templateId) {
if (
!isset(self::$templateIdToFolderMap[$type], self::$templateIdToNameMap[$type][$templateId])
) {
if (!isset(self::$templateIdToFolderMap[$type], self::$templateIdToNameMap[$type][$templateId])) {
return '';
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment