diff --git a/Classes/Backend/EventListener/PreviewEventListener.php b/Classes/Backend/EventListener/PreviewEventListener.php index 7a6a3db..068933e 100644 --- a/Classes/Backend/EventListener/PreviewEventListener.php +++ b/Classes/Backend/EventListener/PreviewEventListener.php @@ -18,19 +18,19 @@ final class PreviewEventListener * * @var string */ - const KEY = 'fpnewsletter'; + public const KEY = 'fpnewsletter'; /** * Path to the locallang file * * @var string */ - const LLPATH = 'LLL:EXT:fp_newsletter/Resources/Private/Language/locallang_be.xlf:'; + public const LLPATH = 'LLL:EXT:fp_newsletter/Resources/Private/Language/locallang_be.xlf:'; /** * Max shown settings */ - const SETTINGS_IN_PREVIEW = 10; + public const SETTINGS_IN_PREVIEW = 10; protected $recordMapping = [ 'subscribeUid' => [ @@ -117,8 +117,8 @@ public function __invoke(PageContentPreviewRenderingEvent $event): void } if ($event->getRecord()['CType'] === 'list' && in_array($event->getRecord()['list_type'], $this->pis)) { - $pi = substr($event->getRecord()['list_type'], strpos($event->getRecord()['list_type'], '_')+1); - $header = '' . htmlspecialchars($this->getLanguageService()->sL(self::LLPATH . 'template.' . $pi)) . ''; + $pi = substr((string) $event->getRecord()['list_type'], strpos((string) $event->getRecord()['list_type'], '_')+1); + $header = '' . htmlspecialchars((string) $this->getLanguageService()->sL(self::LLPATH . 'template.' . $pi)) . ''; $this->flexformData = GeneralUtility::xml2array($event->getRecord()['pi_flexform']); $this->getStartingPoint($event->getRecord()['pages']); diff --git a/Classes/Command/ImportFEUsersScheduler.php b/Classes/Command/ImportFEUsersScheduler.php index b28007f..b05377e 100644 --- a/Classes/Command/ImportFEUsersScheduler.php +++ b/Classes/Command/ImportFEUsersScheduler.php @@ -2,6 +2,9 @@ declare(strict_types = 1); namespace Fixpunkt\FpNewsletter\Command; +use TYPO3\CMS\Core\Crypto\Random; +use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory; +use TYPO3\CMS\Core\Database\ConnectionPool; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -55,15 +58,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int $group = intval($input->getArgument('group')); $password = $input->getArgument('password'); if ($password == 'random') { - $password = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Crypto\Random::class)->generateRandomBytes(20); + $password = GeneralUtility::makeInstance(Random::class)->generateRandomBytes(20); } - $hashInstance = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory::class)->getDefaultHashInstance('FE'); + $hashInstance = GeneralUtility::makeInstance(PasswordHashFactory::class)->getDefaultHashInstance('FE'); $hashedPassword = $hashInstance->getHashedPassword($password); $addresses = []; $count = 0; // Alle tt_address-Elemente holen - $connection = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getConnectionForTable('tt_address'); + $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tt_address'); $queryBuilder = $connection->createQueryBuilder(); if ($pid) { $statement = $queryBuilder->select('*')->from('tt_address')->where( @@ -83,9 +86,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $affectedRows = $queryBuilder ->insert('fe_users') ->values([ - 'name' => (($address['name']) ? trim($address['name']) : ''), - 'first_name' => (($address['first_name']) ? trim($address['first_name']) : ''), - 'last_name' => (($address['last_name']) ? trim($address['last_name']) : ''), + 'name' => (($address['name']) ? trim((string) $address['name']) : ''), + 'first_name' => (($address['first_name']) ? trim((string) $address['first_name']) : ''), + 'last_name' => (($address['last_name']) ? trim((string) $address['last_name']) : ''), 'email' => $address['email'], 'username' => $address['email'], 'password' => $hashedPassword, @@ -93,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int 'description' => 'Imported by fp_newsletter', 'pid' => $pid, 'tstamp' => $address['tstamp'], - 'crdate' => (($address['crdate']) ? $address['crdate'] : $address['tstamp']) + 'crdate' => ($address['crdate'] ?: $address['tstamp']) ]) ->executeStatement(); $count++; diff --git a/Classes/Controller/LogController.php b/Classes/Controller/LogController.php index c13d8c6..6b84628 100644 --- a/Classes/Controller/LogController.php +++ b/Classes/Controller/LogController.php @@ -4,7 +4,10 @@ namespace Fixpunkt\FpNewsletter\Controller; -use Fixpunkt\FpNewsletter\Events\ValidateEvent; +use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; +use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; +use TYPO3\CMS\Extbase\Http\ForwardResponse; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Http\RequestFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -35,15 +38,9 @@ class LogController extends ActionController { - protected FrontendUserRepository $frontendUserRepository; - - protected LogRepository $logRepository; - - protected HelpersUtility $helpersUtility; - /** * - * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface + * @var ConfigurationManagerInterface */ protected $configurationManager; @@ -53,14 +50,8 @@ class LogController extends ActionController * @param LogRepository $logRepository * @param HelpersUtility $helpersUtility */ - public function __construct( - FrontendUserRepository $frontendUserRepository, - LogRepository $logRepository, - HelpersUtility $helpersUtility - ) { - $this->frontendUserRepository = $frontendUserRepository; - $this->logRepository = $logRepository; - $this->helpersUtility = $helpersUtility; + public function __construct(protected FrontendUserRepository $frontendUserRepository, protected LogRepository $logRepository, protected HelpersUtility $helpersUtility) + { } /** @@ -69,11 +60,11 @@ public function __construct( public function initializeAction() { $tsSettings = $this->configurationManager->getConfiguration( - \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT + ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT ); $tsSettings = $tsSettings['plugin.']['tx_fpnewsletter.']['settings.']; $originalSettings = $this->configurationManager->getConfiguration( - \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS + ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS ); // if flexform setting is empty and value is available in TS $overrideFlexformFields = GeneralUtility::trimExplode(',', $tsSettings['overrideFlexformSettingsIfEmpty'], true); @@ -121,14 +112,14 @@ public function newAction(Log $log = null, int $error = 0, string $error_msg = n $optionalFields = $this->settings['optionalFields']; $requiredFields = $this->settings['optionalFieldsRequired']; if ($optionalFields) { - $tmp = explode(',', $optionalFields); + $tmp = explode(',', (string) $optionalFields); foreach ($tmp as $field) { $optional[trim($field)] = 1; $required[trim($field)] = 0; } } if ($requiredFields) { - $tmp = explode(',', $requiredFields); + $tmp = explode(',', (string) $requiredFields); foreach ($tmp as $field) { $required[trim($field)] = 1; } @@ -142,12 +133,12 @@ public function newAction(Log $log = null, int $error = 0, string $error_msg = n } } if (! $log) { - $log = GeneralUtility::makeInstance('Fixpunkt\\FpNewsletter\\Domain\\Model\\Log'); + $log = GeneralUtility::makeInstance(Log::class); } if (!$log->getEmail() && $this->settings['parameters']['email']) { - $email = isset($_GET[$this->settings['parameters']['email']]) ? $_GET[$this->settings['parameters']['email']] : ''; + $email = $_GET[$this->settings['parameters']['email']] ?? ''; if (! $email) { - $email = isset($_POST[$this->settings['parameters']['email']]) ? $_POST[$this->settings['parameters']['email']] : ''; + $email = $_POST[$this->settings['parameters']['email']] ?? ''; } if ($email) { $log->setEmail($email); @@ -166,11 +157,11 @@ public function newAction(Log $log = null, int $error = 0, string $error_msg = n $GLOBALS['TSFE']->fe_user->storeSessionData(); } if (!$error && $this->settings['checkForRequiredExtensions'] && $this->settings['table']=='tt_address') { - if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tt_address')) { + if (!ExtensionManagementUtility::isLoaded('tt_address')) { $error = 20; } if ((intval($this->settings['html'])>-1 || $this->settings['categoryOrGroup']) - && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('mail')) { + && !ExtensionManagementUtility::isLoaded('mail')) { $error = 21; } } @@ -196,14 +187,14 @@ public function formAction(): ResponseInterface $optionalFields = $this->settings['optionalFields']; $requiredFields = $this->settings['optionalFieldsRequired']; if ($optionalFields) { - $tmp = explode(',', $optionalFields); + $tmp = explode(',', (string) $optionalFields); foreach ($tmp as $field) { $optional[trim($field)] = 1; $required[trim($field)] = 0; } } if ($requiredFields) { - $tmp = explode(',', $requiredFields); + $tmp = explode(',', (string) $requiredFields); foreach ($tmp as $field) { $required[trim($field)] = 1; } @@ -234,6 +225,9 @@ public function resendAction(): ResponseInterface $storagePidsArray = $this->logRepository->getStoragePids(); $languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); $sys_language_uid = intval($languageAspect->getId()); + $requestLanguage = $this->request->getAttribute('language'); + $requestLocale = $requestLanguage->getLocale(); + $requestLanguageCode = $requestLocale->getLanguageCode(); if ($sys_language_uid > 0 && $this->settings['languageMode']) { $log = $this->logRepository->getByEmailAndPid($email, $storagePidsArray, $sys_language_uid, $maxDate); } else { @@ -245,7 +239,7 @@ public function resendAction(): ResponseInterface } else { $pi = 'verify'; } - $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), true, false, false,true, false, $log->getSecurityhash(), intval($subscribeVerifyUid), $pi); + $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), true, false, false,true, false, $log->getSecurityhash(), intval($subscribeVerifyUid), $pi, $requestLanguageCode); } } $this->view->assign('email', $email); @@ -275,16 +269,19 @@ public function editEmailAction(): ResponseInterface if (!$dbuidext) { $error = 7; } else { - $log = GeneralUtility::makeInstance('Fixpunkt\\FpNewsletter\\Domain\\Model\\Log'); + $log = GeneralUtility::makeInstance(Log::class); $log->setPid($pid); $log->setEmail($email); $hash = $this->helpersUtility->setHashAndLanguage($log, intval($this->settings['languageMode'])); + $requestLanguage = $this->request->getAttribute('language'); + $requestLocale = $requestLanguage->getLocale(); + $requestLanguageCode = $requestLocale->getLanguageCode(); $log->setStatus(10); $this->logRepository->add($log); - $persistenceManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); + $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); $persistenceManager->persistAll(); $error = 51; - $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), false, false, true,true, false, $hash, intval($this->settings['editUid']), 'email'); + $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), false, false, true,true, false, $hash, intval($this->settings['editUid']), 'email', $requestLanguageCode); // reset log entry $log = null; } @@ -324,14 +321,14 @@ public function editAction(): ResponseInterface $optionalFields = $this->settings['optionalFields']; $requiredFields = $this->settings['optionalFieldsRequired']; if ($optionalFields) { - $tmp = explode(',', $optionalFields); + $tmp = explode(',', (string) $optionalFields); foreach ($tmp as $field) { $optional[trim($field)] = 1; $required[trim($field)] = 0; } } if ($requiredFields) { - $tmp = explode(',', $requiredFields); + $tmp = explode(',', (string) $requiredFields); foreach ($tmp as $field) { $required[trim($field)] = 1; } @@ -410,11 +407,11 @@ public function editAction(): ResponseInterface } } elseif ($table == 'fe_users') { $groups = $this->logRepository->getAllGroups($catOrderBy); - $own_groups = explode(',', $user['usergroup']); + $own_groups = explode(',', (string) $user['usergroup']); } if (!$this->settings['categoryMode']) { // nur angegebene Kategorien erlauben - $dmCat = str_replace(' ', '', $this->settings['categoryOrGroup']); + $dmCat = str_replace(' ', '', (string) $this->settings['categoryOrGroup']); $dmCatArr = explode(',', $dmCat); foreach ($groups as $key => $array) { if (!in_array($array['uid'], $dmCatArr)) { @@ -445,7 +442,6 @@ public function editAction(): ResponseInterface /** * action update * - * @param Log $log * @return ResponseInterface */ public function updateAction(Log $log): ResponseInterface @@ -500,20 +496,20 @@ public function updateAction(Log $log): ResponseInterface public function subscribeExtAction(): ResponseInterface { if ($this->settings['parameters']['active'] && $this->settings['parameters']['email']) { - $pactive = explode('|', $this->settings['parameters']['active']); - $active = isset($_POST[$pactive[0]]) ? $_POST[$pactive[0]] : array(); + $pactive = explode('|', (string) $this->settings['parameters']['active']); + $active = $_POST[$pactive[0]] ?? []; if ($active[$pactive[1]][$pactive[2]]) { - $pemail = explode('|', $this->settings['parameters']['email']); - $email = isset($_POST[$pemail[0]]) ? $_POST[$pemail[0]] : array(); + $pemail = explode('|', (string) $this->settings['parameters']['email']); + $email = $_POST[$pemail[0]] ?? []; $email = $email[$pemail[1]][$pemail[2]]; if ($email) { $storagePidsArray = $this->logRepository->getStoragePids(); $pid = intval($storagePidsArray[0]); - $log = GeneralUtility::makeInstance('Fixpunkt\\FpNewsletter\\Domain\\Model\\Log'); + $log = GeneralUtility::makeInstance(Log::class); $log->setPid($pid); $log->setEmail($email); $log->setGdpr(true); - return (new \TYPO3\CMS\Extbase\Http\ForwardResponse('create')) + return (new ForwardResponse('create')) ->withControllerName('Log') ->withExtensionName('fp_newsletter') ->withArguments(['log' => $log]); @@ -539,6 +535,9 @@ public function createAction(Log $log = null): ResponseInterface ->withHeader('Location', $uri); } //if ($log->getGdpr()) { $log->setGdpr(true); } + $requestLanguage = $this->request->getAttribute('language'); + $requestLocale = $requestLanguage->getLocale(); + $requestLanguageCode = $requestLocale->getLanguageCode(); $hash = $this->helpersUtility->setHashAndLanguage($log, intval($this->settings['languageMode'])); $log->setStatus(0); if ($log->getUid() > 0) { @@ -546,7 +545,7 @@ public function createAction(Log $log = null): ResponseInterface } else { $this->logRepository->add($log); } - $persistenceManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); + $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); $persistenceManager->persistAll(); $error = 0; @@ -578,7 +577,7 @@ public function createAction(Log $log = null): ResponseInterface $request = $requestFactory->request($url, 'POST', $additionalOptions); if ($request->getStatusCode() === 200) { - $resultBody = json_decode($request->getBody()->getContents(), true); + $resultBody = json_decode((string) $request->getBody()->getContents(), true); if (!$resultBody['success']) $error = 9; @@ -597,7 +596,7 @@ public function createAction(Log $log = null): ResponseInterface $error = 10; } $error_msg = ''; - $customValidatorEvent = GeneralUtility::makeInstance(ValidateEvent::class); + $customValidatorEvent = GeneralUtility::makeInstance(\Fixpunkt\FpNewsletter\Events\ValidateEvent::class); if(!$customValidatorEvent->isValid()) { $error = 901; $error_msg = $customValidatorEvent->getMessage(); @@ -618,7 +617,7 @@ public function createAction(Log $log = null): ResponseInterface } else { $pi = 'verify'; } - $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), true, false, false,true, $toAdmin, $hash, intval($subscribeVerifyUid), $pi); + $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), true, false, false,true, $toAdmin, $hash, intval($subscribeVerifyUid), $pi, $requestLanguageCode); } else if ($error >= 8) { $uri = $this->uriBuilder->uriFor('new', [ 'log' => $log, @@ -667,7 +666,7 @@ public function unsubscribeAction(Log $log = null, int $error = 0): ResponseInte } } if (! $log) { - $log = GeneralUtility::makeInstance('Fixpunkt\\FpNewsletter\\Domain\\Model\\Log'); + $log = GeneralUtility::makeInstance(Log::class); $log->setPid($pid); // default E-Mail holen, falls log noch nicht definiert ist; default email from unsubscribeLuxAction $email = $this->request->hasArgument('defaultEmail') ? $this->request->getArgument('defaultEmail') : ''; @@ -734,8 +733,8 @@ public function unsubscribeLuxAction(): ResponseInterface is_array($newsletterArray) && isset($newsletterArray['receivers'])) { // ist user in versendeter newsletter-Gruppe? $match = false; - $usergroups = explode(",", $userArray['usergroup']); - $receivers = explode(",", $newsletterArray['receivers']); + $usergroups = explode(",", (string) $userArray['usergroup']); + $receivers = explode(",", (string) $newsletterArray['receivers']); foreach ($usergroups as $group) { foreach ($receivers as $receiver) { if ($group == $receiver) { @@ -899,7 +898,7 @@ public function deleteAction(Log $log = null, array $user = []): ResponseInterfa } } elseif (isset($user['email'])) { // we came from unsubscribeLuxAction: an email and session must be present too! - $log = GeneralUtility::makeInstance('Fixpunkt\\FpNewsletter\\Domain\\Model\\Log'); + $log = GeneralUtility::makeInstance(Log::class); $log->setEmail($user['email']); $log->setPid(intval($user['pid'])); $checkSession = true; @@ -913,6 +912,9 @@ public function deleteAction(Log $log = null, array $user = []): ResponseInterfa $pid = intval($storagePidsArray[0]); } // zum testen: var_dump ($storagePidsArray); + $requestLanguage = $this->request->getAttribute('language'); + $requestLocale = $requestLanguage->getLocale(); + $requestLanguageCode = $requestLocale->getLanguageCode(); $hash = $this->helpersUtility->setHashAndLanguage($log, intval($this->settings['languageMode'])); $dbuidext = 0; @@ -992,7 +994,7 @@ public function deleteAction(Log $log = null, array $user = []): ResponseInterfa $request = $requestFactory->request($url, 'POST', $additionalOptions); if ($request->getStatusCode() === 200) { - $resultBody = json_decode($request->getBody()->getContents(), true); + $resultBody = json_decode((string) $request->getBody()->getContents(), true); if (!$resultBody['success']) $error = 9; @@ -1021,7 +1023,7 @@ public function deleteAction(Log $log = null, array $user = []): ResponseInterfa } else { $this->logRepository->add($log); } - $persistenceManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); + $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); $persistenceManager->persistAll(); } @@ -1041,7 +1043,7 @@ public function deleteAction(Log $log = null, array $user = []): ResponseInterfa $this->logRepository->update($log); $persistenceManager->persistAll(); $toAdmin = ($this->settings['email']['adminMail'] && $this->settings['email']['adminMailBeforeVerification']); - $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), false, false, false, true, $toAdmin, $hash, $unsubscribeVerifyUid, $pi); + $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), false, false, false, true, $toAdmin, $hash, $unsubscribeVerifyUid, $pi, $requestLanguageCode); $messageUid = (int) $this->settings['unsubscribeMessageUid']; } else { if ($this->settings['table'] == 'tt_address' || $this->settings['table'] == 'fe_users') { @@ -1052,7 +1054,7 @@ public function deleteAction(Log $log = null, array $user = []): ResponseInterfa $persistenceManager->persistAll(); if (($this->settings['email']['adminMail'] && ! $this->settings['email']['adminMailBeforeVerification']) || ($this->settings['email']['enableConfirmationMails'])) { $toAdmin = ($this->settings['email']['adminMail'] && ! $this->settings['email']['adminMailBeforeVerification']); - $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), false, true, false, filter_var($this->settings['email']['enableConfirmationMails'], FILTER_VALIDATE_BOOLEAN), $toAdmin, $hash, 0, ''); + $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), false, true, false, filter_var($this->settings['email']['enableConfirmationMails'], FILTER_VALIDATE_BOOLEAN), $toAdmin, $hash, 0, '', $requestLanguageCode); } $messageUid = (int) $this->settings['unsubscribeVerifyMessageUid']; } @@ -1095,11 +1097,14 @@ public function verifyAction(): ResponseInterface $error = 0; $dbuid = 0; $html = intval($this->settings['html']); - $dmCat = str_replace(' ', '', $this->settings['categoryOrGroup']); + $dmCat = str_replace(' ', '', (string) $this->settings['categoryOrGroup']); $uid = intval($this->request->hasArgument('uid')) ? $this->request->getArgument('uid') : 0; $hash = ($this->request->hasArgument('hash')) ? $this->request->getArgument('hash') : ''; $languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); $sys_language_uid = intval($languageAspect->getId()); + $requestLanguage = $this->request->getAttribute('language'); + $requestLocale = $requestLanguage->getLocale(); + $requestLanguageCode = $requestLocale->getLanguageCode(); if (! $uid || ! $hash) { $this->view->assign('error', 1); } else { @@ -1130,7 +1135,7 @@ public function verifyAction(): ResponseInterface } else { $log->setStatus(2); $this->logRepository->update($log); - $persistenceManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); + $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); $persistenceManager->persistAll(); $success = 0; $salutation = $this->helpersUtility->getSalutation(intval($log->getGender()), $this->settings['gender']); @@ -1183,7 +1188,7 @@ public function verifyAction(): ResponseInterface } } $this->frontendUserRepository->add($frontendUser); - $persistenceManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); + $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); $persistenceManager->persistAll(); $success = 1; $tableUid = $frontendUser->getUid(); @@ -1195,7 +1200,7 @@ public function verifyAction(): ResponseInterface $error = 8; } elseif (($this->settings['email']['adminMail'] && ! $this->settings['email']['adminMailBeforeVerification']) || $this->settings['email']['enableConfirmationMails']) { $toAdmin = ($this->settings['email']['adminMail'] && ! $this->settings['email']['adminMailBeforeVerification']); - $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), true, true, false, filter_var($this->settings['email']['enableConfirmationMails'], FILTER_VALIDATE_BOOLEAN), $toAdmin, $hash, 0, ''); + $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), true, true, false, filter_var($this->settings['email']['enableConfirmationMails'], FILTER_VALIDATE_BOOLEAN), $toAdmin, $hash, 0, '', $requestLanguageCode); } } } @@ -1230,6 +1235,9 @@ public function verifyUnsubscribeAction(): ResponseInterface $hash = ($this->request->hasArgument('hash')) ? $this->request->getArgument('hash') : ''; $languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); $sys_language_uid = intval($languageAspect->getId()); + $requestLanguage = $this->request->getAttribute('language'); + $requestLocale = $requestLanguage->getLocale(); + $requestLanguageCode = $requestLocale->getLanguageCode(); if (! $uid || ! $hash) { $this->view->assign('error', 1); } else { @@ -1256,7 +1264,7 @@ public function verifyUnsubscribeAction(): ResponseInterface } else { $log->setStatus(4); $this->logRepository->update($log); - $persistenceManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); + $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); $persistenceManager->persistAll(); if ($this->settings['table'] == 'tt_address' || $this->settings['table'] == 'fe_users') { @@ -1264,7 +1272,7 @@ public function verifyUnsubscribeAction(): ResponseInterface } if (($this->settings['email']['adminMail'] && ! $this->settings['email']['adminMailBeforeVerification']) || ($this->settings['email']['enableConfirmationMails'])) { $toAdmin = ($this->settings['email']['adminMail'] && ! $this->settings['email']['adminMailBeforeVerification']); - $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), false, true, false, filter_var($this->settings['email']['enableConfirmationMails'], FILTER_VALIDATE_BOOLEAN), $toAdmin, $hash, 0, ''); + $this->helpersUtility->prepareEmail($log, $this->settings, $this->getViewArray(), false, true, false, filter_var($this->settings['email']['enableConfirmationMails'], FILTER_VALIDATE_BOOLEAN), $toAdmin, $hash, 0, '', $requestLanguageCode); } } } @@ -1296,7 +1304,7 @@ protected function deleteThisUser($uid) if ($this->settings['table'] == 'tt_address' || ($this->settings['table'] == 'fe_users' && $this->settings['newsletterExtension'] == 'mail')) { if ($this->settings['categoryOrGroup']) { - $dmail_cats = str_replace(' ', '', $this->settings['categoryOrGroup']); + $dmail_cats = str_replace(' ', '', (string) $this->settings['categoryOrGroup']); $dmCatArr = explode(',', $dmail_cats); } else { $dmCatArr = []; @@ -1318,7 +1326,7 @@ protected function deleteThisUser($uid) */ protected function getViewArray(): array { - $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); + $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); return $extbaseFrameworkConfiguration['view']; } } \ No newline at end of file diff --git a/Classes/Domain/Model/FrontendUser.php b/Classes/Domain/Model/FrontendUser.php index 0b6d184..c4194a2 100644 --- a/Classes/Domain/Model/FrontendUser.php +++ b/Classes/Domain/Model/FrontendUser.php @@ -7,8 +7,6 @@ class FrontendUser extends AbstractEntity { - protected string $username = ''; - protected string $password = ''; protected string $usergroup = ''; protected string $name = ''; @@ -32,10 +30,8 @@ class FrontendUser extends AbstractEntity protected string $mailSalutation = ''; protected int $categories = 0; - public function __construct(string $username = '', string $password = '') + public function __construct(protected string $username = '', protected string $password = '') { - $this->username = $username; - $this->password = $password; } public function initializeObject() diff --git a/Classes/Domain/Model/Log.php b/Classes/Domain/Model/Log.php index ab28d41..c55e9ed 100644 --- a/Classes/Domain/Model/Log.php +++ b/Classes/Domain/Model/Log.php @@ -1,6 +1,7 @@ , fixpunkt werbeagentur gmbh * ***/ - /** * The repository for Logs */ -class FrontendUserRepository extends \TYPO3\CMS\Extbase\Persistence\Repository +class FrontendUserRepository extends Repository { } \ No newline at end of file diff --git a/Classes/Domain/Repository/LogRepository.php b/Classes/Domain/Repository/LogRepository.php index 446ee38..8d6f851 100644 --- a/Classes/Domain/Repository/LogRepository.php +++ b/Classes/Domain/Repository/LogRepository.php @@ -1,6 +1,10 @@ matching($query->logicalAnd(...$constraints)); $query->setOrderings([ - 'crdate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING + 'crdate' => QueryInterface::ORDER_DESCENDING ]); return $query->execute()->getFirst(); } @@ -80,7 +84,7 @@ function getAllFields($uid) * @param string $table tt_address oder fe_users * @return integer */ - function getUidFromExternal($email, $pid, $table) + function getUidFromExternal($email, mixed $pid, $table) { $dbuid = 0; $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table); @@ -213,7 +217,7 @@ function insertIntoMm($tableUid, $dmCatArr = [], $table = 'tt_address') if (is_array($dmCatArr) && count($dmCatArr)>0) { $count = 0; foreach ($dmCatArr as $uid) { - if (is_numeric(trim($uid))) { + if (is_numeric(trim((string) $uid))) { // set the categories to the mm table of sys_category $count++; $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_category_record_mm'); @@ -251,14 +255,14 @@ function deleteInMm($tableUid, $table = 'tt_address') } /** - * insertInTTAddress: insert user - * @param \Fixpunkt\FpNewsletter\Domain\Model\Log $address User - * @param integer $mode HTML-mode - * @param array $dmCatArr categories - * @param string $salutation Anrede - * @param string $additionalFields weitere extern zugefügte Felder - */ - function insertInTtAddress($address, $mode, $dmCatArr = [], $salutation = '', $additionalFields = '') + * insertInTTAddress: insert user + * @param Log $address User + * @param integer $mode HTML-mode + * @param array $dmCatArr categories + * @param string $salutation Anrede + * @param string $additionalFields weitere extern zugefügte Felder + */ + function insertInTtAddress($address, $mode, $dmCatArr = [], $salutation = '', $additionalFields = '') { $timestamp = time(); if ($address->getGender() == 1) $gender = 'f'; @@ -325,7 +329,7 @@ function insertInTtAddress($address, $mode, $dmCatArr = [], $salutation = '', $a /** * updateInTTAddress: update user in tt_address - * @param \Fixpunkt\FpNewsletter\Domain\Model\Log $address User + * @param Log $address User * @param integer $mode HTML-mode * @param int $tableUid externe uid * @param string $salutation Anrede @@ -390,7 +394,7 @@ function updateInTtAddress($address, $mode, $tableUid, $salutation = '', $additi /** * updateInFeUsers: update fe_user - * @param \Fixpunkt\FpNewsletter\Domain\Model\Log $address User + * @param Log $address User * @param int $tableUid externe uid * @param string $extension mail or luxletter */ @@ -502,14 +506,14 @@ function deleteExternalUser($uid, $mode, $dmCatArr = [], $table = 'tt_address', } /** - * Find an entry with sys_language_uid > 0 - * https://forge.typo3.org/issues/86405 - * - * @param integer $uid - * @param integer $sys_language_uid - * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface - */ - public function findAnotherByUid($uid, $sys_language_uid) + * Find an entry with sys_language_uid > 0 + * https://forge.typo3.org/issues/86405 + * + * @param integer $uid + * @param integer $sys_language_uid + * @return array|QueryResultInterface + */ + public function findAnotherByUid($uid, $sys_language_uid) { $query = $this->createQuery(); $query->getQuerySettings()->setRespectSysLanguage(false); diff --git a/Classes/Events/ValidateEvent.php b/Classes/Events/ValidateEvent.php index e4e08a1..b988612 100644 --- a/Classes/Events/ValidateEvent.php +++ b/Classes/Events/ValidateEvent.php @@ -28,9 +28,6 @@ public function isValid(): bool return $this->valid; } - /** - * @param bool $valid - */ public function setValid(bool $valid): void { $this->valid = $valid; @@ -44,9 +41,6 @@ public function getMessage(): string return $this->message; } - /** - * @param string $message - */ public function setMessage(string $message): void { $this->message = $message; diff --git a/Classes/Updates/FlexformPluginUpdater.php b/Classes/Updates/FlexformPluginUpdater.php index 11fd15a..4a226aa 100644 --- a/Classes/Updates/FlexformPluginUpdater.php +++ b/Classes/Updates/FlexformPluginUpdater.php @@ -104,13 +104,13 @@ public function checkIfWizardIsRequired(): bool public function performMigration(): bool { $records = $this->getMigrationRecords(); - $search = array('settings.module_sys_dmail_category', 'settings.module_sys_dmail_html', 'settings.dmUnsubscribeMode'); - $replace = array('settings.categoryOrGroup', 'settings.html', 'settings.unsubscribeMode'); + $search = ['settings.module_sys_dmail_category', 'settings.module_sys_dmail_html', 'settings.dmUnsubscribeMode']; + $replace = ['settings.categoryOrGroup', 'settings.html', 'settings.unsubscribeMode']; $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); $queryBuilder = $connectionPool->getQueryBuilderForTable('tt_content'); foreach ($records as $record) { $flexFormData = $record['pi_flexform']; - $flexFormData = str_replace($search, $replace, $flexFormData); + $flexFormData = str_replace($search, $replace, (string) $flexFormData); $queryBuilder ->update('tt_content') ->where( diff --git a/Classes/Updates/SwitchableControllerActionsPluginUpdater.php b/Classes/Updates/SwitchableControllerActionsPluginUpdater.php index 9537ca1..4b9efbe 100644 --- a/Classes/Updates/SwitchableControllerActionsPluginUpdater.php +++ b/Classes/Updates/SwitchableControllerActionsPluginUpdater.php @@ -214,7 +214,7 @@ protected function getAllowedSettingsFromFlexForm(string $listType): array $settings = []; $flexFormFile = $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds'][$listType . ',list']; if ($flexFormFile) { - $flexFormContent = file_get_contents(GeneralUtility::getFileAbsFileName(substr(trim($flexFormFile), 5))); + $flexFormContent = file_get_contents(GeneralUtility::getFileAbsFileName(substr(trim((string) $flexFormFile), 5))); $flexFormData = GeneralUtility::xml2array($flexFormContent); // Iterate each sheet and extract all settings @@ -229,10 +229,6 @@ protected function getAllowedSettingsFromFlexForm(string $listType): array /** * Updates list_type and pi_flexform of the given content element UID - * - * @param int $uid - * @param string $newListType - * @param string $flexform */ protected function updateContentElement(int $uid, string $newListType, string $flexform): void { @@ -252,7 +248,6 @@ protected function updateContentElement(int $uid, string $newListType, string $f /** * Transforms the given array to FlexForm XML * - * @param array $input * @return string */ protected function array2xml(array $input = []): string diff --git a/Classes/Utility/HelpersUtility.php b/Classes/Utility/HelpersUtility.php index baa4994..513d93b 100644 --- a/Classes/Utility/HelpersUtility.php +++ b/Classes/Utility/HelpersUtility.php @@ -19,7 +19,6 @@ class HelpersUtility /** * Prüft, ob ein angegebenes math. Captcha OK ist * - * @param int $result * @return int */ public function checkMathCaptcha(int $result): int @@ -104,8 +103,6 @@ public function checkMailHash(array $record, string $hash, string $fields, int $ /** * Set a hash and the language to a new log-entry * - * @param \Fixpunkt\FpNewsletter\Domain\Model\Log $log - * @param int $languageMode * @return string */ public function setHashAndLanguage( @@ -128,9 +125,6 @@ public function setHashAndLanguage( /** * Check if a given log entry is valid * - * @param \Fixpunkt\FpNewsletter\Domain\Model\Log $log - * @param string $hash - * @param string $daysExpire * @return int */ public function checkIfValid( @@ -193,17 +187,17 @@ public function getGenders(bool|string $useXlf, array $settings, bool $please = /** * Prepare Array for emails and trigger sending of emails * - * @param \Fixpunkt\FpNewsletter\Domain\Model\Log $log - * @param array $settings settings - * @param array $view view - * @param boolean $isSubscribe Subscription or unsubscription? - * @param boolean $isConfirmation verify or confirmation? - * @param boolean $isEdit edit mode? - * @param boolean $toUser email to user? - * @param boolean $toAdmin email to admin? - * @param string $hash hash - * @param integer $verifyUid UID of the verification page - * @param string $pi plugin name + * param array $settings settings + * param array $view view + * param boolean $isSubscribe Subscription or unsubscription? + * param boolean $isConfirmation verify or confirmation? + * param boolean $isEdit edit mode? + * param boolean $toUser email to user? + * param boolean $toAdmin email to admin? + * param string $hash hash + * param integer $verifyUid UID of the verification page + * param string $pi plugin name + * param string $lCode request language code */ public function prepareEmail( \Fixpunkt\FpNewsletter\Domain\Model\Log &$log, @@ -216,7 +210,8 @@ public function prepareEmail( bool $toAdmin = false, string $hash = '', int $verifyUid = 0, - string $pi = ''): void + string $pi = '', + string $lCode = ''): void { $genders = $this->getGenders($settings['preferXlfFile'], $settings['gender'], false); $email = $log->getEmail(); @@ -227,6 +222,7 @@ public function prepareEmail( $dataArray = []; $dataArray['uid'] = $log->getUid(); $dataArray['sys_language_uid'] = $log->getSysLanguageUid(); + $dataArray['language_code'] = $lCode; $dataArray['gender_id'] = $log->getGender(); $dataArray['gender'] = $genders[$log->getGender()]; $dataArray['title'] = $log->getTitle(); @@ -290,8 +286,8 @@ public function prepareEmail( } $this->sendTemplateEmail( $view, - array($email => $from), - array($settings['email']['senderMail'] => $settings['email']['senderName']), + [$email => $from], + [$settings['email']['senderMail'] => $settings['email']['senderName']], $subject, $template, $dataArray, @@ -319,8 +315,8 @@ public function prepareEmail( } $this->sendTemplateEmail( $view, - array($settings['email']['adminMail'] => $settings['email']['adminName']), - array($settings['email']['senderMail'] => $settings['email']['senderName']), + [$settings['email']['adminMail'] => $settings['email']['adminName']], + [$settings['email']['senderMail'] => $settings['email']['senderName']], $subject, $template, $dataArray, @@ -331,18 +327,17 @@ public function prepareEmail( /** * Send an email * - * @param array $view - * @param array $recipient + * param array $recipient * recipient of the email in the format array('recipient@domain.tld' => 'Recipient Name') - * @param array $sender + * param array $sender * sender of the email in the format array('sender@domain.tld' => 'Sender Name') - * @param string $subject + * param string $subject * subject of the email - * @param string $templateName + * param string $templateName * template name (UpperCamelCase) - * @param array $variables + * param array $variables * variables to be passed to the Fluid view - * @param boolean $toAdmin + * param boolean $toAdmin * email to the admin? * @return boolean TRUE on success, otherwise false */ @@ -352,7 +347,7 @@ protected function sendTemplateEmail( array $sender, string $subject, string $templateName, - array $variables = array(), + array $variables = [], bool $toAdmin = false): bool { // Das hier ist von hier: https://wiki.typo3.org/How_to_use_the_Fluid_Standalone_view_to_render_template_based_emails @@ -361,8 +356,7 @@ protected function sendTemplateEmail( if (!$toAdmin && !$variables['settings']['email']['dontAppendL']) { $templateName .= $sys_language_uid; } - $extensionName = 'FpNewsletter'; // $this->request->getControllerExtensionName(); - + //$extensionName = 'FpNewsletter'; // $this->request->getControllerExtensionName(); /** @var \TYPO3\CMS\Fluid\View\StandaloneView $emailView */ $emailViewHtml = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class); // geht in TYPO3 12 nicht mehr: diff --git a/Classes/ViewHelpers/GetActionUrlViewHelper.php b/Classes/ViewHelpers/GetActionUrlViewHelper.php index 8afba48..475733d 100644 --- a/Classes/ViewHelpers/GetActionUrlViewHelper.php +++ b/Classes/ViewHelpers/GetActionUrlViewHelper.php @@ -51,7 +51,7 @@ public function render(): string '_language' => $language ]); return $uri->__tostring(); - } catch (Throwable $exception) { + } catch (Throwable) { throw new \RuntimeException( 'Could not build a valid URL to a fp_newsletter page with target page uid "' . $this->arguments['pageUid'] . '"', 5588995474 diff --git a/Classes/Widgets/RecentLogEntriesWidget.php b/Classes/Widgets/RecentLogEntriesWidget.php index 3762f5e..6abbca1 100644 --- a/Classes/Widgets/RecentLogEntriesWidget.php +++ b/Classes/Widgets/RecentLogEntriesWidget.php @@ -11,35 +11,17 @@ class RecentLogEntriesWidget implements WidgetInterface { - /** - * @var WidgetConfigurationInterface - */ - private $configuration; - - /** - * @var StandaloneView - */ - private $view; - /** * @var array */ private $options; - /** - * @var LogDataProvider - */ - private $dataProvider; - public function __construct( - WidgetConfigurationInterface $configuration, - StandaloneView $view, - LogDataProvider $dataProvider, + private readonly WidgetConfigurationInterface $configuration, + private readonly StandaloneView $view, + private readonly LogDataProvider $dataProvider, array $options = [] ) { - $this->configuration = $configuration; - $this->view = $view; - $this->dataProvider = $dataProvider; $this->options = array_merge( [ 'showErrors' => true, diff --git a/Configuration/TCA/tx_fpnewsletter_domain_model_log.php b/Configuration/TCA/tx_fpnewsletter_domain_model_log.php index f0af12e..c67f125 100644 --- a/Configuration/TCA/tx_fpnewsletter_domain_model_log.php +++ b/Configuration/TCA/tx_fpnewsletter_domain_model_log.php @@ -26,19 +26,7 @@ 'sys_language_uid' => [ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple' - ] - ], - 'default' => 0, - ], + 'config' => ['type' => 'language'], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', @@ -68,7 +56,6 @@ 'items' => [ [ 0 => '', - 1 => '', 'invertStateDisplay' => true ] ], diff --git a/Documentation/ChangeLog/Index.rst b/Documentation/ChangeLog/Index.rst index 2e3b3e0..af71134 100644 --- a/Documentation/ChangeLog/Index.rst +++ b/Documentation/ChangeLog/Index.rst @@ -167,4 +167,10 @@ Version 6.3.2: - Bugfix: reCAPTCHA fixed. Version 6.4.0: -- Additional fields can now be copied from the log-entry to the tt_address-table. Setting additionalTtAddressFields added. \ No newline at end of file +- Additional fields can now be copied from the log-entry to the tt_address-table. Setting additionalTtAddressFields added. + +Version 7.0.0: +- Refactoring with the rector tool. +- Adding of the language code to the email text. +- TypoScript-files have now the ending .typoscript. +- setting dontAppendL is now deprecated. \ No newline at end of file diff --git a/Documentation/Configuration/Index.rst b/Documentation/Configuration/Index.rst index 3bd099d..7f530e9 100644 --- a/Documentation/Configuration/Index.rst +++ b/Documentation/Configuration/Index.rst @@ -127,7 +127,7 @@ You can overwrite the text for other languages like this (if preferXlfFile=0, el Note: if you want to overwrite the text for the default language, remove this lines: [siteLanguage("languageId") == "1"] and [END]. -If you enable the setting preferXlfFile, then you can overwrite the text (except company) like this:: +If you enable the setting preferXlfFile, then you can overwrite the text (subject and salutation) like this:: plugin.tx_fpnewsletter._LOCAL_LANG.en.email.subscribedSubject = Your newsletter subscription is now confirmed plugin.tx_fpnewsletter._LOCAL_LANG.de.email.subscribedSubject = Deine Newsletter-Anmeldung ist nun bestätigt @@ -139,6 +139,8 @@ Otherwise set settings.email.dontAppendL=1. Note: till version 3.0.0, the default language is german even when settings.email.dontAppendL=1. From version 3.0.0, the email-templates without a appended number are using translated texts by default. +*Deprecation-note*: dontAppendL will be removed in version 8.0.0. Even all the templates with the ending 0 and 1. + External fields ^^^^^^^^^^^^^^^ diff --git a/Documentation/Localization.de_DE/ChangeLog/Index.rst b/Documentation/Localization.de_DE/ChangeLog/Index.rst index 209f478..8aab365 100644 --- a/Documentation/Localization.de_DE/ChangeLog/Index.rst +++ b/Documentation/Localization.de_DE/ChangeLog/Index.rst @@ -165,4 +165,10 @@ Version 6.3.2: - Bugfix: reCAPTCHA repariert. Version 6.4.0: -- Zusätzliche Felder können nun aus dem Log-Eintrag in eine tt_address-Tabelle kopiert werden. Setting additionalTtAddressFields hinzugefügt. \ No newline at end of file +- Zusätzliche Felder können nun aus dem Log-Eintrag in eine tt_address-Tabelle kopiert werden. Setting additionalTtAddressFields hinzugefügt. + +Version 7.0.0: +- Refactoring mit dem rector-Tool. +- Der Sprach-Code wird nun bei f:translate in den E-Mail-Templates hinzugefügt. +- TypoScript-Dateien haben nun die Endung .typoscript. +- Die setting dontAppendL ist nun deprecated. \ No newline at end of file diff --git a/Documentation/Localization.de_DE/Configuration/Index.rst b/Documentation/Localization.de_DE/Configuration/Index.rst index d97ca23..24764be 100644 --- a/Documentation/Localization.de_DE/Configuration/Index.rst +++ b/Documentation/Localization.de_DE/Configuration/Index.rst @@ -125,7 +125,7 @@ Man kann die Texte für andere Sprachen so überschreiben (falls preferXlfFile=0 Achtung: wenn man den Text der Standardsprache überschreiben will, entfernt man die beiden Zeilen: [siteLanguage("languageId") == "1"] und [END]. -Falls man die Setting preferXlfFile=1 setzt, kann man die Texte (bis auf company) so überschreiben:: +Falls man die Setting preferXlfFile=1 setzt, kann man die Texte (Betreff und Anrede) so überschreiben:: plugin.tx_fpnewsletter._LOCAL_LANG.en.email.subscribedSubject = Your newsletter subscription is now confirmed plugin.tx_fpnewsletter._LOCAL_LANG.de.email.subscribedSubject = Deine Newsletter-Anmeldung ist nun bestätigt @@ -134,6 +134,8 @@ Achtung: wenn man andere Sprachen in den Emails verwenden will, sollte man das K Bei settings.email.dontAppendL=0 ist die Standardsprache deutsch. Diese Templates enden ab Version 3.0.0 mit 0.html. Ab Version 3.0.0 werden in den E-Mail-Templates ohne Zahl-Endung übersetzte Texte verwendet. +*Deprecation*: dontAppendL wird in Version 8.0.0 entfernt. Auch alle Templates mit der Endung 0 und 1. + Externe Felder ^^^^^^^^^^^^^^ diff --git a/README.md b/README.md index 0eff85c..f527551 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # fp_newsletter -version 6.4.3 +Version 7.0.0 The TYPO3 extension fp_newsletter is designed to provide a newsletter subscription and unsubscription service for the table tt_address which can be used by the extension mail OR for the table fe_users which can be used by luxletter or mail. @@ -44,4 +44,10 @@ Version 6.4.0: - Additional fields can now be copied from the log-entry to the tt_address-table. Setting additionalTtAddressFields added. Version 6.4.3: -- Small bugfixes. \ No newline at end of file +- Small bugfixes. + +Version 7.0.0: +- Refactoring with the rector tool. +- Adding of the language code to f:translate in the email-templates. +- TypoScript-files have now the ending .typoscript. +- setting dontAppendL is now deprecated. \ No newline at end of file diff --git a/Resources/Private/Partials/Email/Salutation.html b/Resources/Private/Partials/Email/Salutation.html index 95a2d25..d7a87b9 100644 --- a/Resources/Private/Partials/Email/Salutation.html +++ b/Resources/Private/Partials/Email/Salutation.html @@ -1,13 +1,13 @@

- + - + - +

\ No newline at end of file diff --git a/Resources/Private/Partials/Email/Salutation.txt b/Resources/Private/Partials/Email/Salutation.txt index 9ac41c0..3678c90 100644 --- a/Resources/Private/Partials/Email/Salutation.txt +++ b/Resources/Private/Partials/Email/Salutation.txt @@ -1,7 +1,7 @@ - + - + - + \ No newline at end of file diff --git a/Resources/Private/Templates/Email/EditLink.html b/Resources/Private/Templates/Email/EditLink.html index c9f62b6..b219142 100644 --- a/Resources/Private/Templates/Email/EditLink.html +++ b/Resources/Private/Templates/Email/EditLink.html @@ -2,16 +2,16 @@ -<f:translate key="email.editSubject" extensionName="FpNewsletter" /> +<f:translate key="email.editSubject" extensionName="FpNewsletter" languageKey="{language_code}" /> -

+

-


+ target="_blank" style="border:1px solid #000;border-radius:3px;padding:2px 10px;">

+


{settings.company}

\ No newline at end of file diff --git a/Resources/Private/Templates/Email/EditLink.txt b/Resources/Private/Templates/Email/EditLink.txt index 97bbc27..66d6992 100644 --- a/Resources/Private/Templates/Email/EditLink.txt +++ b/Resources/Private/Templates/Email/EditLink.txt @@ -1,6 +1,6 @@ - + - + {settings.company} \ No newline at end of file diff --git a/Resources/Private/Templates/Email/SubscribeVerify.html b/Resources/Private/Templates/Email/SubscribeVerify.html index 3c1915f..de9a776 100644 --- a/Resources/Private/Templates/Email/SubscribeVerify.html +++ b/Resources/Private/Templates/Email/SubscribeVerify.html @@ -2,16 +2,16 @@ -<f:translate key="email.subscription" extensionName="FpNewsletter" /> +<f:translate key="email.subscription" extensionName="FpNewsletter" languageKey="{language_code}" /> -

+

-


+ target="_blank" style="border:1px solid #000;border-radius:3px;padding:2px 10px;">

+


{settings.company}

\ No newline at end of file diff --git a/Resources/Private/Templates/Email/SubscribeVerify.txt b/Resources/Private/Templates/Email/SubscribeVerify.txt index 3d7c238..25d7380 100644 --- a/Resources/Private/Templates/Email/SubscribeVerify.txt +++ b/Resources/Private/Templates/Email/SubscribeVerify.txt @@ -1,6 +1,6 @@ - + - + {settings.company} \ No newline at end of file diff --git a/Resources/Private/Templates/Email/Subscribed.html b/Resources/Private/Templates/Email/Subscribed.html index 7ab5d33..d4a4174 100644 --- a/Resources/Private/Templates/Email/Subscribed.html +++ b/Resources/Private/Templates/Email/Subscribed.html @@ -2,13 +2,13 @@ -<f:translate key="email.subscription" extensionName="FpNewsletter" /> +<f:translate key="email.subscription" extensionName="FpNewsletter" languageKey="{language_code}" /> -

-

{email}

-


+

+

{email}

+


{settings.company}

\ No newline at end of file diff --git a/Resources/Private/Templates/Email/Subscribed.txt b/Resources/Private/Templates/Email/Subscribed.txt index 3a6235f..be5ce1f 100644 --- a/Resources/Private/Templates/Email/Subscribed.txt +++ b/Resources/Private/Templates/Email/Subscribed.txt @@ -1,6 +1,6 @@ - - {email} + + {email} - + {settings.company} \ No newline at end of file diff --git a/Resources/Private/Templates/Email/UnsubscribeVerify.html b/Resources/Private/Templates/Email/UnsubscribeVerify.html index e9ae99e..24ee196 100644 --- a/Resources/Private/Templates/Email/UnsubscribeVerify.html +++ b/Resources/Private/Templates/Email/UnsubscribeVerify.html @@ -2,16 +2,16 @@ -<f:translate key="email.unsubscription" extensionName="FpNewsletter" /> +<f:translate key="email.unsubscription" extensionName="FpNewsletter" languageKey="{language_code}" /> -

+

-


+ target="_blank" style="border:1px solid #000;border-radius:3px;padding:2px 10px;">

+


{settings.company}

\ No newline at end of file diff --git a/Resources/Private/Templates/Email/UnsubscribeVerify.txt b/Resources/Private/Templates/Email/UnsubscribeVerify.txt index 8fd799e..d5625db 100644 --- a/Resources/Private/Templates/Email/UnsubscribeVerify.txt +++ b/Resources/Private/Templates/Email/UnsubscribeVerify.txt @@ -1,6 +1,6 @@ - + - + {settings.company} \ No newline at end of file diff --git a/Resources/Private/Templates/Email/Unsubscribed.html b/Resources/Private/Templates/Email/Unsubscribed.html index 3908606..fa774aa 100644 --- a/Resources/Private/Templates/Email/Unsubscribed.html +++ b/Resources/Private/Templates/Email/Unsubscribed.html @@ -2,13 +2,13 @@ -<f:translate key="email.unsubscription" extensionName="FpNewsletter" /> +<f:translate key="email.unsubscription" extensionName="FpNewsletter" languageKey="{language_code}" /> -

-

{email}

-


+

+

{email}

+


{settings.company}

\ No newline at end of file diff --git a/Resources/Private/Templates/Email/Unsubscribed.txt b/Resources/Private/Templates/Email/Unsubscribed.txt index 7b7b2ca..d84dd50 100644 --- a/Resources/Private/Templates/Email/Unsubscribed.txt +++ b/Resources/Private/Templates/Email/Unsubscribed.txt @@ -1,6 +1,6 @@ - - {email} + + {email} - + {settings.company} \ No newline at end of file diff --git a/Tests/Unit/Controller/LogControllerTest.php b/Tests/Unit/Controller/LogControllerTest.php index 50532a0..01306ea 100644 --- a/Tests/Unit/Controller/LogControllerTest.php +++ b/Tests/Unit/Controller/LogControllerTest.php @@ -1,22 +1,26 @@ */ -class LogControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase +class LogControllerTest extends UnitTestCase { /** - * @var \Fixpunkt\FpNewsletter\Controller\LogController + * @var LogController */ protected $subject = null; protected function setUp() { - parent::setUp(); - $this->subject = $this->getMockBuilder(\Fixpunkt\FpNewsletter\Controller\LogController::class) + $this->subject = $this->getMockBuilder(LogController::class) ->setMethods(['redirect', 'forward', 'addFlashMessage']) ->disableOriginalConstructor() ->getMock(); @@ -24,7 +28,6 @@ protected function setUp() protected function tearDown() { - parent::tearDown(); } /** @@ -33,11 +36,11 @@ protected function tearDown() public function listActionFetchesAllLogsFromRepositoryAndAssignsThemToView() { - $allLogs = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + $allLogs = $this->getMockBuilder(ObjectStorage::class) ->disableOriginalConstructor() ->getMock(); - $logRepository = $this->getMockBuilder(\Fixpunkt\FpNewsletter\Domain\Repository\LogRepository::class) + $logRepository = $this->getMockBuilder(LogRepository::class) ->setMethods(['findAll']) ->disableOriginalConstructor() ->getMock(); @@ -58,9 +61,9 @@ public function listActionFetchesAllLogsFromRepositoryAndAssignsThemToView() */ public function createActionAddsTheGivenLogToLogRepository() { - $log = new \Fixpunkt\FpNewsletter\Domain\Model\Log(); + $log = new Log(); - $logRepository = $this->getMockBuilder(\Fixpunkt\FpNewsletter\Domain\Repository\LogRepository::class) + $logRepository = $this->getMockBuilder(LogRepository::class) ->setMethods(['add']) ->disableOriginalConstructor() ->getMock(); @@ -76,9 +79,9 @@ public function createActionAddsTheGivenLogToLogRepository() */ public function deleteActionRemovesTheGivenLogFromLogRepository() { - $log = new \Fixpunkt\FpNewsletter\Domain\Model\Log(); + $log = new Log(); - $logRepository = $this->getMockBuilder(\Fixpunkt\FpNewsletter\Domain\Repository\LogRepository::class) + $logRepository = $this->getMockBuilder(LogRepository::class) ->setMethods(['remove']) ->disableOriginalConstructor() ->getMock(); diff --git a/Tests/Unit/Domain/Model/LogTest.php b/Tests/Unit/Domain/Model/LogTest.php index 72389cb..333f2f7 100644 --- a/Tests/Unit/Domain/Model/LogTest.php +++ b/Tests/Unit/Domain/Model/LogTest.php @@ -1,27 +1,27 @@ */ -class LogTest extends \TYPO3\CMS\Core\Tests\UnitTestCase +class LogTest extends UnitTestCase { /** - * @var \Fixpunkt\FpNewsletter\Domain\Model\Log + * @var Log */ protected $subject = null; protected function setUp() { - parent::setUp(); - $this->subject = new \Fixpunkt\FpNewsletter\Domain\Model\Log(); + $this->subject = new Log(); } protected function tearDown() { - parent::tearDown(); } /** diff --git a/ext_emconf.php b/ext_emconf.php index 563e010..f3c723a 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -17,8 +17,7 @@ 'author' => 'Kurt Gusbeth', 'author_company' => 'fixpunkt für digitales GmbH', 'state' => 'stable', - 'clearCacheOnLoad' => 0, - 'version' => '6.4.3', + 'version' => '7.0.0', 'constraints' => [ 'depends' => [ 'typo3' => '11.5.0-12.4.99' diff --git a/ext_localconf.php b/ext_localconf.php index 9c6a4ef..4cc220f 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -267,9 +267,9 @@ function() } ); -if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables']['tx_fpnewsletter_domain_model_log'])) { - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables']['tx_fpnewsletter_domain_model_log'] = array( +if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['tx_fpnewsletter_domain_model_log'])) { + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['tx_fpnewsletter_domain_model_log'] = [ 'dateField' => 'tstamp', 'expirePeriod' => '180' - ); + ]; }