From b7320e2b5c0945c624abc5b6cab023c4433a0d28 Mon Sep 17 00:00:00 2001 From: Cliff Parnitzky Date: Mon, 6 Nov 2017 13:05:45 +0100 Subject: [PATCH 1/4] Adjust the code to be compatible with PHP7 (#133) --- classes/tl_nc_message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/tl_nc_message.php b/classes/tl_nc_message.php index 64f14de0..1a41fed4 100644 --- a/classes/tl_nc_message.php +++ b/classes/tl_nc_message.php @@ -130,7 +130,7 @@ public function toggleVisibility($intId, $blnVisible) if (is_array($GLOBALS['TL_DCA']['tl_nc_message']['fields']['published']['save_callback'])) { foreach ($GLOBALS['TL_DCA']['tl_nc_message']['fields']['published']['save_callback'] as $callback) { if (is_array($callback)) { - $blnVisible = \System::importStatic($callback[0])->$callback[1]($blnVisible, $this); + $blnVisible = \System::importStatic($callback[0])->{$callback[1]}($blnVisible, $this); } elseif (is_callable($callback)) { $blnVisible = $callback($blnVisible, $this); } From 8061d3f3d539cab7cea1cbee7fc44d7d889d34da Mon Sep 17 00:00:00 2001 From: Kamil Kuzminski Date: Tue, 23 Jan 2018 10:11:43 +0100 Subject: [PATCH 2/4] Fix compatibility for Contao 4.5 and its Swiftmailer 6 (#140) --- library/NotificationCenter/Gateway/Email.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/NotificationCenter/Gateway/Email.php b/library/NotificationCenter/Gateway/Email.php index cbcd2820..d030830d 100644 --- a/library/NotificationCenter/Gateway/Email.php +++ b/library/NotificationCenter/Gateway/Email.php @@ -70,7 +70,11 @@ public function send(Message $objMessage, array $arrTokens, $strLanguage = '') // Override SMTP settings if desired if (version_compare(VERSION, '4.4', '>=') && $this->objModel->email_overrideSmtp) { - $transport = \Swift_SmtpTransport::newInstance($this->objModel->email_smtpHost, $this->objModel->email_smtpPort); + if (version_compare(VERSION, '4.5', '>=')) { + $transport = new \Swift_SmtpTransport($this->objModel->email_smtpHost, $this->objModel->email_smtpPort); + } else { + $transport = \Swift_SmtpTransport::newInstance($this->objModel->email_smtpHost, $this->objModel->email_smtpPort); + } // Encryption if ($this->objModel->email_smtpEnc === 'ssl' || $this->objModel->email_smtpEnc === 'tls') { From 4886fb090b08632e31c3de6b0c9d1c8e3c79658a Mon Sep 17 00:00:00 2001 From: Kamil Kuzminski Date: Tue, 23 Jan 2018 10:57:05 +0100 Subject: [PATCH 3/4] Use the method_exists() to check the Swiftmailer version (#140) --- library/NotificationCenter/Gateway/Email.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/NotificationCenter/Gateway/Email.php b/library/NotificationCenter/Gateway/Email.php index d030830d..db628f39 100644 --- a/library/NotificationCenter/Gateway/Email.php +++ b/library/NotificationCenter/Gateway/Email.php @@ -70,10 +70,10 @@ public function send(Message $objMessage, array $arrTokens, $strLanguage = '') // Override SMTP settings if desired if (version_compare(VERSION, '4.4', '>=') && $this->objModel->email_overrideSmtp) { - if (version_compare(VERSION, '4.5', '>=')) { - $transport = new \Swift_SmtpTransport($this->objModel->email_smtpHost, $this->objModel->email_smtpPort); - } else { + if (method_exists(\Swift_SmtpTransport::class, 'newInstance')) { $transport = \Swift_SmtpTransport::newInstance($this->objModel->email_smtpHost, $this->objModel->email_smtpPort); + } else { + $transport = new \Swift_SmtpTransport($this->objModel->email_smtpHost, $this->objModel->email_smtpPort); } // Encryption From 5dc7ca8209e6984c0edaa067d0883623670ad04d Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Tue, 23 Jan 2018 11:03:33 +0100 Subject: [PATCH 4/4] Fixed license --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f48b2b37..8c803c65 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description":"Notification Center extension for Contao Open Source CMS", "keywords":["contao", "notification", "center"], "type":"contao-module", - "license":"LGPL-3.0+", + "license":"LGPL-3.0-or-later", "authors":[ { "name":"terminal42 gmbh",