diff --git a/Classes/Controller/ConfigurationController.php b/Classes/Controller/ConfigurationController.php index ef71a37f8334ab36368cd6a58922395bd8b44068..9235c5477b663d3c714b236ba7accb50ce0fa1b3 100644 --- a/Classes/Controller/ConfigurationController.php +++ b/Classes/Controller/ConfigurationController.php @@ -43,7 +43,7 @@ use TYPO3\CMS\Extbase\Utility\LocalizationUtility; * Controller for the configuration mode of the backend module */ class ConfigurationController extends ActionController { - public const DEFAULT_EXTENSION_KEY = 'sg_mail'; + const DEFAULT_EXTENSION_KEY = 'sg_mail'; /** * DocHeaderComponent @@ -66,8 +66,9 @@ class ConfigurationController extends ActionController { * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException */ - public function indexAction($mode = 'new', $selectedTemplate = NULL, $selectedExtension = NULL, array $filters = [] - ): void { + public function indexAction( + $mode = 'new', $selectedTemplate = NULL, $selectedExtension = NULL, array $filters = [] + ) { if ($this->request->hasArgument('message')) { $this->addFlashMessage($this->request->getArgument('message'), '', FlashMessage::ERROR); } @@ -144,7 +145,7 @@ class ConfigurationController extends ActionController { * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException */ - public function createAction(): void { + public function createAction() { if (!$this->request->hasArgument('configuration')) { $this->redirect( 'index', 'Configuration', NULL, @@ -212,7 +213,7 @@ class ConfigurationController extends ActionController { * @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException */ - public function editAction(): void { + public function editAction() { if (!$this->request->hasArgument('configuration')) { $this->redirect( 'index', 'Configuration', NULL, @@ -284,7 +285,7 @@ class ConfigurationController extends ActionController { * @throws UnsupportedRequestTypeException * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException */ - public function deleteAction(string $selectedTemplate, string $selectedExtension): void { + public function deleteAction(string $selectedTemplate, string $selectedExtension) { $registerService = $this->objectManager->get(RegisterService::class); $registerService->deleteTemplate($selectedExtension, $selectedTemplate); $this->redirect( diff --git a/Classes/Controller/MailController.php b/Classes/Controller/MailController.php index 4891dc7269821cf22428ca03e4c6cb98ac5676be..f76b02c9c56b0f1ad97e1622836536fa6f4aa27b 100644 --- a/Classes/Controller/MailController.php +++ b/Classes/Controller/MailController.php @@ -65,7 +65,7 @@ class MailController extends ActionController { * * @param TemplateRepository $templateRepository */ - public function injectTemplateRepository(TemplateRepository $templateRepository): void { + public function injectTemplateRepository(TemplateRepository $templateRepository) { $this->templateRepository = $templateRepository; } @@ -91,7 +91,7 @@ class MailController extends ActionController { /** * @param ViewInterface $view */ - public function initializeView(ViewInterface $view): void { + public function initializeView(ViewInterface $view) { parent::initializeView($view); $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->addJsInlineCode( @@ -117,7 +117,7 @@ class MailController extends ActionController { * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException */ - public function indexAction(array $parameters = []): void { + public function indexAction(array $parameters = []) { if ($this->request->hasArgument('message')) { $this->addFlashMessage($this->request->getArgument('message'), '', FlashMessage::INFO); } @@ -319,7 +319,7 @@ class MailController extends ActionController { * @throws \BadFunctionCallException * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException */ - public function sendTestMailAction(array $parameters = []): void { + public function sendTestMailAction(array $parameters = []) { $arguments = []; if ($parameters['selectedExtension']) { $arguments['selectedExtension'] = $parameters['selectedExtension']; @@ -399,7 +399,7 @@ class MailController extends ActionController { /** * show a notice when no extension is registered */ - public function emptyAction(): void { + public function emptyAction() { } @@ -412,7 +412,7 @@ class MailController extends ActionController { * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException */ - public function resetAction($template, $extensionKey): void { + public function resetAction($template, $extensionKey) { $pid = (int) GeneralUtility::_GP('id'); $this->templateRepository->deleteTemplate($extensionKey, $template, $pid); diff --git a/Classes/Controller/QueueController.php b/Classes/Controller/QueueController.php index d764d4110338e00dd2dfdf3d467b3472bebe82f3..3e8c0ad02ebd1b2ae19ed88e2b140ea9a7d0ba8c 100644 --- a/Classes/Controller/QueueController.php +++ b/Classes/Controller/QueueController.php @@ -61,7 +61,7 @@ class QueueController extends ActionController { * * @param MailRepository $mailRepository */ - public function injectMailRepository(MailRepository $mailRepository): void { + public function injectMailRepository(MailRepository $mailRepository) { $this->mailRepository = $mailRepository; } @@ -73,7 +73,7 @@ class QueueController extends ActionController { /** * @param ViewInterface $view */ - public function initializeView(ViewInterface $view): void { + public function initializeView(ViewInterface $view) { parent::initializeView($view); $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->addJsInlineCode( @@ -98,7 +98,7 @@ class QueueController extends ActionController { * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException */ - public function indexAction($selectedTemplate = NULL, $selectedExtension = NULL, array $filters = []): void { + public function indexAction($selectedTemplate = NULL, $selectedExtension = NULL, array $filters = []) { $pageUid = (int) GeneralUtility::_GP('id'); if (!($this->session instanceof PhpSession)) { @@ -197,7 +197,7 @@ class QueueController extends ActionController { * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException */ - public function sendMailAction($uid): void { + public function sendMailAction($uid) { $mailService = new MailTemplateService(); if ($mailService->sendMailFromQueue($uid)) { $message = LocalizationUtility::translate('backend.success_mail_queue', 'sg_mail'); @@ -221,7 +221,7 @@ class QueueController extends ActionController { * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \InvalidArgumentException */ - public function exportAction(array $filters = []): void { + public function exportAction(array $filters = []) { $exportString = BackendService::getCsvFromQueue($filters); header('Content-Type: application/force-download'); diff --git a/Classes/Finisher/Forms/FormsFinisher.php b/Classes/Finisher/Forms/FormsFinisher.php index c8ff9c5bc256d356ddfe88321361f57040e9a4bf..b86d880f5e44a2ae3e68e38f984fcfddf8c5d637 100644 --- a/Classes/Finisher/Forms/FormsFinisher.php +++ b/Classes/Finisher/Forms/FormsFinisher.php @@ -42,7 +42,7 @@ class FormsFinisher extends AbstractFinisher { * * @var array */ - public const IGNORE_FIELDS = [ + const IGNORE_FIELDS = [ 'Honeypot', 'Hidden' ]; diff --git a/Classes/Service/BackendService.php b/Classes/Service/BackendService.php index afd3a00caf08f9e4501683096f13490e9828e04f..aa99b3a7fc56ddebbe8f695646cdd827dca6c24b 100644 --- a/Classes/Service/BackendService.php +++ b/Classes/Service/BackendService.php @@ -49,20 +49,20 @@ use TYPO3\CMS\Extbase\Utility\LocalizationUtility; */ class BackendService { // options for the queue search filter - public const SENDER_FILTER_OPTION = 0; - public const RECIPIENT_FILTER_OPTION = 1; - public const SUBJECT_FILTER_OPTION = 2; - public const MAILTEXT_FILTER_OPTION = 3; - public const CC_FILTER_OPTION = 4; - public const BCC_FILTER_OPTION = 5; - public const FROM_NAME_FILTER_OPTION = 6; - public const REPLY_TO_NAME_FILTER_OPTION = 7; + const SENDER_FILTER_OPTION = 0; + const RECIPIENT_FILTER_OPTION = 1; + const SUBJECT_FILTER_OPTION = 2; + const MAILTEXT_FILTER_OPTION = 3; + const CC_FILTER_OPTION = 4; + const BCC_FILTER_OPTION = 5; + const FROM_NAME_FILTER_OPTION = 6; + const REPLY_TO_NAME_FILTER_OPTION = 7; // constants for deetermining the backend mode - public const BACKEND_MODE_EDITOR = 'editor'; - public const BACKEND_MODE_EDITOR_CONTROLLER = 'Mail'; - public const BACKEND_MODE_QUEUE = 'queue'; - public const BACKEND_MODE_QUEUE_CONTROLLER = 'Queue'; + const BACKEND_MODE_EDITOR = 'editor'; + const BACKEND_MODE_EDITOR_CONTROLLER = 'Mail'; + const BACKEND_MODE_QUEUE = 'queue'; + const BACKEND_MODE_QUEUE_CONTROLLER = 'Queue'; /** * Get all pages the be user has access to @@ -122,7 +122,7 @@ class BackendService { * @throws \InvalidArgumentException * @throws \UnexpectedValueException */ - public static function makeButtons($docHeaderComponent, $request): void { + public static function makeButtons($docHeaderComponent, $request) { /** @var ButtonBar $buttonBar */ $buttonBar = $docHeaderComponent->getButtonBar(); @@ -450,7 +450,7 @@ class BackendService { $currentSiteBlacklist = GeneralUtility::trimExplode(',', $currentSite, TRUE); if ((int) $currentSiteBlacklist[0] === $siteRootId) { foreach ($currentSiteBlacklist as $excludedTemplate) { - [$extensionKey, $templateName] = GeneralUtility::trimExplode('.', $excludedTemplate); + list($extensionKey, $templateName) = GeneralUtility::trimExplode('.', $excludedTemplate); if ($extensionKey && $templateName && isset($registerArray[$extensionKey][$templateName])) { unset($registerArray[$extensionKey][$templateName]); } @@ -467,7 +467,7 @@ class BackendService { ',', $extensionConfiguration['excludeTemplatesAllDomains'], TRUE ); foreach ($excludedTemplates as $excludedTemplate) { - [$extensionKey, $templateName] = GeneralUtility::trimExplode('.', $excludedTemplate); + list($extensionKey, $templateName) = GeneralUtility::trimExplode('.', $excludedTemplate); if ($extensionKey && $templateName && isset($registerArray[$extensionKey][$templateName])) { unset($registerArray[$extensionKey][$templateName]); } diff --git a/Classes/Service/MailTemplateService.php b/Classes/Service/MailTemplateService.php index bd41f47d369021d8ab68e24de3d7bcb9c211e11c..103c35084666e365562753cf8bbd922e6a41814a 100644 --- a/Classes/Service/MailTemplateService.php +++ b/Classes/Service/MailTemplateService.php @@ -52,16 +52,16 @@ use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; * MailTemplateService */ class MailTemplateService { - public const MARKER_TYPE_STRING = 'String'; - public const MARKER_TYPE_ARRAY = 'Array'; - public const MARKER_TYPE_OBJECT = 'Object'; - public const MARKER_TYPE_FILE = 'File'; - public const DEFAULT_LANGUAGE = 'default'; - public const DEFAULT_TEMPLATE_PATH = 'Resources/Private/Templates/SgMail/'; - public const CACHE_NAME = 'sg_mail_registerArrayCache'; - public const CACHE_LIFETIME_IN_SECONDS = 86400; - public const REGISTER_FILE = 'Register.php'; - public const CONFIG_PATH = 'Configuration/MailTemplates'; + const MARKER_TYPE_STRING = 'String'; + const MARKER_TYPE_ARRAY = 'Array'; + const MARKER_TYPE_OBJECT = 'Object'; + const MARKER_TYPE_FILE = 'File'; + const DEFAULT_LANGUAGE = 'default'; + const DEFAULT_TEMPLATE_PATH = 'Resources/Private/Templates/SgMail/'; + const CACHE_NAME = 'sg_mail_registerArrayCache'; + const CACHE_LIFETIME_IN_SECONDS = 86400; + const REGISTER_FILE = 'Register.php'; + const CONFIG_PATH = 'Configuration/MailTemplates'; /** * @var string $toAddresses @@ -243,7 +243,7 @@ class MailTemplateService { /** * @param string $fromName */ - public function setFromName($fromName): void { + public function setFromName($fromName) { $this->fromName = $fromName; } @@ -252,7 +252,7 @@ class MailTemplateService { * * @param string $markerType */ - public static function getReadableMarkerType($markerType): void { + public static function getReadableMarkerType($markerType) { switch ($markerType) { case self::MARKER_TYPE_STRING : LocalizationUtility::translate('backend.marker.type.string', 'sg_mail'); @@ -516,7 +516,7 @@ class MailTemplateService { /** * @param string $subject */ - public function setSubject(string $subject): void { + public function setSubject(string $subject) { $this->subject = $subject; } @@ -530,7 +530,7 @@ class MailTemplateService { /** * @param string $overwrittenEmailBody */ - public function setOverwrittenEmailBody(string $overwrittenEmailBody): void { + public function setOverwrittenEmailBody(string $overwrittenEmailBody) { $this->overwrittenEmailBody = $overwrittenEmailBody; } @@ -897,12 +897,12 @@ class MailTemplateService { * Send a Mail from the queue, identified by its id * * @param int $uid - * @return bool + * @return bool|NULL * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException * @throws \Exception */ - public function sendMailFromQueue($uid): ?bool { + public function sendMailFromQueue($uid): bool { $mailRepository = $this->objectManager->get(MailRepository::class); /** @var Mail $mailToSend */ $mailToSend = $mailRepository->findOneByUid($uid); @@ -965,7 +965,7 @@ class MailTemplateService { * * @param Template $template */ - private function loadTemplateValues($template): void { + private function loadTemplateValues($template) { $fromName = \trim($template->getFromName()); if ($fromName === '') { $fromName = $this->fromName; diff --git a/Classes/Service/RegisterService.php b/Classes/Service/RegisterService.php index 0bb10eb4d521147d78ffe0c7cb361278d433d88c..8f32de8c5c442c64d3800861ec0a75082bc13f7d 100644 --- a/Classes/Service/RegisterService.php +++ b/Classes/Service/RegisterService.php @@ -39,10 +39,10 @@ use TYPO3\CMS\Extbase\Object\ObjectManager; * Provides an api for registering your mail templates */ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { - public const CACHE_NAME = 'sg_mail_registerArrayCache'; - public const CACHE_LIFETIME_IN_SECONDS = 86400; - public const DEFAULT_TEMPLATE_PATH = 'Resources/Private/Templates/SgMail/'; - public const CONFIG_PATH = 'Configuration/MailTemplates/Forms'; + const CACHE_NAME = 'sg_mail_registerArrayCache'; + const CACHE_LIFETIME_IN_SECONDS = 86400; + const DEFAULT_TEMPLATE_PATH = 'Resources/Private/Templates/SgMail/'; + const CONFIG_PATH = 'Configuration/MailTemplates/Forms'; /** * contains the actual registration data @@ -159,7 +159,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { */ private function writeRegisterArrayEntry( $extensionKey, $templateKey, array $configArray - ): void { + ) { // template_path means where to find the mail body content (usually it's set directly in the registration // as template_content) $templatePath = ''; @@ -215,7 +215,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { * * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException */ - public function clearCaches(): void { + public function clearCaches() { $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $cacheManager = $objectManager->get(CacheManager::class); @@ -278,7 +278,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { * * @param string $templateKey */ - public function deleteRegisterFile($templateKey): void { + public function deleteRegisterFile($templateKey) { $configurationLocation = $this->getRegistrationPath(); $registerFolder = GeneralUtility::getFileAbsFileName($configurationLocation); GeneralUtility::mkdir_deep($registerFolder); @@ -306,7 +306,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { * Register the caches for the RegisterService * This method is for usage in ext_localconf.php to register the cache configuration */ - public function registerCache(): void { + public function registerCache() { $cacheConfigurations = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']; if (!isset($cacheConfigurations[self::CACHE_NAME])) { $cacheConfigurations[self::CACHE_NAME] = [ @@ -406,7 +406,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface { public function migrateTemplateEntries( string $oldTemplateName, string $oldExtensionKey, string $newTemplateName, string $newExtensionKey - ): void { + ) { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable( 'tx_sgmail_domain_model_template' ); diff --git a/Classes/Session/PhpSession.php b/Classes/Session/PhpSession.php index 331659ec62473f43fe803e4552f81ca1a8ff16cb..c497cd150bb68d280c422fb337fa09092169e6b2 100644 --- a/Classes/Session/PhpSession.php +++ b/Classes/Session/PhpSession.php @@ -49,7 +49,7 @@ class PhpSession implements SingletonInterface { * @param string $sessionKey * @return void */ - public function setSessionKey($sessionKey): void { + public function setSessionKey($sessionKey) { $this->sessionKey = $sessionKey; } @@ -68,7 +68,7 @@ class PhpSession implements SingletonInterface { * @param mixed $data * @return void */ - public function exchangeData($data): void { + public function exchangeData($data) { $this->destroy(); $_SESSION[$this->sessionKey] = $data; } @@ -89,7 +89,7 @@ class PhpSession implements SingletonInterface { * @param mixed $data * @return void */ - public function setDataByKey($key, $data): void { + public function setDataByKey($key, $data) { $_SESSION[$this->sessionKey][$key] = $data; } @@ -109,7 +109,7 @@ class PhpSession implements SingletonInterface { * @param string $key * @return void */ - public function unsetDataByKey($key): void { + public function unsetDataByKey($key) { unset($_SESSION[$this->sessionKey][$key]); } @@ -118,7 +118,7 @@ class PhpSession implements SingletonInterface { * * @return void */ - public function destroy(): void { + public function destroy() { unset($_SESSION[$this->sessionKey]); } } diff --git a/Classes/XClass/Form/FormEditorController.php b/Classes/XClass/Form/FormEditorController.php index 56e4faf30214988a10db0be0bb2f0ea40be1c924..e7286a4eca993ef3e0e60aed1f954099b066c00f 100644 --- a/Classes/XClass/Form/FormEditorController.php +++ b/Classes/XClass/Form/FormEditorController.php @@ -176,13 +176,17 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll */ private static function getFormFieldsRecursive($formData = []) { $out = []; + $renderables = []; foreach ($formData as $formElement) { if (isset($formElement['renderables'])) { - $out = \array_merge($out, self::getFormFieldsRecursive($formElement['renderables'])); + $renderables[] = self::getFormFieldsRecursive($formElement['renderables']); } elseif (!\in_array($formElement['type'], self::IGNORE_FIELDS, TRUE)) { $out[] = $formElement; } } + if (count($renderables)) { + $out = \array_merge($out, ...$renderables); + } return $out; } }