diff --git a/CHANGELOG.md b/CHANGELOG.md index 774ee9a..dc64b3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. +## [1.4.1] - 2024-06-19 +### Updated +- Fixed compatibility with PHP 5.6. + ## [1.4.0] - 2024-04-26 ### Added - GitHub actions CI workflow. diff --git a/classes/local_contact.php b/classes/local_contact.php index 610cca3..ea99615 100644 --- a/classes/local_contact.php +++ b/classes/local_contact.php @@ -91,8 +91,8 @@ public function __construct() { $this->fromemail = required_param('email', PARAM_TEXT); } } - $this->fromname = trim($this->fromname ?? ''); - $this->fromemail = trim($this->fromemail ?? ''); + $this->fromname = isset($this->fromname) ? trim($this->fromname) : ''; + $this->fromemail = isset($this->fromemail) ? trim($this->fromemail) : ''; $this->isspambot = false; $this->errmsg = ''; @@ -247,7 +247,7 @@ public function __construct() { */ private function makeemailuser($email, $name = '', $id = -99) { $emailuser = new stdClass(); - $emailuser->email = trim(filter_var($email, FILTER_SANITIZE_EMAIL) ?? ''); + $emailuser->email = trim(filter_var($email, FILTER_SANITIZE_EMAIL) ? filter_var($email, FILTER_SANITIZE_EMAIL) : ''); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailuser->email = ''; } @@ -310,7 +310,7 @@ public function sendmessage($email, $name, $sendconfirmationemail = false) { * @return boolean true if string is not empty, otherwise false. */ function filterempty($string) { - $string = trim($string ?? ''); + $string = isset($string) ? trim($string) : ''; return ($string !== null && $string !== false && $string !== ''); } diff --git a/index.php b/index.php index 696be4b..c367f8b 100644 --- a/index.php +++ b/index.php @@ -66,8 +66,8 @@ // The default recipient is the Moodle site's support contact. This will // be used if no recipient was specified or if the recipient is unknown. -$name = trim($CFG->supportname ?? ''); -$email = trim($CFG->supportemail ?? ''); +$name = isset($CFG->supportname) ? trim($CFG->supportname) : ''; +$email = isset($CFG->supportemail) ? trim($CFG->supportemail) : ''; // Handle recipient alias. // If the form includes a recipient's alias, search the plugin's recipient list settings for a name and email address. @@ -75,7 +75,7 @@ if (!empty($recipient)) { $lines = explode("\n", get_config('local_contact', 'recipient_list')); foreach ($lines as $linenumbe => $line) { - $line = trim($line ?? ''); + $line = isset($line) ? trim($line) : ''; if (empty($line)) { // Blank line. continue; } diff --git a/version.php b/version.php index 7941855..907d24a 100644 --- a/version.php +++ b/version.php @@ -25,9 +25,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024042600; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2024061900; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2015111600; // Requires Moodle version 3.0. $plugin->component = 'local_contact'; // To check on upgrade, that module sits in correct place. -$plugin->release = '1.4.0'; +$plugin->release = '1.4.1'; $plugin->maturity = MATURITY_STABLE; $plugin->cron = 0;