diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ff118ed9..d88e5df41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,8 @@ jobs: - "composer:normalize" - "composer:psr-verify" - "json:lint" -# - "php:sniff" + - "php:sniff" + - "php:cs-fixer" # - "php:stan" - "xliff:lint" php-version: diff --git a/Classes/Container.php b/Classes/Container.php index d4f5928bf..ed0bd2cda 100644 --- a/Classes/Container.php +++ b/Classes/Container.php @@ -25,8 +25,8 @@ /** * Container class for auxilliary functions of tx_directmail * - * @author Kasper Skårhøj @typo3.com> - * @author Thorsten Kahler + * @author Kasper Skårhøj @typo3.com> + * @author Thorsten Kahler */ class Container { diff --git a/Classes/DirectMailUtility.php b/Classes/DirectMailUtility.php index 554bb0a0f..299efeb41 100644 --- a/Classes/DirectMailUtility.php +++ b/Classes/DirectMailUtility.php @@ -31,10 +31,10 @@ * Static class. * Functions in this class are used by more than one modules. * - * @author Kasper Skaarhoj - * @author Jan-Erik Revsbech - * @author Stanislas Rolland - * @author Ivan-Dharma Kartolo + * @author Kasper Skaarhoj + * @author Jan-Erik Revsbech + * @author Stanislas Rolland + * @author Ivan-Dharma Kartolo */ class DirectMailUtility { @@ -362,7 +362,6 @@ public static function substUrlsInPlainText(string $message, string $urlmode = ' $lengthLimit = 0; break; case '76': - default: $lengthLimit = (int)$urlmode; } diff --git a/Classes/DmQueryGenerator.php b/Classes/DmQueryGenerator.php index c7af33cef..3489c3a69 100644 --- a/Classes/DmQueryGenerator.php +++ b/Classes/DmQueryGenerator.php @@ -29,8 +29,8 @@ /** * Used to generate queries for selecting users in the database * - * @author Kasper Skårhøj - * @author Stanislas Rolland + * @author Kasper Skårhøj + * @author Stanislas Rolland */ class DmQueryGenerator extends QueryGenerator { @@ -129,7 +129,7 @@ public function getQueryDM(bool $queryLimitDisabled): string // Show query $this->enablePrefix = true; $queryString = $this->getQuery($this->queryConfig); - if($queryLimitDisabled) { + if ($queryLimitDisabled) { $this->extFieldLists['queryLimit'] = ''; } $selectQueryString = $this->getSelectQuery($queryString); diff --git a/Classes/Dmailer.php b/Classes/Dmailer.php index cd65b1ba9..4e31cc499 100644 --- a/Classes/Dmailer.php +++ b/Classes/Dmailer.php @@ -27,14 +27,13 @@ use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Mail\MailMessage; -use TYPO3\CMS\Core\Resource\FileReference; use TYPO3\CMS\Core\Service\MarkerBasedTemplateService; use TYPO3\CMS\Core\Utility\GeneralUtility; /** * Class, doing the sending of Direct-mails, eg. through a cron-job * - * @author Kasper Skårhøj + * @author Kasper Skårhøj * @author Stanislas Rolland */ class Dmailer implements LoggerAwareInterface @@ -461,7 +460,7 @@ public function sendSimple(array $recipients): bool * @param array $cArray Array of content split by dmail boundary * @param string $userCategories The list of categories the user is subscribing to. * - * @return string Content of the email, which the recipient subscribed + * @return string Content of the email, which the recipient subscribed */ protected function getBoundaryParts($cArray, $userCategories): string { @@ -508,7 +507,7 @@ protected function getBoundaryParts($cArray, $userCategories): string * @param string $table Tablename of the recipient * @param int $uid Uid of the recipient * - * @return string list of categories + * @return string list of categories */ public function getListOfRecipentCategories(string $table, int $uid): string { @@ -533,9 +532,9 @@ public function getListOfRecipentCategories(string $table, int $uid): string /** * Mass send to recipient in the list * - * @param array $query_info List of recipients' ID in the sys_dmail table - * @param int $mid Directmail ID. UID of the sys_dmail table - * @return bool + * @param array $query_info List of recipients' ID in the sys_dmail table + * @param int $mid Directmail ID. UID of the sys_dmail table + * @return bool */ protected function masssendList(array $query_info, int $mid): bool { @@ -643,7 +642,7 @@ protected function shipOfMail(int $mid, array $recipRow, string $tableKey): void 'logUid' => $logUid, 'html_sent' => (int)$this->sendAdvanced($recipRow, $tableKey), 'parsetime' => $this->getMilliseconds() - $parseTimeStart, - 'size' => strlen($this->message) + 'size' => strlen($this->message), ]; $ok = $sysDmailMaillogRepository->updateSysDmailMaillogForShipOfMail($values); @@ -665,7 +664,7 @@ protected function shipOfMail(int $mid, array $recipRow, string $tableKey): void * Converting array key. * fe_user and tt_address are using different fieldname for the same information * - * @param array $recipRow Recipient's data array + * @param array $recipRow Recipient's data array * * @return array Fixed recipient's data array */ @@ -934,9 +933,9 @@ protected function sendTheMail(Address $recipient, array $recipientRow = null): /** * Add HTML to an email * - * @param string $file String location of the HTML + * @param string $file String location of the HTML * - * @return mixed bool: HTML fetch status. string: if HTML is a frameset. + * @return mixed bool: HTML fetch status. string: if HTML is a frameset. */ public function addHTML(string $file) { @@ -957,7 +956,7 @@ public function addHTML(string $file) /** * Fetches the HTML-content from either url or local server file * - * @param string $url Url of the html to fetch + * @param string $url Url of the html to fetch * * @return bool Whether the data was fetched or not */ @@ -1296,7 +1295,7 @@ public function extractFramesInfo(): bool * Creates a regular expression out of a list of tags * * @param array $tags Array the list of tags - * (either as array or string if it is one tag) + * (either as array or string if it is one tag) * * @return string the regular expression */ @@ -1317,7 +1316,7 @@ protected function tag_regex(array $tags): string * Check it with is_set(); * * @param string $tag Tag is either like this "" or - * this " OPTION ATTRIB=VALUE>" which means you can omit the tag-name + * this " OPTION ATTRIB=VALUE>" which means you can omit the tag-name * @param bool $removeQuotes When TRUE (default) quotes around a value will get removed * * @return array array with attributes as keys in lower-case diff --git a/Classes/Importer.php b/Classes/Importer.php index 409ede503..afd7906d8 100644 --- a/Classes/Importer.php +++ b/Classes/Importer.php @@ -28,8 +28,8 @@ use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Messaging\FlashMessage; -use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Messaging\FlashMessageQueue; +use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Resource\DuplicationBehavior; use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\ArrayUtility; @@ -39,7 +39,7 @@ /** * Recipient list module for tx_directmail extension * - * @author Ivan-Dharma Kartolo + * @author Ivan-Dharma Kartolo */ class Importer { @@ -76,7 +76,7 @@ public function init(&$pObj): void /** * Import CSV-Data in step-by-step mode * - * @return array HTML form + * @return array HTML form */ public function displayImport(): array { @@ -211,7 +211,7 @@ public function displayImport(): array } // check if "email" is mapped - $error = []; + $error = []; if (isset($stepCurrent) && $stepCurrent === 'startImport') { $map = $this->indata['map']; // check noMap @@ -227,9 +227,9 @@ public function displayImport(): array } $out = ''; - if(!isset($stepCurrent)) { - $stepCurrent = ''; - } + if (!isset($stepCurrent)) { + $stepCurrent = ''; + } switch ($stepCurrent) { case 'conf': $output['conf']['show'] = true; @@ -269,7 +269,7 @@ public function displayImport(): array // TODO: make it variable? $optUnique = [ ['val' => 'email', 'text' => 'email'], - ['val' =>'name', 'text' => 'name'], + ['val' => 'name', 'text' => 'name'], ]; $output['conf']['disableInput'] = ($this->params['inputDisable'] ?? 0) == 1 ? true : false; @@ -524,8 +524,10 @@ public function displayImport(): array * use it to manipulate the steps in the import process */ $hookObjectsArr = []; - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['displayImport']) && - is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['displayImport'])) { + if ( + isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['displayImport']) && + is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['displayImport']) + ) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['displayImport'] as $classRef) { $hookObjectsArr[] = GeneralUtility::makeInstance($classRef); } @@ -562,7 +564,7 @@ public function filterCSV(array $mappedCsv): array foreach ($mappedCsv as $k => $csvData) { if (!in_array($k, $remove)) { $found = 0; - foreach ($cmpCsv as $kk =>$cmpData) { + foreach ($cmpCsv as $kk => $cmpData) { if ($k != $kk) { if ($csvData[$this->indata['record_unique']] == $cmpData[$this->indata['record_unique']]) { $double[] = $mappedCsv[$kk]; @@ -769,7 +771,7 @@ public function addDataArray(array &$data, $id, array $dataArray): void * Read in the given CSV file. The function is used during the final file import. * Removes first the first data row if the CSV has fieldnames. * - * @return array file content in array + * @return array file content in array */ public function readCSV(): array { @@ -813,9 +815,9 @@ public function readCSV(): array * Read in the given CSV file. Only showed a couple of the CSV values as example * Removes first the first data row if the CSV has fieldnames. * - * @param int $records Number of example values + * @param int $records Number of example values * - * @return array File content in array + * @return array File content in array */ public function readExampleCSV($records = 3): array { @@ -865,7 +867,7 @@ public function readExampleCSV($records = 3): array * * @param array $data Contains values to convert * - * @return array array of charset-converted values + * @return array array of charset-converted values * @see \TYPO3\CMS\Core\Charset\CharsetConverter::conv[] */ public function convCharset(array $data): array @@ -883,7 +885,7 @@ public function convCharset(array $data): array /** * Write CSV Data to a temporary file and will be used for the import * - * @return array path and uid of the temp file + * @return array path and uid of the temp file */ public function writeTempFile(string $csv, string $newFile, int $newFileUid): array { @@ -933,7 +935,7 @@ public function writeTempFile(string $csv, string $newFile, int $newFileUid): ar /** * Checks if a file has been uploaded and returns the complete physical fileinfo if so. * - * @return array \TYPO3\CMS\Core\Resource\File the complete physical file name, including path info. + * @return array \TYPO3\CMS\Core\Resource\File the complete physical file name, including path info. * @throws \Exception */ public function checkUpload(): array @@ -979,7 +981,7 @@ private function getFileById(int $fileUid) //: \TYPO3\CMS\Core\Resource\File|boo $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); try { return $resourceFactory->getFileObject($fileUid); - } catch(\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException $e) { + } catch (\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException $e) { } return false; } @@ -1000,7 +1002,7 @@ private function getFileAbsolutePath(int $fileUid): string /** * Returns first temporary folder of the user account * - * @return string Absolute path to first "_temp_" folder of the current user, otherwise blank. + * @return string Absolute path to first "_temp_" folder of the current user, otherwise blank. */ public function userTempFolder(): string { @@ -1044,11 +1046,11 @@ protected function getMessageQueue(): FlashMessageQueue /** https://api.typo3.org/11.5/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_messaging_1_1_abstract_message.html - const NOTICE = -2 - const INFO = -1 - const OK = 0 - const WARNING = 1 - const ERROR = 2 + const NOTICE = -2 + const INFO = -1 + const OK = 0 + const WARNING = 1 + const ERROR = 2 * @param string $messageText * @param string $messageHeader * @param int $messageType diff --git a/Classes/Middleware/JumpurlController.php b/Classes/Middleware/JumpurlController.php index 088e8e4cc..d228a3f3a 100644 --- a/Classes/Middleware/JumpurlController.php +++ b/Classes/Middleware/JumpurlController.php @@ -34,7 +34,7 @@ /** * JumpUrl processing hook on TYPO3\CMS\Frontend\Http\RequestHandler * - * @author Ivan Kartolo + * @author Ivan Kartolo */ class JumpurlController implements MiddlewareInterface { @@ -125,7 +125,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface } // to count the dmailerping correctly, we need something unique - $submittedAuthCode = preg_replace("/[^a-zA-Z0-9]/", "", $submittedAuthCode); + $submittedAuthCode = preg_replace('/[^a-zA-Z0-9]/', '', $submittedAuthCode); } if ($this->responseType !== 0) { @@ -191,7 +191,7 @@ protected function getTargetUrl(int $targetIndex): string ['allowed_classes' => false] ); - if(is_array($mailContent)) { + if (is_array($mailContent)) { if ($targetIndex >= 0) { // Link (number) $this->responseType = self::RESPONSE_TYPE_HREF; @@ -266,7 +266,7 @@ protected function substituteUserMarkersFromTargetUrl(string $targetUrl): string if (isset($this->recipientRecord[$substField])) { $processedTargetUrl = str_replace( '###USER_' . $substField . '###', - (string) $this->recipientRecord[$substField], + (string)$this->recipientRecord[$substField], $processedTargetUrl ); } @@ -304,11 +304,13 @@ protected function substituteSystemMarkersFromTargetUrl(string $targetUrl): stri protected function performFeUserAutoLogin() { // TODO: add a switch in Direct Mail configuration to decide if this option should be enabled by default - if ($this->recipientTable === 'fe_users' && + if ( + $this->recipientTable === 'fe_users' && GeneralUtility::inList( $this->directMailRecord['authcode_fieldList'], 'password' - )) { + ) + ) { $_POST['user'] = $this->recipientRecord['username']; $_POST['pass'] = $this->recipientRecord['password']; $_POST['pid'] = $this->recipientRecord['pid']; diff --git a/Classes/Module/ConfigurationController.php b/Classes/Module/ConfigurationController.php index 906ac37f0..30efb19fc 100644 --- a/Classes/Module/ConfigurationController.php +++ b/Classes/Module/ConfigurationController.php @@ -97,10 +97,10 @@ protected function setDefaultValues(): void } } - /** - * Update the pageTS - * No return value: sent header to the same page - */ + /** + * Update the pageTS + * No return value: sent header to the same page + */ protected function updatePageTS(): void { if ($this->getBackendUser()->doesUserHaveAccess(BackendUtility::getRecord('pages', $this->id), 2)) { diff --git a/Classes/Module/DmailController.php b/Classes/Module/DmailController.php index be301c2fd..daa54c73f 100644 --- a/Classes/Module/DmailController.php +++ b/Classes/Module/DmailController.php @@ -181,8 +181,10 @@ protected function moduleContent() $hideCategoryStep = false; $tsconfig = $this->getTSConfig(); - if ((isset($tsconfig['tx_directmail.']['hideSteps']) && - $tsconfig['tx_directmail.']['hideSteps'] === 'cat') || $isExternalDirectMailRecord) { + if ( + (isset($tsconfig['tx_directmail.']['hideSteps']) && + $tsconfig['tx_directmail.']['hideSteps'] === 'cat') || $isExternalDirectMailRecord + ) { $hideCategoryStep = true; } @@ -271,10 +273,10 @@ protected function moduleContent() $data['info']['internal']['cmd'] = $nextCmd ? $nextCmd : 'cats'; } // TODO: Error message - Error while adding the DB set - } - // external URL - // $this->createMailFrom_URL is the External URL subject - elseif ($this->createMailFrom_URL != '' && !$quickmail['send']) { + } elseif ($this->createMailFrom_URL != '' && !$quickmail['send']) { + // external URL + // $this->createMailFrom_URL is the External URL subject + $newUid = $this->createDirectMailRecordFromExternalURL( $this->createMailFrom_URL, $this->createMailFrom_HTMLUrl, @@ -296,9 +298,9 @@ protected function moduleContent() // TODO: Error message - Error while adding the DB set $this->error = 'no_valid_url'; } - } - // Quickmail - elseif ($quickmail['send']) { + } elseif ($quickmail['send']) { + // Quickmail + $temp = $this->createDMailQuick($quickmail); if (!$temp['errorTitle']) { $fetchError = false; @@ -318,9 +320,9 @@ protected function moduleContent() $data['info']['quickmail']['subject'] = htmlspecialchars($quickmail['subject'] ?? ''); $data['info']['quickmail']['message'] = htmlspecialchars($quickmail['message'] ?? ''); $data['info']['quickmail']['breakLines'] = ($quickmail['breakLines'] ?? false) ? (int)$quickmail['breakLines'] : 0; - } - // existing dmail - elseif ($row) { + } elseif ($row) { + // existing dmail + if ($row['type'] == '1' && (empty($row['HTMLParams']) || empty($row['plainParams']))) { // it's a quickmail $fetchError = false; @@ -1089,7 +1091,7 @@ public function displayMailGroupTest($result) * @param array $row Directmal DB record * * @return string Messages if the mail is sent or planned to sent - * @todo remove htmlmail. sending test mail + * @todo remove htmlmail. sending test mail */ protected function sendMail($row) { @@ -1347,7 +1349,7 @@ public function getRecordList(array $listArr, $table, $editLinkFlag = 1, $testMa * Shows the final steps of the process. Show recipient list and calendar library * * @param array $direct_mail_row - * @return array HTML + * @return array HTML */ protected function cmd_finalmail($direct_mail_row) { @@ -1548,19 +1550,19 @@ protected function getSingleMailGroup($groupUid) // Make queries if (count($pageIdArray)) { $whichTables = (int)$mailGroup['whichtables']; - if ($whichTables&1) { + if ($whichTables & 1) { // tt_address $idLists['tt_address'] = GeneralUtility::makeInstance(TtAddressRepository::class)->getIdList($pageIdArray, $groupUid, $mailGroup['select_categories']); } - if ($whichTables&2) { + if ($whichTables & 2) { // fe_users $idLists['fe_users'] = GeneralUtility::makeInstance(FeUsersRepository::class)->getIdList($pageIdArray, $groupUid, $mailGroup['select_categories']); } - if ($this->userTable && ($whichTables&4)) { + if ($this->userTable && ($whichTables & 4)) { // user table $idLists[$this->userTable] = GeneralUtility::makeInstance(TempRepository::class)->getIdList($this->userTable, $pageIdArray, $groupUid, $mailGroup['select_categories']); } - if ($whichTables&8) { + if ($whichTables & 8) { // fe_groups if (!is_array($idLists['fe_users'])) { $idLists['fe_users'] = []; @@ -1596,11 +1598,11 @@ protected function getSingleMailGroup($groupUid) $mailGroup = $this->updateSpecialQuery($mailGroup); $whichTables = (int)$mailGroup['whichtables']; $table = ''; - if ($whichTables&1) { + if ($whichTables & 1) { $table = 'tt_address'; - } elseif ($whichTables&2) { + } elseif ($whichTables & 2) { $table = 'fe_users'; - } elseif ($this->userTable && ($whichTables&4)) { + } elseif ($this->userTable && ($whichTables & 4)) { $table = $this->userTable; } @@ -1641,11 +1643,11 @@ public function updateSpecialQuery(array $mailGroup) $queryConfig = GeneralUtility::_GP('queryConfig'); $whichTables = (int)$mailGroup['whichtables']; $table = ''; - if ($whichTables&1) { + if ($whichTables & 1) { $table = 'tt_address'; - } elseif ($whichTables&2) { + } elseif ($whichTables & 2) { $table = 'fe_users'; - } elseif ($this->userTable && ($whichTables&4)) { + } elseif ($this->userTable && ($whichTables & 4)) { $table = $this->userTable; } @@ -1661,7 +1663,8 @@ public function updateSpecialQuery(array $mailGroup) $this->MOD_SETTINGS['queryLimit'] = $queryLimit; - if ($this->MOD_SETTINGS['queryTable'] != $table + if ( + $this->MOD_SETTINGS['queryTable'] != $table || $this->MOD_SETTINGS['queryConfig'] != $mailGroup['query'] || $this->MOD_SETTINGS['queryLimit'] != $mailGroup['queryLimit'] || $queryLimitDisabled != $mailGroup['queryLimitDisabled'] @@ -1834,8 +1837,8 @@ public function createDirectMailRecordFromPage(int $pageUid, array $parameters, 'replyto_name' => $parameters['replyto_name'] ?? '', 'return_path' => $parameters['return_path'] ?? '', 'priority' => $parameters['priority'] ?? 0, - 'use_rdct' => (!empty($parameters['use_rdct']) ? $parameters['use_rdct']:0), /*$parameters['use_rdct'],*/ - 'long_link_mode' => (!empty($parameters['long_link_mode']) ? $parameters['long_link_mode']:0), //$parameters['long_link_mode'], + 'use_rdct' => (!empty($parameters['use_rdct']) ? $parameters['use_rdct'] : 0), /*$parameters['use_rdct'],*/ + 'long_link_mode' => (!empty($parameters['long_link_mode']) ? $parameters['long_link_mode'] : 0), //$parameters['long_link_mode'], 'organisation' => $parameters['organisation'] ?? '', 'authcode_fieldList' => $parameters['authcode_fieldList'] ?? '', 'sendOptions' => $GLOBALS['TCA']['sys_dmail']['columns']['sendOptions']['config']['default'], @@ -1906,7 +1909,7 @@ public function createDirectMailRecordFromPage(int $pageUid, array $parameters, * @param string $externalUrlPlain Linkt to the text version * @param array $parameters Additional newsletter parameters * - * @return int/bool Error or warning message produced during the process + * @return int/bool Error or warning message produced during the process */ public function createDirectMailRecordFromExternalURL($subject, $externalUrlHtml, $externalUrlPlain, array $parameters) { @@ -2004,7 +2007,7 @@ protected function getUrlBase(int $pageId): string return ''; // No valid pageId } - /** + /** * Get the configured charset. * * This method used to initialize the TSFE object to get the charset on a per page basis. Now it just evaluates the diff --git a/Classes/Module/MailerEngineController.php b/Classes/Module/MailerEngineController.php index 132459c24..142ae8ce6 100644 --- a/Classes/Module/MailerEngineController.php +++ b/Classes/Module/MailerEngineController.php @@ -8,14 +8,13 @@ use DirectMailTeam\DirectMail\Repository\SysDmailMaillogRepository; use DirectMailTeam\DirectMail\Repository\SysDmailRepository; use DirectMailTeam\DirectMail\Utility\SchedulerUtility; -use DirectMailTeam\DirectMail\Utility\Typo3ConfVarsUtility; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Http\HtmlResponse; use TYPO3\CMS\Core\Imaging\Icon; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; +use TYPO3\CMS\Core\Utility\GeneralUtility; class MailerEngineController extends MainController { @@ -114,7 +113,7 @@ protected function getSchedulerTable(): array * Shows the status of the mailer engine. * TODO: Should really only show some entries, or provide a browsing interface. * - * @return string List of the mailing status + * @return string List of the mailing status * @throws RouteNotFoundException If the named route doesn't exist */ protected function mailerengine(): array @@ -210,8 +209,8 @@ protected function deleteDMail(int $uid): void * Invoking the mail engine * This method no longer returns logs in backend modul directly * - * @see Dmailer::start - * @see Dmailer::runcron + * @see Dmailer::start + * @see Dmailer::runcron */ protected function invokeMEngine(): void { diff --git a/Classes/Module/MainController.php b/Classes/Module/MainController.php index 1b2989a0f..49b01dd26 100644 --- a/Classes/Module/MainController.php +++ b/Classes/Module/MainController.php @@ -135,11 +135,11 @@ protected function configureTemplatePaths(string $templateName): StandaloneView /** https://api.typo3.org/11.5/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_messaging_1_1_abstract_message.html - const NOTICE = -2 - const INFO = -1 - const OK = 0 - const WARNING = 1 - const ERROR = 2 + const NOTICE = -2 + const INFO = -1 + const OK = 0 + const WARNING = 1 + const ERROR = 2 * @param string $messageText * @param string $messageHeader * @param int $messageType @@ -264,14 +264,14 @@ protected function getFieldList(): array 'country', 'fax', 'module_sys_dmail_category', - 'module_sys_dmail_html' + 'module_sys_dmail_html', ]; } protected function getFieldListFeUsers(): array { $fieldList = $this->getFieldList(); - foreach(['telephone' => 'phone'] as $key => $val) { + foreach (['telephone' => 'phone'] as $key => $val) { $index = array_search($val, $fieldList); $fieldList[$index] = $key; } @@ -300,7 +300,7 @@ protected function getIconActionsOpen(): Icon * @param array $listArr All DB records to be formated * @param string $table Table name * - * @return array list of record + * @return array list of record */ protected function getRecordList(array $listArr, string $table) { @@ -406,14 +406,14 @@ protected function cleanPlainList(array $plainlist) * $plainlist is a multidimensional array. * this method only remove if a value has the same array * $plainlist = [ - * 0 => [ - * name => '', - * email => '', - * ], - * 1 => [ - * name => '', - * email => '', - * ], + * 0 => [ + * name => '', + * email => '', + * ], + * 1 => [ + * name => '', + * email => '', + * ], * ]; */ return array_map('unserialize', array_unique(array_map('serialize', $plainlist))); diff --git a/Classes/Module/RecipientListController.php b/Classes/Module/RecipientListController.php index 7e86284e1..ddb5445d8 100644 --- a/Classes/Module/RecipientListController.php +++ b/Classes/Module/RecipientListController.php @@ -224,7 +224,7 @@ protected function showExistingRecipientLists() * * @param int $groupUid Uid of the group * - * @return array List of the uid in an array + * @return array List of the uid in an array */ protected function cmd_compileMailGroup(int $groupUid) { @@ -261,19 +261,19 @@ protected function cmd_compileMailGroup(int $groupUid) if (count($pageIdArray)) { $whichTables = (int)$mailGroup['whichtables']; // tt_address - if ($whichTables&1) { + if ($whichTables & 1) { $idLists['tt_address'] = GeneralUtility::makeInstance(TtAddressRepository::class)->getIdList($pageIdArray, $groupUid, $mailGroup['select_categories']); } // fe_users - if ($whichTables&2) { + if ($whichTables & 2) { $idLists['fe_users'] = GeneralUtility::makeInstance(FeUsersRepository::class)->getIdList($pageIdArray, $groupUid, $mailGroup['select_categories']); } // user table - if ($this->userTable && ($whichTables&4)) { + if ($this->userTable && ($whichTables & 4)) { $idLists[$this->userTable] = GeneralUtility::makeInstance(TempRepository::class)->getIdList($this->userTable, $pageIdArray, $groupUid, $mailGroup['select_categories']); } // fe_groups - if ($whichTables&8) { + if ($whichTables & 8) { if (!is_array($idLists['fe_users'])) { $idLists['fe_users'] = []; } @@ -308,11 +308,11 @@ protected function cmd_compileMailGroup(int $groupUid) $mailGroup = $this->updateSpecialQuery($mailGroup); $whichTables = (int)$mailGroup['whichtables']; $table = ''; - if ($whichTables&1) { + if ($whichTables & 1) { $table = 'tt_address'; - } elseif ($whichTables&2) { + } elseif ($whichTables & 2) { $table = 'fe_users'; - } elseif ($this->userTable && ($whichTables&4)) { + } elseif ($this->userTable && ($whichTables & 4)) { $table = $this->userTable; } @@ -455,7 +455,7 @@ protected function displayMailGroup($result) 'group_icon' => $this->iconFactory->getIconForRecord('sys_dmail_group', $group, Icon::SIZE_SMALL), 'group_title' => htmlspecialchars($group['title'] ?? ''), 'group_totalRecipients' => $totalRecipients, - 'group_link_listall' => ($this->lCmd == '') ? GeneralUtility::linkThisScript(['lCmd'=>'listall']) : '', + 'group_link_listall' => ($this->lCmd == '') ? GeneralUtility::linkThisScript(['lCmd' => 'listall']) : '', 'tables' => [], 'special' => [], ]; @@ -490,8 +490,8 @@ protected function displayMailGroup($result) if (is_array($idLists['tt_address'] ?? false)) { //https://github.com/FriendsOfTYPO3/tt_address/blob/master/ext_tables.sql $rows = GeneralUtility::makeInstance(TempRepository::class)->fetchRecordsListValues( - $idLists['tt_address'], - 'tt_address', + $idLists['tt_address'], + 'tt_address', ['uid', 'name', 'first_name', 'middle_name', 'last_name', 'email'] ); $data['tables'][] = [ @@ -530,7 +530,7 @@ protected function displayMailGroup($result) 'title_table' => 'mailgroup_table_address', 'title_recip' => 'mailgroup_recip_number', 'recip_counter' => ' ' . count($idLists['tt_address']), - 'mailgroup_download_link' => GeneralUtility::linkThisScript(['csv'=>'tt_address']), + 'mailgroup_download_link' => GeneralUtility::linkThisScript(['csv' => 'tt_address']), ]; } @@ -539,7 +539,7 @@ protected function displayMailGroup($result) 'title_table' => 'mailgroup_table_fe_users', 'title_recip' => 'mailgroup_recip_number', 'recip_counter' => ' ' . count($idLists['fe_users']), - 'mailgroup_download_link' => GeneralUtility::linkThisScript(['csv'=>'fe_users']), + 'mailgroup_download_link' => GeneralUtility::linkThisScript(['csv' => 'fe_users']), ]; } @@ -548,7 +548,7 @@ protected function displayMailGroup($result) 'title_table' => 'mailgroup_plain_list', 'title_recip' => 'mailgroup_recip_number', 'recip_counter' => ' ' . count($idLists['PLAINLIST']), - 'mailgroup_download_link' => GeneralUtility::linkThisScript(['csv'=>'PLAINLIST']), + 'mailgroup_download_link' => GeneralUtility::linkThisScript(['csv' => 'PLAINLIST']), ]; } @@ -587,11 +587,11 @@ protected function updateSpecialQuery($mailGroup) $queryConfig = GeneralUtility::_GP('queryConfig'); $whichTables = (int)$mailGroup['whichtables']; $table = ''; - if ($whichTables&1) { + if ($whichTables & 1) { $table = 'tt_address'; - } elseif ($whichTables&2) { + } elseif ($whichTables & 2) { $table = 'fe_users'; - } elseif ($this->userTable && ($whichTables&4)) { + } elseif ($this->userTable && ($whichTables & 4)) { $table = $this->userTable; } @@ -608,7 +608,8 @@ protected function updateSpecialQuery($mailGroup) $this->MOD_SETTINGS['queryLimit'] = $queryLimit; - if ($this->MOD_SETTINGS['queryTable'] != $table + if ( + $this->MOD_SETTINGS['queryTable'] != $table || $this->MOD_SETTINGS['queryConfig'] != $mailGroup['query'] || $this->MOD_SETTINGS['queryLimit'] != $mailGroup['queryLimit'] || $queryLimitDisabled != $mailGroup['queryLimitDisabled'] @@ -658,7 +659,7 @@ protected function specialQuery() /** * Shows user's info and categories * - * @return string HTML showing user's info and the categories + * @return string HTML showing user's info and the categories */ protected function displayUserInfo() { diff --git a/Classes/Module/StatisticsController.php b/Classes/Module/StatisticsController.php index e1ea291f2..878ae3ba3 100644 --- a/Classes/Module/StatisticsController.php +++ b/Classes/Module/StatisticsController.php @@ -539,7 +539,7 @@ protected function stats($row) ], [ 'stats_links_clicked_per_respondent', - ($uniqueHtmlResponses + $uniquePlainResponses ? number_format((($table['1']['counter'] ?? 0) + ($table['2']['counter'] ?? 0)) / ($uniqueHtmlResponses+$uniquePlainResponses), 2) : '-'), + ($uniqueHtmlResponses + $uniquePlainResponses ? number_format((($table['1']['counter'] ?? 0) + ($table['2']['counter'] ?? 0)) / ($uniqueHtmlResponses + $uniquePlainResponses), 2) : '-'), ($uniqueHtmlResponses ? number_format(($table['1']['counter']) / ($uniqueHtmlResponses), 2) : '-'), ($uniquePlainResponses ? number_format(($table['2']['counter']) / ($uniquePlainResponses), 2) : '-'), ], @@ -1241,7 +1241,7 @@ private function getIdLists($rrows): array * @return string wrapped string as a link * @throws RouteNotFoundException If the named route doesn't exist */ - protected function linkDMail_record($str, $uid, $aTitle='') + protected function linkDMail_record($str, $uid, $aTitle = '') { $moduleUrl = $this->buildUriFromRoute( $this->moduleName, @@ -1332,7 +1332,7 @@ protected function showWithPercent($pieces, $total) $total = (int)$total; $str = $pieces ? number_format((int)$pieces) : '0'; if ($total) { - $str .= ' / ' . number_format(($pieces/$total*100), 2) . '%'; + $str .= ' / ' . number_format(($pieces / $total * 100), 2) . '%'; } return $str; } @@ -1373,8 +1373,8 @@ protected function makeStatTempTableContent(array $mrow) $recRec['response'][] = $row['tstamp']; break; case '0': - $recRec['recieved_html'] = $row['html_sent']&1; - $recRec['recieved_plain'] = $row['html_sent']&2; + $recRec['recieved_html'] = $row['html_sent'] & 1; + $recRec['recieved_plain'] = $row['html_sent'] & 2; $recRec['size'] = $row['size']; $recRec['tstamp'] = $row['tstamp']; break; @@ -1467,14 +1467,14 @@ public function getUrlStr(array $urlParts): string if ($isInt) { $uid = (int)$m[1]; } -// @TODO -// else { -// // initialize the page selector -// /** @var PageRepository $sys_page */ -// $sys_page = GeneralUtility::makeInstance(PageRepository::class); -// $sys_page->init(true); -// $uid = $sys_page->getPageIdFromAlias($m[1]); -// } + // @TODO + // else { + // // initialize the page selector + // /** @var PageRepository $sys_page */ + // $sys_page = GeneralUtility::makeInstance(PageRepository::class); + // $sys_page->init(true); + // $uid = $sys_page->getPageIdFromAlias($m[1]); + // } $rootLine = BackendUtility::BEgetRootLine($uid); $pages = array_shift($rootLine); // array_shift reverses the array (rootline has numeric index in the wrong order!) @@ -1559,16 +1559,15 @@ public function getLinkLabel($url, $urlStr, $forceFetch = false, $linkedWord = ' $contentTitle = $file['file']; } } -/** - if ($this->params['showContentTitle'] == 1) { - $label = $contentTitle; - } - - if ($this->params['prependContentTitle'] == 1) { - $label = $contentTitle . ' (' . $linkedWord . ')'; - } -*/ + /** + if ($this->params['showContentTitle'] == 1) { + $label = $contentTitle; + } + if ($this->params['prependContentTitle'] == 1) { + $label = $contentTitle . ' (' . $linkedWord . ')'; + } + */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXT']['directmail']['getLinkLabel'] ?? false)) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['directmail']['getLinkLabel'] as $funcRef) { $params = ['pObj' => &$this, 'url' => $url, 'urlStr' => $urlStr, 'label' => $label]; diff --git a/Classes/Plugin/DirectMail.php b/Classes/Plugin/DirectMail.php index 8f2998c5f..62a355a3e 100644 --- a/Classes/Plugin/DirectMail.php +++ b/Classes/Plugin/DirectMail.php @@ -1,7 +1,5 @@ - * @author Stanislas Rolland + * @author Kasper Skårhøj + * @author Stanislas Rolland */ +namespace DirectMailTeam\DirectMail\Plugin; + use DirectMailTeam\DirectMail\DirectMailUtility; use TYPO3\CMS\Core\Resource\FileReference; use TYPO3\CMS\Core\Service\MarkerBasedTemplateService; @@ -76,10 +76,10 @@ class DirectMail extends AbstractPlugin * A content object that renders "tt_content" records. See the comment to this class for TypoScript example of how to trigger it. * This detects the CType of the current content element and renders it accordingly. Only wellknown types are rendered. * - * @param string $content Empty, ignore. - * @param array $conf TypoScript properties for this content object/function call + * @param string $content Empty, ignore. + * @param array $conf TypoScript properties for this content object/function call * - * @return string + * @return string */ public function main($content, array $conf) { @@ -108,12 +108,12 @@ public function main($content, array $conf) $lines[] = $this->getHeader(); $list = 'textpic,textmedia'; - if (GeneralUtility::inList($list, $cType) && !($this->cObj->data['imageorient']&24)) { + if (GeneralUtility::inList($list, $cType) && !($this->cObj->data['imageorient'] & 24)) { $lines[] = $this->getImages($field); $lines[] = ''; } $lines[] = $this->breakContent(strip_tags($this->parseBody($this->cObj->data['bodytext']))); - if (GeneralUtility::inList($list, $cType) && ($this->cObj->data['imageorient']&24)) { + if (GeneralUtility::inList($list, $cType) && ($this->cObj->data['imageorient'] & 24)) { $lines[] = ''; $lines[] = $this->getImages($field); } @@ -178,7 +178,7 @@ public function main($content, array $conf) /** * Initializing the parent class * - * @param array $conf TS conf + * @param array $conf TS conf */ public function init(array $conf) { @@ -198,7 +198,7 @@ public function init(array $conf) * Creates a menu/sitemap * * @param string $cType: menu type - * @return string $str: Content + * @return string $str: Content */ public function getMenuContent($cType) { @@ -213,7 +213,7 @@ public function getMenuContent($cType) /** * Creates a shortcut ("Insert Records") * - * @return string Plain Content without HTML comments + * @return string Plain Content without HTML comments */ public function getShortcut() { @@ -226,19 +226,19 @@ public function getShortcut() /** * Creates an HTML element (stripping tags of course) * - * @param mixed $str HTML content (as string or in an array) to process. If not passed along, the bodytext field is used. + * @param mixed $str HTML content (as string or in an array) to process. If not passed along, the bodytext field is used. * - * @return string Plain content. + * @return string Plain content. */ public function getHtml($str = []) { - return $this->breakContent(strip_tags(preg_replace('//i', LF, $this->parseBody(is_string($str) ? $str: $this->cObj->data['bodytext'])))); + return $this->breakContent(strip_tags(preg_replace('//i', LF, $this->parseBody(is_string($str) ? $str : $this->cObj->data['bodytext'])))); } /** * Creates a header (used for most elements) * - * @return string Content + * @return string Content * @see renderHeader() */ public function getHeader() @@ -298,10 +298,10 @@ public function getImages($fieldname) /** * Parsing the bodytext field content, removing typical entities and
tags. * - * @param string $str Field content from "bodytext" or other text field - * @param string $altConf Altername conf name (especially when bodyext field in other table then tt_content) + * @param string $str Field content from "bodytext" or other text field + * @param string $altConf Altername conf name (especially when bodyext field in other table then tt_content) * - * @return string Processed content + * @return string Processed content */ public function parseBody($str, $altConf = 'bodytext') { @@ -330,10 +330,10 @@ public function parseBody($str, $altConf = 'bodytext') /** * Creates a list of links to uploaded files. * - * @param string $str List of uploaded filenames from "uploads/media/" (or $upload_path) - * @param string $uploadPath Alternative path value + * @param string $str List of uploaded filenames from "uploads/media/" (or $upload_path) + * @param string $uploadPath Alternative path value * - * @return string Content + * @return string Content */ public function renderUploads($str, $uploadPath = 'uploads/media/') { @@ -354,10 +354,10 @@ public function renderUploads($str, $uploadPath = 'uploads/media/') /** * Renders a content element header, observing the layout type giving different header formattings * - * @param string $str The header string - * @param int $type The layout type of the header (in the content element) + * @param string $str The header string + * @param int $type The layout type of the header (in the content element) * - * @return string Content + * @return string Content */ public function renderHeader($str, $type = 0) { @@ -380,18 +380,18 @@ public function renderHeader($str, $type = 0) $blanks = DirectMailUtility::intInRangeWrapper((int)$tConf['preBlanks'], 0, 1000); if ($blanks) { - $lines[] = str_pad('', $blanks-1, LF); + $lines[] = str_pad('', $blanks - 1, LF); } $lines = $this->pad($lines, $tConf['preLineChar'], $tConf['preLineLen']); $blanks = DirectMailUtility::intInRangeWrapper((int)$tConf['preLineBlanks'], 0, 1000); if ($blanks) { - $lines[] = str_pad('', $blanks-1, LF); + $lines[] = str_pad('', $blanks - 1, LF); } if ($this->cObj->data['date']) { - $lines[] = $this->getString($hConf['datePrefix']) . date($hConf['date']?$hConf['date']:'d-m-Y', $this->cObj->data['date']); + $lines[] = $this->getString($hConf['datePrefix']) . date($hConf['date'] ? $hConf['date'] : 'd-m-Y', $this->cObj->data['date']); } $prefix = ''; @@ -403,7 +403,7 @@ public function renderHeader($str, $type = 0) $prefix = str_pad(' ', ($this->charWidth - strlen($str))); } if ($this->cObj->data['header_position'] === 'center') { - $prefix = str_pad(' ', floor(($this->charWidth-strlen($str))/2)); + $prefix = str_pad(' ', floor(($this->charWidth - strlen($str)) / 2)); } $lines[] = $this->cObj->stdWrap($prefix . $str, $tConf['stdWrap.']); @@ -413,14 +413,14 @@ public function renderHeader($str, $type = 0) $blanks = DirectMailUtility::intInRangeWrapper((int)$tConf['postLineBlanks'], 0, 1000); if ($blanks) { - $lines[] = str_pad('', $blanks-1, LF); + $lines[] = str_pad('', $blanks - 1, LF); } $lines = $this->pad($lines, $tConf['postLineChar'], $tConf['postLineLen']); $blanks = DirectMailUtility::intInRangeWrapper((int)$tConf['postBlanks'], 0, 1000); if ($blanks) { - $lines[] = str_pad('', $blanks-1, LF); + $lines[] = str_pad('', $blanks - 1, LF); } return implode(LF, $lines); } @@ -432,11 +432,11 @@ public function renderHeader($str, $type = 0) /** * Function used to repeat a char pattern in head lines (like if you want "********" above/below a header) * - * @param array $lines Array of existing lines to which the new char-pattern should be added - * @param string $preLineChar The character pattern to repeat. Default is "-" - * @param int $len The length of the line. $preLineChar will be repeated to fill in this length. + * @param array $lines Array of existing lines to which the new char-pattern should be added + * @param string $preLineChar The character pattern to repeat. Default is "-" + * @param int $len The length of the line. $preLineChar will be repeated to fill in this length. * - * @return array The input array with a new line added. + * @return array The input array with a new line added. * @see renderHeader() */ public function pad(array $lines, $preLineChar, $len) @@ -452,9 +452,9 @@ public function pad(array $lines, $preLineChar, $len) /** * Function used to wrap the bodytext field content (or image caption) into lines of a max length of * - * @param string $str The content to break + * @param string $str The content to break * - * @return string Processed value. + * @return string Processed value. * @see main_plaintext(), breakLines() */ public function breakContent($str) @@ -470,9 +470,9 @@ public function breakContent($str) /** * Breaks content lines into a bullet list * - * @param string $str Content string to make into a bullet list + * @param string $str Content string to make into a bullet list * - * @return string Processed value + * @return string Processed value */ public function breakBulletlist($str) { @@ -493,13 +493,13 @@ public function breakBulletlist($str) $bullet = $tConf['bullet'] ? $this->getString($tConf['bullet']) : ' - '; $bLen = strlen($bullet); $bullet = substr(str_replace('#', $c, $bullet), 0, $bLen); - $secondRow = substr($tConf['secondRow']?$this->getString($tConf['secondRow']):str_pad('', strlen($bullet), ' '), 0, $bLen); + $secondRow = substr($tConf['secondRow'] ? $this->getString($tConf['secondRow']) : str_pad('', strlen($bullet), ' '), 0, $bLen); - $lines[] = $bullet . $this->breakLines($substrs, LF . $secondRow, $this->charWidth-$bLen); + $lines[] = $bullet . $this->breakLines($substrs, LF . $secondRow, $this->charWidth - $bLen); $blanks = DirectMailUtility::intInRangeWrapper((int)$tConf['blanks'], 0, 1000); if ($blanks) { - $lines[] = str_pad('', $blanks-1, LF); + $lines[] = str_pad('', $blanks - 1, LF); } } return implode(LF, $lines); @@ -508,9 +508,9 @@ public function breakBulletlist($str) /** * Formatting a table in plain text (based on the paradigm of lines being content rows and cells separated by "|") * - * @param string $str Content string + * @param string $str Content string * - * @return string Processed value + * @return string Processed value */ public function breakTable($str) { @@ -527,8 +527,8 @@ public function breakTable($str) $cols = count($lineParts); } - for ($a=0;$a<$cols;$a++) { - $jdu = explode(LF, $this->breakLines($lineParts[$a], LF, ceil($this->charWidth/$cols))); + for ($a = 0; $a < $cols; $a++) { + $jdu = explode(LF, $this->breakLines($lineParts[$a], LF, ceil($this->charWidth / $cols))); $lines[$c][$a] = $jdu; } } @@ -560,13 +560,13 @@ public function breakTable($str) /** * Subfunction for breakTable(): Adds a divider line between table rows. * - * @param array $messure Some information about sizes - * @param string $content Empty string. - * @param string $divChar Character to use for the divider line, typically "-" - * @param string $joinChar Join character, typically "+" - * @param int $cols Number of table columns + * @param array $messure Some information about sizes + * @param string $content Empty string. + * @param string $divChar Character to use for the divider line, typically "-" + * @param string $joinChar Join character, typically "+" + * @param int $cols Number of table columns * - * @return string Divider line for the table + * @return string Divider line for the table * @see breakTable() */ public function addDiv(array $messure, $content, $divChar, $joinChar, $cols) @@ -581,9 +581,9 @@ public function addDiv(array $messure, $content, $divChar, $joinChar, $cols) /** * Traverses the table lines/cells and creates arrays with statistics for line numbers and lengths * - * @param array $tableLines Array with [table rows] [table cells] [lines in cell] + * @param array $tableLines Array with [table rows] [table cells] [lines in cell] * - * @return array Statistics (max lines/lengths) + * @return array Statistics (max lines/lengths) * @see breakTable() */ public function traverseTable(array $tableLines) @@ -651,9 +651,9 @@ public function renderImages(array $imagesArray, $fieldname) /** * Returns a typolink URL based on input. * - * @param string $link Parameter to typolink + * @param string $link Parameter to typolink * - * @return string The URL returned from $this->cObj->getTypoLink_URL(); - possibly it prefixed with the URL of the site if not present already + * @return string The URL returned from $this->cObj->getTypoLink_URL(); - possibly it prefixed with the URL of the site if not present already */ public function getLink($link) { @@ -661,7 +661,7 @@ public function getLink($link) 'parameter' => $link, 'forceAbsoluteUrl' => '1', 'forceAbsoluteUrl.' => [ - 'scheme' => GeneralUtility::getIndpEnv('TYPO3_SSL')?'https':'http', + 'scheme' => GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https' : 'http', ], ]); } @@ -669,14 +669,14 @@ public function getLink($link) /** * Breaking lines into fixed length lines, using MailUtility::breakLinesForEmail() * - * @param string $str The string to break - * @param string $implChar Line break character - * @param int $charWidth Length of lines, default is $this->charWidth + * @param string $str The string to break + * @param string $implChar Line break character + * @param int $charWidth Length of lines, default is $this->charWidth * - * @return string Processed string + * @return string Processed string * @see MailUtility::breakLinesForEmail() */ - public function breakLines($str, $implChar, $charWidth=0) + public function breakLines($str, $implChar, $charWidth = 0) { $cW = $charWidth ?: $this->charWidth; @@ -689,23 +689,23 @@ public function breakLines($str, $implChar, $charWidth=0) * Explodes a string with "|" and if the second part is found it will return this, otherwise the first part. * Used for many TypoScript properties used in this class since they need preceeding whitespace to be preserved. * - * @param string $str Input string + * @param string $str Input string * - * @return string Output string + * @return string Output string */ public function getString($str) { $parts = explode('|', $str); - return strcmp($parts[1], '')?$parts[1]:$parts[0]; + return strcmp($parts[1], '') ? $parts[1] : $parts[0]; } /** * Calls a user function for processing of data * - * @param string $mConfKey TypoScript property name, pointing to the definition of the user function to call (from the TypoScript array internally in this class). This array is passed to the user function. Notice that "parentObj" property is a reference to this class ($this) - * @param mixed $passVar Variable to process + * @param string $mConfKey TypoScript property name, pointing to the definition of the user function to call (from the TypoScript array internally in this class). This array is passed to the user function. Notice that "parentObj" property is a reference to this class ($this) + * @param mixed $passVar Variable to process * - * @return mixed The processed $passVar as returned by the function call + * @return mixed The processed $passVar as returned by the function call */ public function userProcess($mConfKey, $passVar) { @@ -721,10 +721,10 @@ public function userProcess($mConfKey, $passVar) * Function used by TypoScript "parseFunc" to process links in the bodytext. * Extracts the link and shows it in plain text in a parathesis next to the link text. If link was relative the site URL was prepended. * - * @param string $content Empty, ignore. - * @param array $conf TypoScript parameters + * @param string $content Empty, ignore. + * @param array $conf TypoScript parameters * - * @return string Processed output. + * @return string Processed output. * @see parseBody() */ public function atag_to_http($content, $conf) @@ -746,10 +746,10 @@ public function atag_to_http($content, $conf) /** * User function (called from TypoScript) for generating a bullet list (used in parsefunc) * - * @param string $content Empty, ignore. - * @param array $conf TypoScript parameters + * @param string $content Empty, ignore. + * @param array $conf TypoScript parameters * - * @return string Processed output. + * @return string Processed output. */ public function typolist($content, $conf) { @@ -763,10 +763,10 @@ public function typolist($content, $conf) /** * User function (called from TypoScript) for generating a typo header tag (used in parsefunc) * - * @param string $content Empty, ignore. - * @param array $conf TypoScript parameters + * @param string $content Empty, ignore. + * @param array $conf TypoScript parameters * - * @return string Processed output. + * @return string Processed output. */ public function typohead($content, $conf) { @@ -784,10 +784,10 @@ public function typohead($content, $conf) /** * User function (called from TypoScript) for generating a code listing (used in parsefunc) * - * @param string $content Empty, ignore. - * @param array $conf TypoScript parameters + * @param string $content Empty, ignore. + * @param array $conf TypoScript parameters * - * @return string Processed output. + * @return string Processed output. */ public function typocode($content, $conf) { @@ -800,9 +800,9 @@ public function typocode($content, $conf) /** * Adds language-dependent label markers * - * @param array $markerArray the input marker array + * @param array $markerArray the input marker array * - * @return array the output marker array + * @return array the output marker array */ public function addLabelsMarkers(array $markerArray) { diff --git a/Classes/Repository/FeGroupsRepository.php b/Classes/Repository/FeGroupsRepository.php index 840a472c1..17204b5bc 100644 --- a/Classes/Repository/FeGroupsRepository.php +++ b/Classes/Repository/FeGroupsRepository.php @@ -253,7 +253,7 @@ public function getFEgroupSubgroups(int $groupId): array * @param int $groupUid The groupUid. * @param int $cat The number of relations from sys_dmail_group to sysmail_categories * - * @return array The resulting array of uid's + * @return array The resulting array of uid's */ public function getIdList(array $pidArray, int $groupUid, int $cat): array { @@ -261,8 +261,8 @@ public function getIdList(array $pidArray, int $groupUid, int $cat): array $queryBuilder = $this->getQueryBuilder($this->table); // fe user group uid should be in list of fe users list of user groups - // $field = $switchTable.'.usergroup'; - // $command = $this->table.'.uid'; + // $field = $switchTable.'.usergroup'; + // $command = $this->table.'.uid'; // This approach, using standard SQL, does not work, // even when fe_users.usergroup is defined as varchar(255) instead of tinyblob // $usergroupInList = ' AND ('.$field.' LIKE \'%,\'||'.$command.'||\',%\' OR '.$field.' LIKE '.$command.'||\',%\' OR '.$field.' LIKE \'%,\'||'.$command.' OR '.$field.'='.$command.')'; diff --git a/Classes/Repository/FeUsersRepository.php b/Classes/Repository/FeUsersRepository.php index a0fdd4934..12cef206d 100644 --- a/Classes/Repository/FeUsersRepository.php +++ b/Classes/Repository/FeUsersRepository.php @@ -46,7 +46,7 @@ public function selectFeUsersByUid(int $uid, string $permsClause) //: array|bool ->fetchAllAssociative(); } - /** + /** * Returns record no matter what - except if record is deleted * * @param int $uid The uid to look up in $table @@ -81,13 +81,13 @@ public function getRawRecord(int $uid) return 0; } - /** - * Return all uid's from 'fe_users' for a static direct mail group. - * - * @param int $uid The uid of the direct_mail group - * - * @return array The resulting array of uid's - */ + /** + * Return all uid's from 'fe_users' for a static direct mail group. + * + * @param int $uid The uid of the direct_mail group + * + * @return array The resulting array of uid's + */ public function getStaticIdList(int $uid): array { $queryBuilder = $this->getQueryBuilder($this->table); @@ -170,15 +170,15 @@ public function getStaticIdList(int $uid): array * @param int $groupUid The groupUid. * @param int $cat The number of relations from sys_dmail_group to sysmail_categories * - * @return array The resulting array of uid's + * @return array The resulting array of uid's */ public function getIdList(array $pidArray, int $groupUid, int $cat): array { $queryBuilder = $this->getQueryBuilder($this->table); // fe user group uid should be in list of fe users list of user groups - // $field = $this->table.'.usergroup'; - // $command = $this->table.'.uid'; + // $field = $this->table.'.usergroup'; + // $command = $this->table.'.uid'; // This approach, using standard SQL, does not work, // even when fe_users.usergroup is defined as varchar(255) instead of tinyblob // $usergroupInList = ' AND ('.$field.' LIKE \'%,\'||'.$command.'||\',%\' OR '.$field.' LIKE '.$command.'||\',%\' OR '.$field.' LIKE \'%,\'||'.$command.' OR '.$field.'='.$command.')'; @@ -206,7 +206,8 @@ public function getIdList(array $pidArray, int $groupUid, int $cat): array $queryBuilder->expr()->eq( 'fe_users.module_sys_dmail_newsletter', 1 - )) + ) + ) ) ->orderBy($this->table . '.uid') ->addOrderBy($this->table . '.email') diff --git a/Classes/Repository/SysDmailMaillogRepository.php b/Classes/Repository/SysDmailMaillogRepository.php index a818327a0..baf8c6d61 100644 --- a/Classes/Repository/SysDmailMaillogRepository.php +++ b/Classes/Repository/SysDmailMaillogRepository.php @@ -604,7 +604,7 @@ public function hasRecentLog(array $mailLogParameters): bool ), $queryBuilder->expr()->gte( 'tstamp', - $queryBuilder->createNamedParameter($mailLogParameters['tstamp']-10, Connection::PARAM_INT) + $queryBuilder->createNamedParameter($mailLogParameters['tstamp'] - 10, Connection::PARAM_INT) ) ); @@ -639,7 +639,7 @@ public function updateSysDmailMaillogForShipOfMail(array $values) * @param int $rid Recipient UID * @param string $rtbl Recipient table * - * @return bool Number of found records + * @return bool Number of found records */ public function dmailerIsSend(int $mid, int $rid, string $rtbl): bool { @@ -739,10 +739,10 @@ public function analyzeBounceMailAddToMailLog( /** * Get IDs of recipient, which has been sent * - * @param int $mid Newsletter ID. UID of the sys_dmail record - * @param string $rtbl Recipient table + * @param int $mid Newsletter ID. UID of the sys_dmail record + * @param string $rtbl Recipient table * - * @return string list of sent recipients + * @return string list of sent recipients */ public function dmailerGetSentMails(int $mid, string $rtbl): string { diff --git a/Classes/Repository/SysDmailRepository.php b/Classes/Repository/SysDmailRepository.php index 251a09fa5..39741849e 100644 --- a/Classes/Repository/SysDmailRepository.php +++ b/Classes/Repository/SysDmailRepository.php @@ -69,8 +69,7 @@ public function countSysDmailsByPid(int $pid, bool $scheduled) //: array|bool $queryBuilder->createNamedParameter(1, Connection::PARAM_INT) ) ); - } - else { + } else { $queryBuilder->andWhere( $queryBuilder->expr()->eq( 'scheduled', diff --git a/Classes/Repository/TempRepository.php b/Classes/Repository/TempRepository.php index 264cd6cb6..880e7f944 100644 --- a/Classes/Repository/TempRepository.php +++ b/Classes/Repository/TempRepository.php @@ -5,7 +5,6 @@ namespace DirectMailTeam\DirectMail\Repository; use DirectMailTeam\DirectMail\DmQueryGenerator; -use DirectMailTeam\DirectMail\Repository\FeGroupsRepository; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; @@ -74,7 +73,7 @@ public function fetchRecordsListValues(array $listArr, string $table, array $fie * @param int $groupUid The groupUid. * @param int $cat The number of relations from sys_dmail_group to sysmail_categories * - * @return array The resulting array of uid's + * @return array The resulting array of uid's */ public function getIdList(string $table, array $pidArray, int $groupUid, int $cat): array { diff --git a/Classes/Repository/TtAddressRepository.php b/Classes/Repository/TtAddressRepository.php index 9b26f44cf..6b6dc8f2e 100644 --- a/Classes/Repository/TtAddressRepository.php +++ b/Classes/Repository/TtAddressRepository.php @@ -205,7 +205,7 @@ public function getRawRecord(int $uid) return 0; } - /** + /** * Return all uid's from 'tt_address' for a static direct mail group. * * @param int $uid The uid of the direct_mail group @@ -289,7 +289,7 @@ public function getStaticIdList(int $uid): array * @param int $groupUid The groupUid. * @param int $cat The number of relations from sys_dmail_group to sysmail_categories * - * @return array The resulting array of uid's + * @return array The resulting array of uid's */ public function getIdList(array $pidArray, int $groupUid, int $cat): array { diff --git a/Classes/Scheduler/AnalyzeBounceMailAdditionalFields.php b/Classes/Scheduler/AnalyzeBounceMailAdditionalFields.php index 50a8c71b2..0ab80bece 100644 --- a/Classes/Scheduler/AnalyzeBounceMailAdditionalFields.php +++ b/Classes/Scheduler/AnalyzeBounceMailAdditionalFields.php @@ -63,8 +63,8 @@ public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleCont if ($task) { $serviceHTML = ''; } else { $serviceHTML = '