From d175f534835a38f254ec58fbeeaee6134b172e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jordi=20Pujol=20Ahull=C3=B3?= Date: Tue, 12 Mar 2024 08:04:31 +0100 Subject: [PATCH] CI: fix errors and warnings --- classes/observer.php | 2 -- lib.php | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/classes/observer.php b/classes/observer.php index 4c0580c..4319d31 100644 --- a/classes/observer.php +++ b/classes/observer.php @@ -22,8 +22,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die; - /** * User profile event observer class. * diff --git a/lib.php b/lib.php index 7260416..40503d5 100644 --- a/lib.php +++ b/lib.php @@ -38,14 +38,14 @@ */ function cohortauto_prepare_profile_data($data, $replaceempty = 'EMPTY') { $reject = array('ajax_updatable_user_prefs', 'sesskey', 'preference', 'editing', 'access', 'message_lastpopup', 'enrol'); - if (is_array($data) or is_object($data)) { + if (is_array($data) || is_object($data)) { $newdata = array(); foreach ($data as $key => $val) { if (!in_array($key, $reject)) { - if (is_array($val) or is_object($val)) { + if (is_array($val) || is_object($val)) { $newdata[$key] = cohortauto_prepare_profile_data($val, $replaceempty); } else { - if ($val === '' or $val === ' ' or $val === null) { + if ($val === '' || $val === ' ' || $val === null) { $str = ($val === false) ? 'false' : $replaceempty; } else { $str = ($val === true) ? 'true' : strip_tags("$val"); @@ -55,7 +55,7 @@ function cohortauto_prepare_profile_data($data, $replaceempty = 'EMPTY') { } } } else { - if ($data === '' or $data === ' ' or $data === null) { + if ($data === '' || $data === ' ' || $data === null) { $str = ($data === false) ? 'false' : $replaceempty; } else { $str = ($data === true) ? 'true' : strip_tags("$data"); @@ -219,7 +219,7 @@ public function user_profile_hook(&$user) { $ignore = explode(",", $this->config->donttouchusers); // Skip explicitly ignored users. - if (!empty($ignore) AND array_search($user->username, $ignore) !== false) { + if (!empty($ignore) && array_search($user->username, $ignore) !== false) { return; };