From fa25bc564d28e5b72c3acf87f95a56e1f376fea7 Mon Sep 17 00:00:00 2001 From: bmarcinkowski Date: Thu, 8 Oct 2026 17:05:56 +0200 Subject: [PATCH] chore: fix coding style violations reported by Moodle Code Checker The Moodle Plugin CI workflow has never run green: phpcs reported 154 errors that predate it. This applies phpcbf across the plugin so the checker passes and future failures mean something. Whitespace, argument wrapping, array syntax and interface ordering only - no behaviour is changed. Verified by PHP lint, the plugin test suite, Moodle's privacy checks, and a full v1.1.5 to v1.2.0 upgrade run, since db/upgrade.php was among the reformatted files. Co-Authored-By: Claude Opus 5 (1M context) --- ...ackup_clickmeeting_activity_task.class.php | 1 - .../moodle2/backup_clickmeeting_stepslib.php | 1 - ...store_clickmeeting_activity_task.class.php | 14 ++++--- .../moodle2/restore_clickmeeting_stepslib.php | 1 - classes/privacy/provider.php | 3 +- db/upgrade.php | 40 ++++++++++++++----- index.php | 7 ++-- lib.php | 28 ++++++------- mod_form.php | 5 +-- settings.php | 24 ++++++----- view.php | 16 ++++---- 11 files changed, 82 insertions(+), 58 deletions(-) diff --git a/backup/moodle2/backup_clickmeeting_activity_task.class.php b/backup/moodle2/backup_clickmeeting_activity_task.class.php index 34d1139..1225ca9 100755 --- a/backup/moodle2/backup_clickmeeting_activity_task.class.php +++ b/backup/moodle2/backup_clickmeeting_activity_task.class.php @@ -28,7 +28,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class backup_clickmeeting_activity_task extends backup_activity_task { - /** * Define (add) particular settings this activity can have */ diff --git a/backup/moodle2/backup_clickmeeting_stepslib.php b/backup/moodle2/backup_clickmeeting_stepslib.php index e3f2263..4849ae7 100755 --- a/backup/moodle2/backup_clickmeeting_stepslib.php +++ b/backup/moodle2/backup_clickmeeting_stepslib.php @@ -31,7 +31,6 @@ * Define the complete choice structure */ class backup_activity_structure_step extends \backup_activity_structure_step { - /** * Define the complete structure for backup */ diff --git a/backup/moodle2/restore_clickmeeting_activity_task.class.php b/backup/moodle2/restore_clickmeeting_activity_task.class.php index 5aeddbe..05f75c0 100755 --- a/backup/moodle2/restore_clickmeeting_activity_task.class.php +++ b/backup/moodle2/restore_clickmeeting_activity_task.class.php @@ -29,7 +29,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class restore_clickmeeting_activity_task extends restore_activity_task { - /** * Define (add) particular settings this activity can have */ @@ -68,7 +67,6 @@ public static function define_decode_rules() { $rules[] = new restore_decode_rule('CLICKMEETINGINDEX', '/mod/clickmeeting/index.php?id=$1', 'course'); return $rules; - } /** @@ -104,11 +102,17 @@ public static function define_restore_log_rules_for_course() { $rules = []; // Fix old wrong uses (missing extension) - $rules[] = new restore_log_rule('clickmeeting', 'view all', 'index?id={course}', null, - null, null, 'index.php?id={course}'); + $rules[] = new restore_log_rule( + 'clickmeeting', + 'view all', + 'index?id={course}', + null, + null, + null, + 'index.php?id={course}' + ); $rules[] = new restore_log_rule('clickmeeting', 'view all', 'index.php?id={course}', null); return $rules; } - } diff --git a/backup/moodle2/restore_clickmeeting_stepslib.php b/backup/moodle2/restore_clickmeeting_stepslib.php index ccbb50e..1a759a2 100755 --- a/backup/moodle2/restore_clickmeeting_stepslib.php +++ b/backup/moodle2/restore_clickmeeting_stepslib.php @@ -28,7 +28,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class restore_activity_structure_step extends \restore_activity_structure_step { - /** * Defines table structure */ diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index e05bdb8..6726869 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -39,8 +39,7 @@ /** * Ad hoc task that performs the actions for approved data privacy requests. */ -class provider implements metadata_provider, request_plugin_provider, core_userlist_provider { - +class provider implements core_userlist_provider, metadata_provider, request_plugin_provider { /** * Returns metadata about this system. * diff --git a/db/upgrade.php b/db/upgrade.php index 4eec213..c741886 100755 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -68,7 +68,6 @@ function xmldb_clickmeeting_upgrade($oldversion) { // First example, some fields were added to install.xml on 2007/04/01 if ($oldversion < 2007040100) { - // Define field course to be added to clickmeeting $table = new xmldb_table('clickmeeting'); $field = new xmldb_field('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'id'); @@ -89,8 +88,16 @@ function xmldb_clickmeeting_upgrade($oldversion) { // Define field introformat to be added to clickmeeting $table = new xmldb_table('clickmeeting'); - $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', - 'intro'); + $field = new xmldb_field( + 'introformat', + XMLDB_TYPE_INTEGER, + '4', + XMLDB_UNSIGNED, + XMLDB_NOTNULL, + null, + '0', + 'intro' + ); // Add field introformat if (!$dbman->field_exists($table, $field)) { @@ -106,11 +113,18 @@ function xmldb_clickmeeting_upgrade($oldversion) { // two more fields and one index were added to install.xml (note the micro increment // "01" in the last two digits of the version if ($oldversion < 2007040101) { - // Define field timecreated to be added to clickmeeting $table = new xmldb_table('clickmeeting'); - $field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', - 'introformat'); + $field = new xmldb_field( + 'timecreated', + XMLDB_TYPE_INTEGER, + '10', + XMLDB_UNSIGNED, + XMLDB_NOTNULL, + null, + '0', + 'introformat' + ); // Add field timecreated if (!$dbman->field_exists($table, $field)) { @@ -119,8 +133,16 @@ function xmldb_clickmeeting_upgrade($oldversion) { // Define field timemodified to be added to clickmeeting $table = new xmldb_table('clickmeeting'); - $field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', - 'timecreated'); + $field = new xmldb_field( + 'timemodified', + XMLDB_TYPE_INTEGER, + '10', + XMLDB_UNSIGNED, + XMLDB_NOTNULL, + null, + '0', + 'timecreated' + ); // Add field timemodified if (!$dbman->field_exists($table, $field)) { @@ -143,14 +165,12 @@ function xmldb_clickmeeting_upgrade($oldversion) { // Third example, the next day, 2007/04/02 (with the trailing 00), some actions were performed to install.php, // related with the module if ($oldversion < 2007040200) { - // insert here code to perform some actions (same as in install.php) upgrade_mod_savepoint(true, 2007040200, 'clickmeeting'); } if ($oldversion < 2018101000) { - $table = new xmldb_table('clickmeeting'); $field = new xmldb_field('user_id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'description'); diff --git a/index.php b/index.php index 7a8a006..18d21ac 100755 --- a/index.php +++ b/index.php @@ -27,8 +27,8 @@ // Replace clickmeeting with the name of your module and remove this line -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/lib.php'); +require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require_once(dirname(__FILE__) . '/lib.php'); $id = required_param('id', PARAM_INT); // course @@ -76,7 +76,8 @@ } else { $link = html_writer::link( new moodle_url('/mod/clickmeeting/view.php', ['id' => $clickmeeting->coursemodule]), - format_string($clickmeeting->name, true)); + format_string($clickmeeting->name, true) + ); } if ($course->format == 'weeks' || $course->format == 'topics') { diff --git a/lib.php b/lib.php index 6d98c06..4143766 100755 --- a/lib.php +++ b/lib.php @@ -96,7 +96,7 @@ function clickmeeting_check_conference_availability($starttime, $duration, $id = ]; $curl = clickmeeting_init_curl(); - $curl->post($apiurl.'conference/availability', $params); + $curl->post($apiurl . 'conference/availability', $params); return 200 === $curl->get_info()['http_code']; } @@ -138,7 +138,7 @@ function clickmeeting_add_conference($params) { $apiurl = get_config('clickmeeting', 'apiurl'); $curlhandle = clickmeeting_init_curl(); - $result = $curlhandle->post($apiurl.'conferences', $params); + $result = $curlhandle->post($apiurl . 'conferences', $params); return $result; } @@ -154,7 +154,7 @@ function clickmeeting_edit_conference($conferenceid, $params) { $apiurl = get_config('clickmeeting', 'apiurl'); $curlhandle = clickmeeting_init_curl(); - $result = $curlhandle->put($apiurl.'conferences/'.$conferenceid, [], ['CURLOPT_POSTFIELDS' => http_build_query($params, '', '&')]); + $result = $curlhandle->put($apiurl . 'conferences/' . $conferenceid, [], ['CURLOPT_POSTFIELDS' => http_build_query($params, '', '&')]); return $result; } @@ -174,7 +174,7 @@ function clickmeeting_edit_conference_title($conferenceid, $title) { ]; $curlhandle = clickmeeting_init_curl(); - $result = $curlhandle->put($apiurl.'conferences/'.$conferenceid, [], ['CURLOPT_POSTFIELDS' => http_build_query($params, '', '&')]); + $result = $curlhandle->put($apiurl . 'conferences/' . $conferenceid, [], ['CURLOPT_POSTFIELDS' => http_build_query($params, '', '&')]); return $result; } @@ -189,7 +189,7 @@ function clickmeeting_delete_conference($conferenceid) { $apiurl = get_config('clickmeeting', 'apiurl'); $curlhandle = clickmeeting_init_curl(); - $result = $curlhandle->delete($apiurl.'conferences/'.$conferenceid); + $result = $curlhandle->delete($apiurl . 'conferences/' . $conferenceid); return $result; } @@ -208,7 +208,7 @@ function clickmeeting_generate_token($roomid) { $params['how_many'] = 1; $curlhandle = clickmeeting_init_curl(); - $result = $curlhandle->post($apiurl.'conferences/'.$roomid.'/tokens', $params); + $result = $curlhandle->post($apiurl . 'conferences/' . $roomid . '/tokens', $params); $decoder = json_decode($result, true); return $decoder['access_tokens'][0]['token']; @@ -259,7 +259,7 @@ function clickmeeting_get_login_url($roomid, $email, $nickname, $role, $auth, $a } $curlhandle = clickmeeting_init_curl(); - $result = $curlhandle->post($apiurl.'conferences/'.$roomid.'/room/autologin_hash', $params); + $result = $curlhandle->post($apiurl . 'conferences/' . $roomid . '/room/autologin_hash', $params); $decoded = json_decode($result, true); return !empty($decoded['autologin_hash']) @@ -343,7 +343,7 @@ function clickmeeting_add_instance(stdClass $clickmeeting, mod_clickmeeting_mod_ $error = ''; if (!empty($r['code'])) { foreach ($r['errors'] as $err) { - $error .= $err['message'].'
'; + $error .= $err['message'] . '
'; } throw new \moodle_exception($error, 'error'); } @@ -425,7 +425,7 @@ function clickmeeting_update_instance(stdClass $clickmeeting, mod_clickmeeting_m if (!empty($r['code'])) { $error = ''; foreach ($r['errors'] as $err) { - $error .= $err['message'].'
'; + $error .= $err['message'] . '
'; } throw new \moodle_exception($error, 'error'); } @@ -640,7 +640,7 @@ function clickmeeting_scale_used_anywhere($scaleid) { */ function clickmeeting_grade_item_update(stdClass $clickmeeting) { global $CFG, $DB; - require_once($CFG->libdir.'/gradelib.php'); + require_once($CFG->libdir . '/gradelib.php'); $item = []; $item['itemname'] = clean_param($clickmeeting->name, PARAM_NOTAGS); @@ -683,7 +683,7 @@ function clickmeeting_generate_password($length) { */ function clickmeeting_update_grades(stdClass $clickmeeting, $userid = 0) { global $CFG, $DB; - require_once($CFG->libdir.'/gradelib.php'); + require_once($CFG->libdir . '/gradelib.php'); $grades = []; // populate array of grade objects indexed by userid @@ -771,7 +771,7 @@ function clickmeeting_extend_navigation(navigation_node $navref, stdClass $cours * @param settings_navigation $settingsnav * @param navigation_node $clickmeetingnode */ -function clickmeeting_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $clickmeetingnode=null) { +function clickmeeting_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $clickmeetingnode = null) { } /** @@ -808,10 +808,10 @@ function clickmeeting_init_curl() { */ function clickmeeting_page_view($clickmeeting, $course, $cm, $context) { - $params = array( + $params = [ 'context' => $context, 'objectid' => $clickmeeting->id, - ); + ]; $event = mod_clickmeeting\event\course_module_viewed::create($params); $event->add_record_snapshot('course_modules', $cm); diff --git a/mod_form.php b/mod_form.php index 3cebbf4..d470404 100755 --- a/mod_form.php +++ b/mod_form.php @@ -27,13 +27,12 @@ defined('MOODLE_INTERNAL') || die(); -require_once($CFG->dirroot.'/course/moodleform_mod.php'); +require_once($CFG->dirroot . '/course/moodleform_mod.php'); /** * Module instance settings form */ class mod_clickmeeting_mod_form extends moodleform_mod { - /** * Defines webinar open to all */ @@ -71,7 +70,7 @@ public function definition() { $conferencestarttime = required_param('start_time', PARAM_TEXT); $conferenceduration = required_param('duration', PARAM_INT); - if (clickmeeting_check_conference_availability($conferencestarttime, $conferenceduration, $conferenceid)) { + if (clickmeeting_check_conference_availability($conferencestarttime, $conferenceduration, $conferenceid)) { http_response_code(200); echo 'SUCCESS'; } else { diff --git a/settings.php b/settings.php index d27190d..0404612 100755 --- a/settings.php +++ b/settings.php @@ -25,18 +25,22 @@ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { - require_once(dirname(__FILE__).'/lib.php'); + require_once(dirname(__FILE__) . '/lib.php'); - $settings->add(new admin_setting_configtext('clickmeeting/apiurl', - get_string('settings:apiurl', 'clickmeeting'), - get_string('settings:apiurldesc', 'clickmeeting'), - 'https://api.clickmeeting.com/v1/', - PARAM_URL)); + $settings->add(new admin_setting_configtext( + 'clickmeeting/apiurl', + get_string('settings:apiurl', 'clickmeeting'), + get_string('settings:apiurldesc', 'clickmeeting'), + 'https://api.clickmeeting.com/v1/', + PARAM_URL + )); - $settings->add(new admin_setting_configtext('clickmeeting/apikey', - get_string('settings:apikey', 'clickmeeting'), - get_string('settings:apikeydesc', 'clickmeeting'), - '')); + $settings->add(new admin_setting_configtext( + 'clickmeeting/apikey', + get_string('settings:apikey', 'clickmeeting'), + get_string('settings:apikeydesc', 'clickmeeting'), + '' + )); $settings->add(new admin_setting_configduration( 'clickmeeting/graceperiod', diff --git a/view.php b/view.php index 8729561..472d98c 100755 --- a/view.php +++ b/view.php @@ -25,8 +25,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/lib.php'); +require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require_once(dirname(__FILE__) . '/lib.php'); $id = optional_param('id', 0, PARAM_INT); // course_module ID, or $n = optional_param('n', 0, PARAM_INT); // clickmeeting instance ID - it should be named as the first character of the module @@ -100,22 +100,22 @@ // Output starts here echo $OUTPUT->header(); -echo ''.get_string('view:room_name', 'clickmeeting').': '.$clickmeeting->name; +echo '' . get_string('view:room_name', 'clickmeeting') . ': ' . $clickmeeting->name; echo '

'; if (!clickmeeting_is_room_historical($conference->conference_id)) { - $timestamp = strtotime('+'.$clickmeeting->duration.' hours', $clickmeeting->timestart); - echo ''.get_string('view:room_date', 'clickmeeting').': '.$clickmeeting->start_time.' - '.date('Y-m-d H:i:s', $timestamp); + $timestamp = strtotime('+' . $clickmeeting->duration . ' hours', $clickmeeting->timestart); + echo '' . get_string('view:room_date', 'clickmeeting') . ': ' . $clickmeeting->start_time . ' - ' . date('Y-m-d H:i:s', $timestamp); echo '

'; - echo ''.get_string('view:room_description', 'clickmeeting').': '.$clickmeeting->description; + echo '' . get_string('view:room_description', 'clickmeeting') . ': ' . $clickmeeting->description; echo '

'; if (clickmeeting_is_password_protected($clickmeeting)) { - echo ''.get_string('view:password', 'clickmeeting').': '.$conference->password; + echo '' . get_string('view:password', 'clickmeeting') . ': ' . $conference->password; echo '

'; } $loginurl = sprintf('%s?l=%s', $conference->room_url, $loginhash); echo ''; } else { echo '' . get_string('view:oldmeeting', 'clickmeeting') . '';