From d44cdba5034e11200f424585e2a1b31fcd71eab9 Mon Sep 17 00:00:00 2001 From: Leo Feyer Date: Fri, 27 Sep 2019 15:18:15 +0200 Subject: [PATCH 1/3] Backport 'Add a more sophisticated PHP-CS-Fixer configuration' --- src/Resources/contao/classes/Newsletter.php | 43 ++++++++--------- src/Resources/contao/dca/tl_module.php | 3 +- src/Resources/contao/dca/tl_newsletter.php | 27 +++++------ .../contao/dca/tl_newsletter_blacklist.php | 1 - .../contao/dca/tl_newsletter_channel.php | 25 +++++----- .../contao/dca/tl_newsletter_recipients.php | 48 +++++++++---------- src/Resources/contao/dca/tl_user.php | 8 ++-- src/Resources/contao/dca/tl_user_group.php | 6 +-- .../models/NewsletterBlacklistModel.php | 1 - .../contao/models/NewsletterChannelModel.php | 1 - .../contao/models/NewsletterModel.php | 1 - .../models/NewsletterRecipientsModel.php | 1 - .../contao/modules/ModuleNewsletterList.php | 1 - .../contao/modules/ModuleNewsletterReader.php | 1 - .../contao/modules/ModuleSubscribe.php | 3 +- .../contao/modules/ModuleUnsubscribe.php | 3 +- 16 files changed, 80 insertions(+), 93 deletions(-) diff --git a/src/Resources/contao/classes/Newsletter.php b/src/Resources/contao/classes/Newsletter.php index 864344b73..5c8cfc8b4 100644 --- a/src/Resources/contao/classes/Newsletter.php +++ b/src/Resources/contao/classes/Newsletter.php @@ -20,7 +20,6 @@ */ class Newsletter extends \Backend { - /** * Return a form to choose an existing style sheet and import it * @@ -232,9 +231,9 @@ public function send(DataContainer $dc) // Preview newsletter $return = \Message::generate() . '
-'.$GLOBALS['TL_LANG']['MSC']['backBT'].' +' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '
-
+
@@ -284,7 +283,7 @@ public function send(DataContainer $dc)

- ' . (isset($_SESSION['TL_PREVIEW_MAIL_ERROR']) ? ' + ' . (isset($_SESSION['TL_PREVIEW_MAIL_ERROR']) ? '
' . $GLOBALS['TL_LANG']['ERR']['email'] . '
' : (($GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] && \Config::get('showHelp')) ? '

' . $GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] . '

' : '')) . '
@@ -295,8 +294,8 @@ public function send(DataContainer $dc)
- - + +
@@ -473,7 +472,7 @@ public function importRecipients() $arrRecipients = array(); $resFile = $objFile->handle; - while(($arrRow = @fgetcsv($resFile, null, $strSeparator)) !== false) + while (($arrRow = @fgetcsv($resFile, null, $strSeparator)) !== false) { $arrRecipients = array_merge($arrRecipients, $arrRow); } @@ -530,29 +529,29 @@ public function importRecipients() // Return form return ' -'.\Message::generate().' - +' . \Message::generate() . ' +
- - + +
-

+

'.(($GLOBALS['TL_LANG']['MSC']['separator'][1] != '') ? ' -

'.$GLOBALS['TL_LANG']['MSC']['separator'][1].'

' : '').' + + + + + ' . (($GLOBALS['TL_LANG']['MSC']['separator'][1] != '') ? ' +

' . $GLOBALS['TL_LANG']['MSC']['separator'][1] . '

' : '') . '
-

'.$GLOBALS['TL_LANG']['MSC']['source'][0].'

'.$objUploader->generateMarkup().(isset($GLOBALS['TL_LANG']['MSC']['source'][1]) ? ' -

'.$GLOBALS['TL_LANG']['MSC']['source'][1].'

' : '').' +

' . $GLOBALS['TL_LANG']['MSC']['source'][0] . '

' . $objUploader->generateMarkup() . (isset($GLOBALS['TL_LANG']['MSC']['source'][1]) ? ' +

' . $GLOBALS['TL_LANG']['MSC']['source'][1] . '

' : '') . '
@@ -561,7 +560,7 @@ public function importRecipients()
- +
diff --git a/src/Resources/contao/dca/tl_module.php b/src/Resources/contao/dca/tl_module.php index 257192e66..9acca2563 100644 --- a/src/Resources/contao/dca/tl_module.php +++ b/src/Resources/contao/dca/tl_module.php @@ -88,7 +88,6 @@ */ class tl_module_newsletter extends Backend { - /** * Import the back end user object */ @@ -139,7 +138,7 @@ public function getUnsubscribeDefault($varValue) */ public function getChannels() { - if (!$this->User->isAdmin && !\is_array($this->User->newsletters)) + if (!$this->User->isAdmin && !is_array($this->User->newsletters)) { return array(); } diff --git a/src/Resources/contao/dca/tl_newsletter.php b/src/Resources/contao/dca/tl_newsletter.php index add1a35a8..225e48660 100644 --- a/src/Resources/contao/dca/tl_newsletter.php +++ b/src/Resources/contao/dca/tl_newsletter.php @@ -10,7 +10,6 @@ $GLOBALS['TL_DCA']['tl_newsletter'] = array ( - // Config 'config' => array ( @@ -270,7 +269,6 @@ */ class tl_newsletter extends Backend { - /** * Import the back end user object */ @@ -293,7 +291,7 @@ public function checkPermission() } // Set root IDs - if (empty($this->User->newsletters) || !\is_array($this->User->newsletters)) + if (empty($this->User->newsletters) || !is_array($this->User->newsletters)) { $root = array(0); } @@ -302,21 +300,22 @@ public function checkPermission() $root = $this->User->newsletters; } - $id = \strlen(Input::get('id')) ? Input::get('id') : CURRENT_ID; + $id = strlen(Input::get('id')) ? Input::get('id') : CURRENT_ID; // Check current action switch (Input::get('act')) { case 'paste': case 'select': - if (!\in_array(CURRENT_ID, $root)) // check CURRENT_ID here (see #247) + // Check CURRENT_ID here (see #247) + if (!in_array(CURRENT_ID, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } break; case 'create': - if (!\strlen(Input::get('pid')) || !\in_array(Input::get('pid'), $root)) + if (!strlen(Input::get('pid')) || !in_array(Input::get('pid'), $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to create newsletters in channel ID ' . Input::get('pid') . '.'); } @@ -324,11 +323,11 @@ public function checkPermission() case 'cut': case 'copy': - if (!\in_array(Input::get('pid'), $root)) + if (!in_array(Input::get('pid'), $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Input::get('act') . ' newsletter ID ' . $id . ' to channel ID ' . Input::get('pid') . '.'); } - // NO BREAK STATEMENT HERE + // no break case 'edit': case 'show': @@ -342,7 +341,7 @@ public function checkPermission() throw new Contao\CoreBundle\Exception\AccessDeniedException('Invalid newsletter ID ' . $id . '.'); } - if (!\in_array($objChannel->pid, $root)) + if (!in_array($objChannel->pid, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Input::get('act') . ' newsletter ID ' . $id . ' of newsletter channel ID ' . $objChannel->pid . '.'); } @@ -353,7 +352,7 @@ public function checkPermission() case 'overrideAll': case 'cutAll': case 'copyAll': - if (!\in_array($id, $root)) + if (!in_array($id, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } @@ -370,7 +369,7 @@ public function checkPermission() break; default: - if (\strlen(Input::get('act'))) + if (strlen(Input::get('act'))) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Invalid command "' . Input::get('act') . '".'); } @@ -386,12 +385,12 @@ public function checkPermission() throw new Contao\CoreBundle\Exception\AccessDeniedException('Invalid newsletter ID ' . $id . '.'); } - if (!\in_array($objChannel->pid, $root)) + if (!in_array($objChannel->pid, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to send newsletter ID ' . $id . ' of newsletter channel ID ' . $objChannel->pid . '.'); } } - elseif (!\in_array($id, $root)) + elseif (!in_array($id, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } @@ -425,7 +424,7 @@ public function listNewsletters($arrRow) */ public function convertAbsoluteLinks($strContent) { - return str_replace('src="' .Environment::get('base'), 'src="', $strContent); + return str_replace('src="' . Environment::get('base'), 'src="', $strContent); } /** diff --git a/src/Resources/contao/dca/tl_newsletter_blacklist.php b/src/Resources/contao/dca/tl_newsletter_blacklist.php index cf8d32a8a..b47a49544 100644 --- a/src/Resources/contao/dca/tl_newsletter_blacklist.php +++ b/src/Resources/contao/dca/tl_newsletter_blacklist.php @@ -10,7 +10,6 @@ $GLOBALS['TL_DCA']['tl_newsletter_blacklist'] = array ( - // Config 'config' => array ( diff --git a/src/Resources/contao/dca/tl_newsletter_channel.php b/src/Resources/contao/dca/tl_newsletter_channel.php index dbefe8cde..066651e35 100644 --- a/src/Resources/contao/dca/tl_newsletter_channel.php +++ b/src/Resources/contao/dca/tl_newsletter_channel.php @@ -10,7 +10,6 @@ $GLOBALS['TL_DCA']['tl_newsletter_channel'] = array ( - // Config 'config' => array ( @@ -181,7 +180,6 @@ */ class tl_newsletter_channel extends Backend { - /** * Import the back end user object */ @@ -204,7 +202,7 @@ public function checkPermission() } // Set root IDs - if (empty($this->User->newsletters) || !\is_array($this->User->newsletters)) + if (empty($this->User->newsletters) || !is_array($this->User->newsletters)) { $root = array(0); } @@ -234,14 +232,14 @@ public function checkPermission() case 'edit': // Dynamically add the record to the user profile - if (!\in_array(Input::get('id'), $root)) + if (!in_array(Input::get('id'), $root)) { /** @var Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface $objSessionBag */ $objSessionBag = $objSession->getBag('contao_backend'); $arrNew = $objSessionBag->get('new_records'); - if (\is_array($arrNew['tl_newsletter_channel']) && \in_array(Input::get('id'), $arrNew['tl_newsletter_channel'])) + if (is_array($arrNew['tl_newsletter_channel']) && in_array(Input::get('id'), $arrNew['tl_newsletter_channel'])) { // Add the permissions on group level if ($this->User->inherit != 'custom') @@ -252,7 +250,7 @@ public function checkPermission() { $arrNewsletterp = StringUtil::deserialize($objGroup->newsletterp); - if (\is_array($arrNewsletterp) && \in_array('create', $arrNewsletterp)) + if (is_array($arrNewsletterp) && in_array('create', $arrNewsletterp)) { $arrNewsletters = StringUtil::deserialize($objGroup->newsletters, true); $arrNewsletters[] = Input::get('id'); @@ -272,7 +270,7 @@ public function checkPermission() $arrNewsletterp = StringUtil::deserialize($objUser->newsletterp); - if (\is_array($arrNewsletterp) && \in_array('create', $arrNewsletterp)) + if (is_array($arrNewsletterp) && in_array('create', $arrNewsletterp)) { $arrNewsletters = StringUtil::deserialize($objUser->newsletters, true); $arrNewsletters[] = Input::get('id'); @@ -287,12 +285,12 @@ public function checkPermission() $this->User->newsletter = $root; } } - // No break; + // no break case 'copy': case 'delete': case 'show': - if (!\in_array(Input::get('id'), $root) || (Input::get('act') == 'delete' && !$this->User->hasAccess('delete', 'newsletterp'))) + if (!in_array(Input::get('id'), $root) || (Input::get('act') == 'delete' && !$this->User->hasAccess('delete', 'newsletterp'))) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Input::get('act') . ' newsletter channel ID ' . Input::get('id') . '.'); } @@ -302,6 +300,7 @@ public function checkPermission() case 'deleteAll': case 'overrideAll': $session = $objSession->all(); + if (Input::get('act') == 'deleteAll' && !$this->User->hasAccess('delete', 'newsletterp')) { $session['CURRENT']['IDS'] = array(); @@ -314,7 +313,7 @@ public function checkPermission() break; default: - if (\strlen(Input::get('act'))) + if (strlen(Input::get('act'))) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Input::get('act') . ' newsletter channels.'); } @@ -336,7 +335,7 @@ public function checkPermission() */ public function editHeader($row, $href, $label, $title, $icon, $attributes) { - return $this->User->canEditFieldsOf('tl_newsletter_channel') ? ''.Image::getHtml($icon, $label).' ' : Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)).' '; + return $this->User->canEditFieldsOf('tl_newsletter_channel') ? '' . Image::getHtml($icon, $label) . ' ' : Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)) . ' '; } /** @@ -353,7 +352,7 @@ public function editHeader($row, $href, $label, $title, $icon, $attributes) */ public function copyChannel($row, $href, $label, $title, $icon, $attributes) { - return $this->User->hasAccess('create', 'newsletterp') ? ''.Image::getHtml($icon, $label).' ' : Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)).' '; + return $this->User->hasAccess('create', 'newsletterp') ? '' . Image::getHtml($icon, $label) . ' ' : Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)) . ' '; } /** @@ -370,6 +369,6 @@ public function copyChannel($row, $href, $label, $title, $icon, $attributes) */ public function deleteChannel($row, $href, $label, $title, $icon, $attributes) { - return $this->User->hasAccess('delete', 'newsletterp') ? ''.Image::getHtml($icon, $label).' ' : Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)).' '; + return $this->User->hasAccess('delete', 'newsletterp') ? '' . Image::getHtml($icon, $label) . ' ' : Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)) . ' '; } } diff --git a/src/Resources/contao/dca/tl_newsletter_recipients.php b/src/Resources/contao/dca/tl_newsletter_recipients.php index b82872144..76e6d227d 100644 --- a/src/Resources/contao/dca/tl_newsletter_recipients.php +++ b/src/Resources/contao/dca/tl_newsletter_recipients.php @@ -10,7 +10,6 @@ $GLOBALS['TL_DCA']['tl_newsletter_recipients'] = array ( - // Config 'config' => array ( @@ -198,7 +197,6 @@ */ class tl_newsletter_recipients extends Backend { - /** * Import the back end user object */ @@ -221,7 +219,7 @@ public function checkPermission() } // Set root IDs - if (empty($this->User->newsletters) || !\is_array($this->User->newsletters)) + if (empty($this->User->newsletters) || !is_array($this->User->newsletters)) { $root = array(0); } @@ -230,21 +228,22 @@ public function checkPermission() $root = $this->User->newsletters; } - $id = \strlen(Input::get('id')) ? Input::get('id') : CURRENT_ID; + $id = strlen(Input::get('id')) ? Input::get('id') : CURRENT_ID; // Check current action switch (Input::get('act')) { case 'paste': case 'select': - if (!\in_array(CURRENT_ID, $root)) // check CURRENT_ID here (see #247) + // Check CURRENT_ID here (see #247) + if (!in_array(CURRENT_ID, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } break; case 'create': - if (!\strlen(Input::get('pid')) || !\in_array(Input::get('pid'), $root)) + if (!strlen(Input::get('pid')) || !in_array(Input::get('pid'), $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to create newsletters recipients in channel ID ' . Input::get('pid') . '.'); } @@ -252,11 +251,11 @@ public function checkPermission() case 'cut': case 'copy': - if (!\in_array(Input::get('pid'), $root)) + if (!in_array(Input::get('pid'), $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Input::get('act') . ' newsletter recipient ID ' . $id . ' to channel ID ' . Input::get('pid') . '.'); } - // NO BREAK STATEMENT HERE + // no break case 'edit': case 'show': @@ -271,7 +270,7 @@ public function checkPermission() throw new Contao\CoreBundle\Exception\AccessDeniedException('Invalid newsletter recipient ID ' . $id . '.'); } - if (!\in_array($objRecipient->pid, $root)) + if (!in_array($objRecipient->pid, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Input::get('act') . ' recipient ID ' . $id . ' of newsletter channel ID ' . $objRecipient->pid . '.'); } @@ -282,7 +281,7 @@ public function checkPermission() case 'overrideAll': case 'cutAll': case 'copyAll': - if (!\in_array($id, $root)) + if (!in_array($id, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } @@ -299,11 +298,12 @@ public function checkPermission() break; default: - if (\strlen(Input::get('act'))) + if (strlen(Input::get('act'))) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Invalid command "' . Input::get('act') . '".'); } - elseif (!\in_array($id, $root)) + + if (!in_array($id, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter recipient ID ' . $id . '.'); } @@ -405,7 +405,7 @@ public function listRecipient($row) */ public function toggleIcon($row, $href, $label, $title, $icon, $attributes) { - if (\strlen(Input::get('tid'))) + if (strlen(Input::get('tid'))) { $this->toggleVisibility(Input::get('tid'), (Input::get('state') == 1), (@func_get_arg(12) ?: null)); $this->redirect($this->getReferer()); @@ -417,14 +417,14 @@ public function toggleIcon($row, $href, $label, $title, $icon, $attributes) return ''; } - $href .= '&tid='.$row['id'].'&state='.($row['active'] ? '' : 1); + $href .= '&tid=' . $row['id'] . '&state=' . ($row['active'] ? '' : 1); if (!$row['active']) { $icon = 'invisible.svg'; } - return ''.Image::getHtml($icon, $label, 'data-state="' . ($row['active'] ? 1 : 0) . '"').' '; + return '' . Image::getHtml($icon, $label, 'data-state="' . ($row['active'] ? 1 : 0) . '"') . ' '; } /** @@ -448,16 +448,16 @@ public function toggleVisibility($intId, $blnVisible, DataContainer $dc=null) } // Trigger the onload_callback - if (\is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onload_callback'])) + if (is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onload_callback'])) { foreach ($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onload_callback'] as $callback) { - if (\is_array($callback)) + if (is_array($callback)) { $this->import($callback[0]); $this->{$callback[0]}->{$callback[1]}($dc); } - elseif (\is_callable($callback)) + elseif (is_callable($callback)) { $callback($dc); } @@ -487,16 +487,16 @@ public function toggleVisibility($intId, $blnVisible, DataContainer $dc=null) $objVersions->initialize(); // Trigger the save_callback - if (\is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['fields']['active']['save_callback'])) + if (is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['fields']['active']['save_callback'])) { foreach ($GLOBALS['TL_DCA']['tl_newsletter_recipients']['fields']['active']['save_callback'] as $callback) { - if (\is_array($callback)) + if (is_array($callback)) { $this->import($callback[0]); $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc); } - elseif (\is_callable($callback)) + elseif (is_callable($callback)) { $blnVisible = $callback($blnVisible, $dc); } @@ -516,16 +516,16 @@ public function toggleVisibility($intId, $blnVisible, DataContainer $dc=null) } // Trigger the onsubmit_callback - if (\is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onsubmit_callback'])) + if (is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onsubmit_callback'])) { foreach ($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onsubmit_callback'] as $callback) { - if (\is_array($callback)) + if (is_array($callback)) { $this->import($callback[0]); $this->{$callback[0]}->{$callback[1]}($dc); } - elseif (\is_callable($callback)) + elseif (is_callable($callback)) { $callback($dc); } diff --git a/src/Resources/contao/dca/tl_user.php b/src/Resources/contao/dca/tl_user.php index 6c4d3eb9d..f06cc89ae 100644 --- a/src/Resources/contao/dca/tl_user.php +++ b/src/Resources/contao/dca/tl_user.php @@ -10,10 +10,10 @@ // Extend the default palettes Contao\CoreBundle\DataContainer\PaletteManipulator::create() - ->addLegend('newsletter_legend', 'amg_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_BEFORE) - ->addField(array('newsletters', 'newsletterp'), 'newsletter_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) - ->applyToPalette('extend', 'tl_user') - ->applyToPalette('custom', 'tl_user') + ->addLegend('newsletter_legend', 'amg_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_BEFORE) + ->addField(array('newsletters', 'newsletterp'), 'newsletter_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) + ->applyToPalette('extend', 'tl_user') + ->applyToPalette('custom', 'tl_user') ; // Add fields to tl_user_group diff --git a/src/Resources/contao/dca/tl_user_group.php b/src/Resources/contao/dca/tl_user_group.php index 3c891dcb4..2b6372520 100644 --- a/src/Resources/contao/dca/tl_user_group.php +++ b/src/Resources/contao/dca/tl_user_group.php @@ -10,9 +10,9 @@ // Extend the default palette Contao\CoreBundle\DataContainer\PaletteManipulator::create() - ->addLegend('newsletter_legend', 'amg_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_BEFORE) - ->addField(array('newsletters', 'newsletterp'), 'newsletter_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) - ->applyToPalette('default', 'tl_user_group') + ->addLegend('newsletter_legend', 'amg_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_BEFORE) + ->addField(array('newsletters', 'newsletterp'), 'newsletter_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) + ->applyToPalette('default', 'tl_user_group') ; // Add fields to tl_user_group diff --git a/src/Resources/contao/models/NewsletterBlacklistModel.php b/src/Resources/contao/models/NewsletterBlacklistModel.php index a5cb0a369..5b42c5270 100644 --- a/src/Resources/contao/models/NewsletterBlacklistModel.php +++ b/src/Resources/contao/models/NewsletterBlacklistModel.php @@ -37,7 +37,6 @@ */ class NewsletterBlacklistModel extends \Model { - /** * Table name * @var string diff --git a/src/Resources/contao/models/NewsletterChannelModel.php b/src/Resources/contao/models/NewsletterChannelModel.php index 9fe593893..b275a4625 100644 --- a/src/Resources/contao/models/NewsletterChannelModel.php +++ b/src/Resources/contao/models/NewsletterChannelModel.php @@ -54,7 +54,6 @@ */ class NewsletterChannelModel extends \Model { - /** * Table name * @var string diff --git a/src/Resources/contao/models/NewsletterModel.php b/src/Resources/contao/models/NewsletterModel.php index f5cc15db4..a1031bd5b 100644 --- a/src/Resources/contao/models/NewsletterModel.php +++ b/src/Resources/contao/models/NewsletterModel.php @@ -91,7 +91,6 @@ */ class NewsletterModel extends \Model { - /** * Table name * @var string diff --git a/src/Resources/contao/models/NewsletterRecipientsModel.php b/src/Resources/contao/models/NewsletterRecipientsModel.php index 20f8be3b2..8019a3d82 100644 --- a/src/Resources/contao/models/NewsletterRecipientsModel.php +++ b/src/Resources/contao/models/NewsletterRecipientsModel.php @@ -66,7 +66,6 @@ */ class NewsletterRecipientsModel extends \Model { - /** * Table name * @var string diff --git a/src/Resources/contao/modules/ModuleNewsletterList.php b/src/Resources/contao/modules/ModuleNewsletterList.php index d27c97c73..42ab39b94 100644 --- a/src/Resources/contao/modules/ModuleNewsletterList.php +++ b/src/Resources/contao/modules/ModuleNewsletterList.php @@ -21,7 +21,6 @@ */ class ModuleNewsletterList extends \Module { - /** * Template * @var string diff --git a/src/Resources/contao/modules/ModuleNewsletterReader.php b/src/Resources/contao/modules/ModuleNewsletterReader.php index f3b16dca6..21c8cf07c 100644 --- a/src/Resources/contao/modules/ModuleNewsletterReader.php +++ b/src/Resources/contao/modules/ModuleNewsletterReader.php @@ -22,7 +22,6 @@ */ class ModuleNewsletterReader extends \Module { - /** * Template * @var string diff --git a/src/Resources/contao/modules/ModuleSubscribe.php b/src/Resources/contao/modules/ModuleSubscribe.php index 48a778678..febe5856f 100644 --- a/src/Resources/contao/modules/ModuleSubscribe.php +++ b/src/Resources/contao/modules/ModuleSubscribe.php @@ -24,7 +24,6 @@ */ class ModuleSubscribe extends \Module { - /** * Template * @var string @@ -96,7 +95,7 @@ protected function compile() { $arrField = array ( - 'name' => 'subscribe_'.$this->id, + 'name' => 'subscribe_' . $this->id, 'label' => $GLOBALS['TL_LANG']['MSC']['securityQuestion'], 'inputType' => 'captcha', 'eval' => array('mandatory'=>true) diff --git a/src/Resources/contao/modules/ModuleUnsubscribe.php b/src/Resources/contao/modules/ModuleUnsubscribe.php index 645192eac..1eb68d7ef 100644 --- a/src/Resources/contao/modules/ModuleUnsubscribe.php +++ b/src/Resources/contao/modules/ModuleUnsubscribe.php @@ -24,7 +24,6 @@ */ class ModuleUnsubscribe extends \Module { - /** * Template * @var string @@ -88,7 +87,7 @@ protected function compile() { $arrField = array ( - 'name' => 'unsubscribe_'.$this->id, + 'name' => 'unsubscribe_' . $this->id, 'label' => $GLOBALS['TL_LANG']['MSC']['securityQuestion'], 'inputType' => 'captcha', 'eval' => array('mandatory'=>true) From 93f5fd7167caa731e9c5c146121f5a6535dd7510 Mon Sep 17 00:00:00 2001 From: Leo Feyer Date: Fri, 27 Sep 2019 23:02:57 +0200 Subject: [PATCH 2/3] Backport 'Add a more sophisticated PHP-CS-Fixer configuration' --- src/Resources/contao/classes/Newsletter.php | 43 +++++++++---------- src/Resources/contao/dca/tl_module.php | 3 +- src/Resources/contao/dca/tl_newsletter.php | 23 +++++----- .../contao/dca/tl_newsletter_blacklist.php | 1 - .../contao/dca/tl_newsletter_channel.php | 25 ++++++----- .../contao/dca/tl_newsletter_recipients.php | 41 +++++++++--------- src/Resources/contao/dca/tl_user.php | 8 ++-- src/Resources/contao/dca/tl_user_group.php | 6 +-- .../models/NewsletterBlacklistModel.php | 1 - .../contao/models/NewsletterChannelModel.php | 1 - .../contao/models/NewsletterModel.php | 1 - .../models/NewsletterRecipientsModel.php | 1 - .../contao/modules/ModuleNewsletterList.php | 1 - .../contao/modules/ModuleNewsletterReader.php | 1 - .../contao/modules/ModuleSubscribe.php | 3 +- .../contao/modules/ModuleUnsubscribe.php | 3 +- .../modules/mod_newsletterlist.html5 | 2 +- 17 files changed, 75 insertions(+), 89 deletions(-) diff --git a/src/Resources/contao/classes/Newsletter.php b/src/Resources/contao/classes/Newsletter.php index 739914fa9..61ac0121a 100644 --- a/src/Resources/contao/classes/Newsletter.php +++ b/src/Resources/contao/classes/Newsletter.php @@ -21,7 +21,6 @@ */ class Newsletter extends Backend { - /** * Return a form to choose an existing CSV file and import it * @@ -237,9 +236,9 @@ public function send(DataContainer $dc) // Preview newsletter $return = Message::generate() . ' - +
@@ -289,7 +288,7 @@ public function send(DataContainer $dc)

- ' . (isset($_SESSION['TL_PREVIEW_MAIL_ERROR']) ? ' + ' . (isset($_SESSION['TL_PREVIEW_MAIL_ERROR']) ? '
' . $GLOBALS['TL_LANG']['ERR']['email'] . '
' : (($GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] && Config::get('showHelp')) ? '

' . $GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] . '

' : '')) . '
@@ -300,8 +299,8 @@ public function send(DataContainer $dc)
- - + +
@@ -477,7 +476,7 @@ public function importRecipients() $arrRecipients = array(); $resFile = $objFile->handle; - while(($arrRow = @fgetcsv($resFile, null, $strSeparator)) !== false) + while (($arrRow = @fgetcsv($resFile, null, $strSeparator)) !== false) { $arrRecipients[] = $arrRow; } @@ -538,29 +537,29 @@ public function importRecipients() // Return form return ' -'.Message::generate().' - +' . Message::generate() . ' +
- - + +
-

+

'.(($GLOBALS['TL_LANG']['MSC']['separator'][1] != '') ? ' -

'.$GLOBALS['TL_LANG']['MSC']['separator'][1].'

' : '').' + + + + + ' . (($GLOBALS['TL_LANG']['MSC']['separator'][1] != '') ? ' +

' . $GLOBALS['TL_LANG']['MSC']['separator'][1] . '

' : '') . '
-

'.$GLOBALS['TL_LANG']['MSC']['source'][0].'

'.$objUploader->generateMarkup().(isset($GLOBALS['TL_LANG']['MSC']['source'][1]) ? ' -

'.$GLOBALS['TL_LANG']['MSC']['source'][1].'

' : '').' +

' . $GLOBALS['TL_LANG']['MSC']['source'][0] . '

' . $objUploader->generateMarkup() . (isset($GLOBALS['TL_LANG']['MSC']['source'][1]) ? ' +

' . $GLOBALS['TL_LANG']['MSC']['source'][1] . '

' : '') . '
@@ -569,7 +568,7 @@ public function importRecipients()
- +
diff --git a/src/Resources/contao/dca/tl_module.php b/src/Resources/contao/dca/tl_module.php index f999214b1..8c592025f 100644 --- a/src/Resources/contao/dca/tl_module.php +++ b/src/Resources/contao/dca/tl_module.php @@ -90,7 +90,6 @@ */ class tl_module_newsletter extends Contao\Backend { - /** * Import the back end user object */ @@ -141,7 +140,7 @@ public function getUnsubscribeDefault($varValue) */ public function getChannels() { - if (!$this->User->isAdmin && !\is_array($this->User->newsletters)) + if (!$this->User->isAdmin && !is_array($this->User->newsletters)) { return array(); } diff --git a/src/Resources/contao/dca/tl_newsletter.php b/src/Resources/contao/dca/tl_newsletter.php index 8e3d6916b..0d4d763c1 100644 --- a/src/Resources/contao/dca/tl_newsletter.php +++ b/src/Resources/contao/dca/tl_newsletter.php @@ -10,7 +10,6 @@ $GLOBALS['TL_DCA']['tl_newsletter'] = array ( - // Config 'config' => array ( @@ -259,7 +258,6 @@ */ class tl_newsletter extends Contao\Backend { - /** * Import the back end user object */ @@ -282,7 +280,7 @@ public function checkPermission() } // Set root IDs - if (empty($this->User->newsletters) || !\is_array($this->User->newsletters)) + if (empty($this->User->newsletters) || !is_array($this->User->newsletters)) { $root = array(0); } @@ -291,21 +289,22 @@ public function checkPermission() $root = $this->User->newsletters; } - $id = \strlen(Contao\Input::get('id')) ? Contao\Input::get('id') : CURRENT_ID; + $id = strlen(Contao\Input::get('id')) ? Contao\Input::get('id') : CURRENT_ID; // Check current action switch (Contao\Input::get('act')) { case 'paste': case 'select': - if (!\in_array(CURRENT_ID, $root)) // check CURRENT_ID here (see #247) + // Check CURRENT_ID here (see #247) + if (!in_array(CURRENT_ID, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } break; case 'create': - if (!Contao\Input::get('pid') || !\in_array(Contao\Input::get('pid'), $root)) + if (!Contao\Input::get('pid') || !in_array(Contao\Input::get('pid'), $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to create newsletters in channel ID ' . Contao\Input::get('pid') . '.'); } @@ -313,7 +312,7 @@ public function checkPermission() case 'cut': case 'copy': - if (!\in_array(Contao\Input::get('pid'), $root)) + if (!in_array(Contao\Input::get('pid'), $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Contao\Input::get('act') . ' newsletter ID ' . $id . ' to channel ID ' . Contao\Input::get('pid') . '.'); } @@ -331,7 +330,7 @@ public function checkPermission() throw new Contao\CoreBundle\Exception\AccessDeniedException('Invalid newsletter ID ' . $id . '.'); } - if (!\in_array($objChannel->pid, $root)) + if (!in_array($objChannel->pid, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Contao\Input::get('act') . ' newsletter ID ' . $id . ' of newsletter channel ID ' . $objChannel->pid . '.'); } @@ -342,7 +341,7 @@ public function checkPermission() case 'overrideAll': case 'cutAll': case 'copyAll': - if (!\in_array($id, $root)) + if (!in_array($id, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } @@ -375,12 +374,12 @@ public function checkPermission() throw new Contao\CoreBundle\Exception\AccessDeniedException('Invalid newsletter ID ' . $id . '.'); } - if (!\in_array($objChannel->pid, $root)) + if (!in_array($objChannel->pid, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to send newsletter ID ' . $id . ' of newsletter channel ID ' . $objChannel->pid . '.'); } } - elseif (!\in_array($id, $root)) + elseif (!in_array($id, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } @@ -414,7 +413,7 @@ public function listNewsletters($arrRow) */ public function convertAbsoluteLinks($strContent) { - return str_replace('src="' .Contao\Environment::get('base'), 'src="', $strContent); + return str_replace('src="' . Contao\Environment::get('base'), 'src="', $strContent); } /** diff --git a/src/Resources/contao/dca/tl_newsletter_blacklist.php b/src/Resources/contao/dca/tl_newsletter_blacklist.php index 2ce5a402e..a0c5a5e8f 100644 --- a/src/Resources/contao/dca/tl_newsletter_blacklist.php +++ b/src/Resources/contao/dca/tl_newsletter_blacklist.php @@ -10,7 +10,6 @@ $GLOBALS['TL_DCA']['tl_newsletter_blacklist'] = array ( - // Config 'config' => array ( diff --git a/src/Resources/contao/dca/tl_newsletter_channel.php b/src/Resources/contao/dca/tl_newsletter_channel.php index 9026b7b9d..d3559e211 100644 --- a/src/Resources/contao/dca/tl_newsletter_channel.php +++ b/src/Resources/contao/dca/tl_newsletter_channel.php @@ -10,7 +10,6 @@ $GLOBALS['TL_DCA']['tl_newsletter_channel'] = array ( - // Config 'config' => array ( @@ -177,7 +176,6 @@ */ class tl_newsletter_channel extends Contao\Backend { - /** * Import the back end user object */ @@ -200,7 +198,7 @@ public function checkPermission() } // Set root IDs - if (empty($this->User->newsletters) || !\is_array($this->User->newsletters)) + if (empty($this->User->newsletters) || !is_array($this->User->newsletters)) { $root = array(0); } @@ -246,7 +244,7 @@ public function checkPermission() case 'copy': case 'delete': case 'show': - if (!\in_array(Contao\Input::get('id'), $root) || (Contao\Input::get('act') == 'delete' && !$this->User->hasAccess('delete', 'newsletterp'))) + if (!in_array(Contao\Input::get('id'), $root) || (Contao\Input::get('act') == 'delete' && !$this->User->hasAccess('delete', 'newsletterp'))) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Contao\Input::get('act') . ' newsletter channel ID ' . Contao\Input::get('id') . '.'); } @@ -257,6 +255,7 @@ public function checkPermission() case 'overrideAll': case 'copyAll': $session = $objSession->all(); + if (Contao\Input::get('act') == 'deleteAll' && !$this->User->hasAccess('delete', 'newsletterp')) { $session['CURRENT']['IDS'] = array(); @@ -285,7 +284,7 @@ public function checkPermission() public function adjustPermissions($insertId) { // The oncreate_callback passes $insertId as second argument - if (\func_num_args() == 4) + if (func_num_args() == 4) { $insertId = func_get_arg(1); } @@ -296,7 +295,7 @@ public function adjustPermissions($insertId) } // Set root IDs - if (empty($this->User->newsletters) || !\is_array($this->User->newsletters)) + if (empty($this->User->newsletters) || !is_array($this->User->newsletters)) { $root = array(0); } @@ -306,7 +305,7 @@ public function adjustPermissions($insertId) } // The channel is enabled already - if (\in_array($insertId, $root)) + if (in_array($insertId, $root)) { return; } @@ -316,7 +315,7 @@ public function adjustPermissions($insertId) $arrNew = $objSessionBag->get('new_records'); - if (\is_array($arrNew['tl_newsletter_channel']) && \in_array($insertId, $arrNew['tl_newsletter_channel'])) + if (is_array($arrNew['tl_newsletter_channel']) && in_array($insertId, $arrNew['tl_newsletter_channel'])) { // Add the permissions on group level if ($this->User->inherit != 'custom') @@ -327,7 +326,7 @@ public function adjustPermissions($insertId) { $arrNewsletterp = Contao\StringUtil::deserialize($objGroup->newsletterp); - if (\is_array($arrNewsletterp) && \in_array('create', $arrNewsletterp)) + if (is_array($arrNewsletterp) && in_array('create', $arrNewsletterp)) { $arrNewsletters = Contao\StringUtil::deserialize($objGroup->newsletters, true); $arrNewsletters[] = $insertId; @@ -347,7 +346,7 @@ public function adjustPermissions($insertId) $arrNewsletterp = Contao\StringUtil::deserialize($objUser->newsletterp); - if (\is_array($arrNewsletterp) && \in_array('create', $arrNewsletterp)) + if (is_array($arrNewsletterp) && in_array('create', $arrNewsletterp)) { $arrNewsletters = Contao\StringUtil::deserialize($objUser->newsletters, true); $arrNewsletters[] = $insertId; @@ -377,7 +376,7 @@ public function adjustPermissions($insertId) */ public function editHeader($row, $href, $label, $title, $icon, $attributes) { - return $this->User->canEditFieldsOf('tl_newsletter_channel') ? ''.Contao\Image::getHtml($icon, $label).' ' : Contao\Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)).' '; + return $this->User->canEditFieldsOf('tl_newsletter_channel') ? '' . Contao\Image::getHtml($icon, $label) . ' ' : Contao\Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)) . ' '; } /** @@ -394,7 +393,7 @@ public function editHeader($row, $href, $label, $title, $icon, $attributes) */ public function copyChannel($row, $href, $label, $title, $icon, $attributes) { - return $this->User->hasAccess('create', 'newsletterp') ? ''.Contao\Image::getHtml($icon, $label).' ' : Contao\Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)).' '; + return $this->User->hasAccess('create', 'newsletterp') ? '' . Contao\Image::getHtml($icon, $label) . ' ' : Contao\Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)) . ' '; } /** @@ -411,6 +410,6 @@ public function copyChannel($row, $href, $label, $title, $icon, $attributes) */ public function deleteChannel($row, $href, $label, $title, $icon, $attributes) { - return $this->User->hasAccess('delete', 'newsletterp') ? ''.Contao\Image::getHtml($icon, $label).' ' : Contao\Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)).' '; + return $this->User->hasAccess('delete', 'newsletterp') ? '' . Contao\Image::getHtml($icon, $label) . ' ' : Contao\Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)) . ' '; } } diff --git a/src/Resources/contao/dca/tl_newsletter_recipients.php b/src/Resources/contao/dca/tl_newsletter_recipients.php index 8c960d1b1..7869a5167 100644 --- a/src/Resources/contao/dca/tl_newsletter_recipients.php +++ b/src/Resources/contao/dca/tl_newsletter_recipients.php @@ -10,7 +10,6 @@ $GLOBALS['TL_DCA']['tl_newsletter_recipients'] = array ( - // Config 'config' => array ( @@ -164,7 +163,6 @@ */ class tl_newsletter_recipients extends Contao\Backend { - /** * Import the back end user object */ @@ -187,7 +185,7 @@ public function checkPermission() } // Set root IDs - if (empty($this->User->newsletters) || !\is_array($this->User->newsletters)) + if (empty($this->User->newsletters) || !is_array($this->User->newsletters)) { $root = array(0); } @@ -196,21 +194,22 @@ public function checkPermission() $root = $this->User->newsletters; } - $id = \strlen(Contao\Input::get('id')) ? Contao\Input::get('id') : CURRENT_ID; + $id = strlen(Contao\Input::get('id')) ? Contao\Input::get('id') : CURRENT_ID; // Check current action switch (Contao\Input::get('act')) { case 'paste': case 'select': - if (!\in_array(CURRENT_ID, $root)) // check CURRENT_ID here (see #247) + // Check CURRENT_ID here (see #247) + if (!in_array(CURRENT_ID, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } break; case 'create': - if (!Contao\Input::get('pid') || !\in_array(Contao\Input::get('pid'), $root)) + if (!Contao\Input::get('pid') || !in_array(Contao\Input::get('pid'), $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to create newsletters recipients in channel ID ' . Contao\Input::get('pid') . '.'); } @@ -218,7 +217,7 @@ public function checkPermission() case 'cut': case 'copy': - if (!\in_array(Contao\Input::get('pid'), $root)) + if (!in_array(Contao\Input::get('pid'), $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Contao\Input::get('act') . ' newsletter recipient ID ' . $id . ' to channel ID ' . Contao\Input::get('pid') . '.'); } @@ -237,7 +236,7 @@ public function checkPermission() throw new Contao\CoreBundle\Exception\AccessDeniedException('Invalid newsletter recipient ID ' . $id . '.'); } - if (!\in_array($objRecipient->pid, $root)) + if (!in_array($objRecipient->pid, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to ' . Contao\Input::get('act') . ' recipient ID ' . $id . ' of newsletter channel ID ' . $objRecipient->pid . '.'); } @@ -248,7 +247,7 @@ public function checkPermission() case 'overrideAll': case 'cutAll': case 'copyAll': - if (!\in_array($id, $root)) + if (!in_array($id, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter channel ID ' . $id . '.'); } @@ -270,7 +269,7 @@ public function checkPermission() throw new Contao\CoreBundle\Exception\AccessDeniedException('Invalid command "' . Contao\Input::get('act') . '".'); } - if (!\in_array($id, $root)) + if (!in_array($id, $root)) { throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to access newsletter recipient ID ' . $id . '.'); } @@ -384,14 +383,14 @@ public function toggleIcon($row, $href, $label, $title, $icon, $attributes) return ''; } - $href .= '&tid='.$row['id'].'&state='.($row['active'] ? '' : 1); + $href .= '&tid=' . $row['id'] . '&state=' . ($row['active'] ? '' : 1); if (!$row['active']) { $icon = 'invisible.svg'; } - return ''.Contao\Image::getHtml($icon, $label, 'data-state="' . ($row['active'] ? 1 : 0) . '"').' '; + return '' . Contao\Image::getHtml($icon, $label, 'data-state="' . ($row['active'] ? 1 : 0) . '"') . ' '; } /** @@ -415,16 +414,16 @@ public function toggleVisibility($intId, $blnVisible, Contao\DataContainer $dc=n } // Trigger the onload_callback - if (\is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onload_callback'])) + if (is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onload_callback'])) { foreach ($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onload_callback'] as $callback) { - if (\is_array($callback)) + if (is_array($callback)) { $this->import($callback[0]); $this->{$callback[0]}->{$callback[1]}($dc); } - elseif (\is_callable($callback)) + elseif (is_callable($callback)) { $callback($dc); } @@ -454,16 +453,16 @@ public function toggleVisibility($intId, $blnVisible, Contao\DataContainer $dc=n $objVersions->initialize(); // Trigger the save_callback - if (\is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['fields']['active']['save_callback'])) + if (is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['fields']['active']['save_callback'])) { foreach ($GLOBALS['TL_DCA']['tl_newsletter_recipients']['fields']['active']['save_callback'] as $callback) { - if (\is_array($callback)) + if (is_array($callback)) { $this->import($callback[0]); $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc); } - elseif (\is_callable($callback)) + elseif (is_callable($callback)) { $blnVisible = $callback($blnVisible, $dc); } @@ -483,16 +482,16 @@ public function toggleVisibility($intId, $blnVisible, Contao\DataContainer $dc=n } // Trigger the onsubmit_callback - if (\is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onsubmit_callback'])) + if (is_array($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onsubmit_callback'])) { foreach ($GLOBALS['TL_DCA']['tl_newsletter_recipients']['config']['onsubmit_callback'] as $callback) { - if (\is_array($callback)) + if (is_array($callback)) { $this->import($callback[0]); $this->{$callback[0]}->{$callback[1]}($dc); } - elseif (\is_callable($callback)) + elseif (is_callable($callback)) { $callback($dc); } diff --git a/src/Resources/contao/dca/tl_user.php b/src/Resources/contao/dca/tl_user.php index 4ea2fd5e0..a8f34f8b9 100644 --- a/src/Resources/contao/dca/tl_user.php +++ b/src/Resources/contao/dca/tl_user.php @@ -10,10 +10,10 @@ // Extend the default palettes Contao\CoreBundle\DataContainer\PaletteManipulator::create() - ->addLegend('newsletter_legend', 'amg_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_BEFORE) - ->addField(array('newsletters', 'newsletterp'), 'newsletter_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) - ->applyToPalette('extend', 'tl_user') - ->applyToPalette('custom', 'tl_user') + ->addLegend('newsletter_legend', 'amg_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_BEFORE) + ->addField(array('newsletters', 'newsletterp'), 'newsletter_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) + ->applyToPalette('extend', 'tl_user') + ->applyToPalette('custom', 'tl_user') ; // Add fields to tl_user_group diff --git a/src/Resources/contao/dca/tl_user_group.php b/src/Resources/contao/dca/tl_user_group.php index 3c891dcb4..2b6372520 100644 --- a/src/Resources/contao/dca/tl_user_group.php +++ b/src/Resources/contao/dca/tl_user_group.php @@ -10,9 +10,9 @@ // Extend the default palette Contao\CoreBundle\DataContainer\PaletteManipulator::create() - ->addLegend('newsletter_legend', 'amg_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_BEFORE) - ->addField(array('newsletters', 'newsletterp'), 'newsletter_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) - ->applyToPalette('default', 'tl_user_group') + ->addLegend('newsletter_legend', 'amg_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_BEFORE) + ->addField(array('newsletters', 'newsletterp'), 'newsletter_legend', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND) + ->applyToPalette('default', 'tl_user_group') ; // Add fields to tl_user_group diff --git a/src/Resources/contao/models/NewsletterBlacklistModel.php b/src/Resources/contao/models/NewsletterBlacklistModel.php index a1bcaf4e9..ae71092c2 100644 --- a/src/Resources/contao/models/NewsletterBlacklistModel.php +++ b/src/Resources/contao/models/NewsletterBlacklistModel.php @@ -39,7 +39,6 @@ */ class NewsletterBlacklistModel extends Model { - /** * Table name * @var string diff --git a/src/Resources/contao/models/NewsletterChannelModel.php b/src/Resources/contao/models/NewsletterChannelModel.php index d91bd2a5d..3e3cf2ec5 100644 --- a/src/Resources/contao/models/NewsletterChannelModel.php +++ b/src/Resources/contao/models/NewsletterChannelModel.php @@ -56,7 +56,6 @@ */ class NewsletterChannelModel extends Model { - /** * Table name * @var string diff --git a/src/Resources/contao/models/NewsletterModel.php b/src/Resources/contao/models/NewsletterModel.php index 029e0ee41..3037f1888 100644 --- a/src/Resources/contao/models/NewsletterModel.php +++ b/src/Resources/contao/models/NewsletterModel.php @@ -93,7 +93,6 @@ */ class NewsletterModel extends Model { - /** * Table name * @var string diff --git a/src/Resources/contao/models/NewsletterRecipientsModel.php b/src/Resources/contao/models/NewsletterRecipientsModel.php index a9070bee1..7706380a3 100644 --- a/src/Resources/contao/models/NewsletterRecipientsModel.php +++ b/src/Resources/contao/models/NewsletterRecipientsModel.php @@ -56,7 +56,6 @@ */ class NewsletterRecipientsModel extends Model { - /** * Table name * @var string diff --git a/src/Resources/contao/modules/ModuleNewsletterList.php b/src/Resources/contao/modules/ModuleNewsletterList.php index 647c46f9d..ef568078c 100644 --- a/src/Resources/contao/modules/ModuleNewsletterList.php +++ b/src/Resources/contao/modules/ModuleNewsletterList.php @@ -21,7 +21,6 @@ */ class ModuleNewsletterList extends Module { - /** * Template * @var string diff --git a/src/Resources/contao/modules/ModuleNewsletterReader.php b/src/Resources/contao/modules/ModuleNewsletterReader.php index 723450229..7e1895e7c 100644 --- a/src/Resources/contao/modules/ModuleNewsletterReader.php +++ b/src/Resources/contao/modules/ModuleNewsletterReader.php @@ -22,7 +22,6 @@ */ class ModuleNewsletterReader extends Module { - /** * Template * @var string diff --git a/src/Resources/contao/modules/ModuleSubscribe.php b/src/Resources/contao/modules/ModuleSubscribe.php index 3f53b5ac6..da8bf71c6 100644 --- a/src/Resources/contao/modules/ModuleSubscribe.php +++ b/src/Resources/contao/modules/ModuleSubscribe.php @@ -26,7 +26,6 @@ */ class ModuleSubscribe extends Module { - /** * Template * @var string @@ -93,7 +92,7 @@ protected function compile() { $arrField = array ( - 'name' => 'subscribe_'.$this->id, + 'name' => 'subscribe_' . $this->id, 'label' => $GLOBALS['TL_LANG']['MSC']['securityQuestion'], 'inputType' => 'captcha', 'eval' => array('mandatory'=>true) diff --git a/src/Resources/contao/modules/ModuleUnsubscribe.php b/src/Resources/contao/modules/ModuleUnsubscribe.php index 21b79a483..a47733cd6 100644 --- a/src/Resources/contao/modules/ModuleUnsubscribe.php +++ b/src/Resources/contao/modules/ModuleUnsubscribe.php @@ -24,7 +24,6 @@ */ class ModuleUnsubscribe extends Module { - /** * Template * @var string @@ -83,7 +82,7 @@ protected function compile() { $arrField = array ( - 'name' => 'unsubscribe_'.$this->id, + 'name' => 'unsubscribe_' . $this->id, 'label' => $GLOBALS['TL_LANG']['MSC']['securityQuestion'], 'inputType' => 'captcha', 'eval' => array('mandatory'=>true) diff --git a/src/Resources/contao/templates/modules/mod_newsletterlist.html5 b/src/Resources/contao/templates/modules/mod_newsletterlist.html5 index 9edfa25a1..56f8f3d7d 100644 --- a/src/Resources/contao/templates/modules/mod_newsletterlist.html5 +++ b/src/Resources/contao/templates/modules/mod_newsletterlist.html5 @@ -4,7 +4,7 @@ newsletters)): ?>
    - newsletters as $newsletter): ?> + newsletters as $newsletter): ?>
  • :
From b1e9ccaa810e60a2e26ede94dc2185e55fc4914e Mon Sep 17 00:00:00 2001 From: Leo Feyer Date: Mon, 30 Sep 2019 13:42:29 +0200 Subject: [PATCH 3/3] Use the robots meta data to determine whether to add a page to the XML sitemap (see #501) --- src/Resources/contao/classes/Newsletter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/contao/classes/Newsletter.php b/src/Resources/contao/classes/Newsletter.php index 5c8cfc8b4..9a2514ca1 100644 --- a/src/Resources/contao/classes/Newsletter.php +++ b/src/Resources/contao/classes/Newsletter.php @@ -989,7 +989,7 @@ public function getSearchablePages($arrPages, $intRoot=0, $blnIsSitemap=false) } // The target page is exempt from the sitemap (see #6418) - if ($objParent->sitemap == 'map_never') + if ($objParent->robots == 'noindex,nofollow') { continue; }