Commit 868bf0b8 authored by Thomas Löffler's avatar Thomas Löffler

Fix all CGL violations in t3o_donation

parent fa02f051
Pipeline #5766 passed with stages
in 5 minutes and 46 seconds
......@@ -103,8 +103,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
/**
* action list
*
* @return void
*/
public function listAction()
{
......@@ -114,8 +112,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
/**
* action form
*
* @return void
*/
public function formAction()
{
......@@ -132,8 +128,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
/**
* action thankyou
*
* @return void
*/
public function thankyouAction()
{
......@@ -154,8 +148,6 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
/**
* action ipn log
*
* @return void
*/
public function ipnLogAction()
{
......@@ -164,11 +156,11 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
$verified = $this->ipnService->verify($parameters, $this->getConfigurationOption('paypal.action'));
if (!$verified) {
$this->addFlashMessage('Payment verification failed','Paypal transaction',\TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
$this->addFlashMessage('Payment verification failed', 'Paypal transaction', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
return;
}
if (!$this->ipnService->isNewCompletedTransaction($parameters, $this->donationRepository)) {
$this->addFlashMessage('isNewCompletedTransaction == false','Paypal transaction',\TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
$this->addFlashMessage('isNewCompletedTransaction == false', 'Paypal transaction', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
return;
}
$donation = $this->ipnService->createDonation($parameters);
......@@ -186,16 +178,16 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
protected function sendNotificationMail($donation)
{
if (isset($this->settings['fromName']) && $this->settings['fromName'] !== '') {
$from = array($this->settings['fromAddress'] => $this->settings['fromName']);
$from = [$this->settings['fromAddress'] => $this->settings['fromName']];
} else {
$from = array($this->settings['fromAddress']);
$from = [$this->settings['fromAddress']];
}
if (isset($this->settings['replyToName']) && $this->settings['replyToName'] !== '') {
$replyTo = array($this->settings['replyToAddress'] => $this->settings['replyToName']);
$replyTo = [$this->settings['replyToAddress'] => $this->settings['replyToName']];
} elseif (isset($this->settings['replyToAddress']) && $this->settings['replyToAddress'] !== '') {
$replyTo = array($this->settings['replyToAddress']);
$replyTo = [$this->settings['replyToAddress']];
} else {
$replyTo = array();
$replyTo = [];
}
return $this->mailService->sendDonationNotification(
$donation,
......@@ -211,16 +203,16 @@ class DonationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
protected function sendThankyouMail($donation)
{
if (isset($this->settings['fromName']) && $this->settings['fromName'] !== '') {
$from = array($this->settings['fromAddress'] => $this->settings['fromName']);
$from = [$this->settings['fromAddress'] => $this->settings['fromName']];
} else {
$from = array($this->settings['fromAddress']);
$from = [$this->settings['fromAddress']];
}
if (isset($this->settings['replyToName']) && $this->settings['replyToName'] !== '') {
$replyTo = array($this->settings['replyToAddress'] => $this->settings['replyToName']);
$replyTo = [$this->settings['replyToAddress'] => $this->settings['replyToName']];
} elseif (isset($this->settings['replyToAddress']) && $this->settings['replyToAddress'] !== '') {
$replyTo = array($this->settings['replyToAddress']);
$replyTo = [$this->settings['replyToAddress']];
} else {
$replyTo = array();
$replyTo = [];
}
return $this->mailService->sendDonationThankyou(
$donation,
......
......@@ -427,7 +427,6 @@ class Donation extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
return $this->date;
}
/**
* @return \DateTime
*/
......
......@@ -20,5 +20,4 @@ namespace T3o\T3oDonation\Domain\Repository;
*/
class AccountRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}
......@@ -13,7 +13,6 @@ namespace T3o\T3oDonation\Domain\Repository;
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
......@@ -22,8 +21,8 @@ use TYPO3\CMS\Extbase\Persistence\QueryInterface;
*/
class DonationRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
protected $defaultOrderings = array(
protected $defaultOrderings = [
'crdate' => QueryInterface::ORDER_DESCENDING,
'date' => QueryInterface::ORDER_DESCENDING,
);
];
}
......@@ -2,7 +2,7 @@
namespace T3o\T3oDonation\Service;
use T3o\T3oDonation\Domain\Model\Donation;
use \TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
......@@ -45,9 +45,9 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
{
$extPath = ExtensionManagementUtility::extPath('t3o_donation');
$oView = $this->objectManager->get('TYPO3\CMS\Fluid\View\StandaloneView');
$oView->setTemplateRootPaths(array($extPath . 'Resources/Private/Templates/Mail'));
$oView->setPartialRootPaths(array($extPath . 'Resources/Private/Partials'));
$oView->setLayoutRootPaths(array($extPath . 'Resources/Private/Layouts/'));
$oView->setTemplateRootPaths([$extPath . 'Resources/Private/Templates/Mail']);
$oView->setPartialRootPaths([$extPath . 'Resources/Private/Partials']);
$oView->setLayoutRootPaths([$extPath . 'Resources/Private/Layouts/']);
return $oView;
}
......@@ -59,7 +59,7 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
* @param array $replyTo
* @return bool
*/
public function sendDonationNotification(Donation $donation, $from, $replyTo = array())
public function sendDonationNotification(Donation $donation, $from, $replyTo = [])
{
$oView = $this->getMailView();
$oView->setTemplate('Notification');
......@@ -80,11 +80,11 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
$this->mailMessage->setSubject(LocalizationUtility::translate(
'mail_notification_subject',
't3o_donation',
array($account->getName(), $siteUrl)
[$account->getName(), $siteUrl]
));
$this->mailMessage->setTo(array(
$this->mailMessage->setTo([
$account->getEmailNotification() => $account->getName()
));
]);
$this->mailMessage->setFrom($from);
if (!empty($replyTo)) {
$this->mailMessage->setReplyTo($replyTo);
......@@ -105,7 +105,7 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
* @param array $replyTo
* @return bool
*/
public function sendDonationThankyou(Donation $donation, $subject, $bodyText, $from, $replyTo = array())
public function sendDonationThankyou(Donation $donation, $subject, $bodyText, $from, $replyTo = [])
{
$oView = $this->getMailView();
$oView->setTemplate('Thankyou');
......@@ -125,9 +125,9 @@ class Mail implements \TYPO3\CMS\Core\SingletonInterface
}
$this->mailMessage->setBody($body, 'text/html');
$this->mailMessage->setSubject($subject);
$this->mailMessage->setTo(array(
$this->mailMessage->setTo([
$donation->getEmail() => $donation->getName()
));
]);
$this->mailMessage->setFrom($from);
if (!empty($replyTo)) {
$this->mailMessage->setReplyTo($replyTo);
......
......@@ -72,7 +72,7 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface
$logger = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__);
$logger->debug('Verifing PayPal IPN', $parameters);
$formData = array_merge($parameters, array('cmd' => '_notify-validate'));
$formData = array_merge($parameters, ['cmd' => '_notify-validate']);
$additionalOptions = [
'form_params' => $formData,
];
......@@ -84,7 +84,7 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface
if ($response->getStatusCode() !== 200) {
$logger->debug(
'Wrong status code for IPN verification.',
array('HTTP status' => $response->getStatusCode())
['HTTP status' => $response->getStatusCode()]
);
return false;
}
......@@ -92,7 +92,7 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface
$paypalResponse = $response->getBody()->getContents();
$logger->debug(
'Got response for IPN verification.',
array('body' => $paypalResponse)
['body' => $paypalResponse]
);
if ($paypalResponse !== 'VERIFIED') {
......@@ -169,12 +169,12 @@ class PayPalIpn implements \TYPO3\CMS\Core\SingletonInterface
return $donation;
// url parse from memo?
}
protected function findUrl($haystack = '') {
protected function findUrl($haystack = '')
{
$url = '';
$matches = array();
$matches = [];
if (preg_match('/\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]/i', $haystack, $matches)) {
$url = $matches[0];
......
<?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
die('Access denied.');
}
return array(
'ctrl' => array(
'title' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account',
'label' => 'name',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'default_sortby' => "ORDER BY name",
'delete' => 'deleted',
'enablecolumns' => array(
return [
'ctrl' => [
'title' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account',
'label' => 'name',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'default_sortby' => 'ORDER BY name',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
),
],
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3o_donation') . 'Configuration/TCA/tx_t3odonation_domain_model_account.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3o_donation') . 'Resources/Public/Icons/tx_t3odonation_domain_model_account.gif',
'dividers2tabs' => true,
),
'interface' => array(
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3o_donation') . 'Resources/Public/Icons/tx_t3odonation_domain_model_account.gif',
'dividers2tabs' => true,
],
'interface' => [
'showRecordFieldList' => 'hidden,name,email_notification,email_paypal'
),
'columns' => array(
'hidden' => array(
],
'columns' => [
'hidden' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => array(
'type' => 'check',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
'default' => '0'
)
),
'name' => array(
]
],
'name' => [
'exclude' => 0,
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.name',
'config' => array(
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.name',
'config' => [
'type' => 'input',
'size' => '30',
'eval' => 'required,trim',
)
),
'email_notification' => array(
]
],
'email_notification' => [
'exclude' => 0,
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.email_notification',
'config' => array(
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.email_notification',
'config' => [
'type' => 'input',
'size' => '30',
'eval' => 'trim',
)
),
'email_paypal' => array(
]
],
'email_paypal' => [
'exclude' => 0,
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.email_paypal',
'config' => array(
'label' => 'LLL:EXT:t3o_donation/Resources/Private/Language/locallang_db.xlf:tx_t3odonation_domain_model_account.email_paypal',
'config' => [
'type' => 'input',
'size' => '30',
'eval' => 'trim',
)
),
),
'types' => array(
'0' => array('showitem' => 'hidden;;;;1-1-1, name, email_notification, email_paypal')
),
'palettes' => array()
);
]
],
],
'types' => [
'0' => ['showitem' => 'hidden;;;;1-1-1, name, email_notification, email_paypal']
],
'palettes' => []
];
<?php
########################################################################
# Extension Manager/Repository config file for ext "donation".
#
# Auto generated 18-04-2011 11:46
#
# Manual updates:
# Only the data in the array - everything else is removed by next
# writing. "version" and "dependencies" must not be touched!
########################################################################
//#######################################################################
// Extension Manager/Repository config file for ext "donation".
//
// Auto generated 18-04-2011 11:46
//
// Manual updates:
// Only the data in the array - everything else is removed by next
// writing. "version" and "dependencies" must not be touched!
//#######################################################################
$EM_CONF[$_EXTKEY] = array(
'title' => 't3o_donation',
'description' => 'An extension to make donations. Used on typo3.org',
'category' => 'plugin',
'author' => 'Sebastian Diez, Rostyslav Matviyiv',
'author_email' => 't3o@typo3.org',
'shy' => '',
'dependencies' => 'cms',
'conflicts' => '',
'priority' => '',
'module' => '',
'state' => 'beta',
'internal' => '',
'uploadfolder' => 0,
'createDirs' => '',
'modify_tables' => '',
$EM_CONF[$_EXTKEY] = [
'title' => 't3o_donation',
'description' => 'An extension to make donations. Used on typo3.org',
'category' => 'plugin',
'author' => 'Sebastian Diez, Rostyslav Matviyiv',
'author_email' => 't3o@typo3.org',
'shy' => '',
'dependencies' => 'cms',
'conflicts' => '',
'priority' => '',
'module' => '',
'state' => 'beta',
'internal' => '',
'uploadfolder' => 0,
'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'lockType' => '',
'author_company' => '',
'version' => '0.9.2',
'constraints' => array(
'depends' => array(),
'conflicts' => array(),
'suggests' => array(),
),
'suggests' => array(),
);
?>
'lockType' => '',
'author_company' => '',
'version' => '0.9.2',
'constraints' => [
'depends' => [],
'conflicts' => [],
'suggests' => [],
],
'suggests' => [],
];
<?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
die('Access denied.');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'T3o.' . $_EXTKEY,
'List',
array(
[
'Donation' => 'list',
),
// non-cacheable actions
array(
],
[
'Donation' => 'list',
)
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'T3o.' . $_EXTKEY,
'Form',
array(
[
'Donation' => 'form, thankyou, ipnlog',
),
// non-cacheable actions
array(
],
[
'Donation' => 'form, thankyou, ipnlog',
)
]
);
// include settings for RTE fields
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['custom'] = 'EXT:t3olayout/Configuration/Yaml/Rte/Custom.yaml';
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['nolink'] = 'EXT:t3olayout/Configuration/Yaml/Rte/Nolink.yaml';
\ No newline at end of file
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['nolink'] = 'EXT:t3olayout/Configuration/Yaml/Rte/Nolink.yaml';
<?php
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
......@@ -40,10 +40,8 @@ if (!defined ('TYPO3_MODE')) {
);
$pluginSignature = 't3odonation_form';
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] =
'layout,select_key';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] =
'pi_flexform';
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment