From b6b00d0dd532075fb3d7eeb5b222b598384f614b Mon Sep 17 00:00:00 2001 From: Daniel Thies Date: Wed, 11 Oct 2023 14:08:08 -0500 Subject: [PATCH] VID-726: Coding style changes --- action.php | 12 ++-- backup/moodle2/backup_videotime_stepslib.php | 4 +- .../restore_videotime_activity_task.class.php | 12 ++-- classes/event/course_module_viewed.php | 2 +- classes/external/get_videotime.php | 4 +- classes/external/view_videotime.php | 4 +- .../structure/videotime_session_table.php | 20 +++---- .../structure/videotime_table.php | 36 ++++++------ classes/local/tabs/tab.php | 6 +- classes/output/mobile.php | 10 ++-- classes/output/next_activity_button.php | 2 +- classes/plugin_manager.php | 32 +++++----- classes/plugininfo/videotimeplugin.php | 8 +-- classes/plugininfo/videotimetab.php | 2 +- classes/search/texttrack.php | 10 ++-- classes/videotime_instance.php | 6 +- db/access.php | 34 +++++------ db/events.php | 2 +- db/mobile.php | 2 +- db/services.php | 2 +- db/upgrade.php | 12 ++-- index.php | 34 +++++------ lib.php | 20 +++---- mod_form.php | 24 +++++--- options.php | 8 +-- ...p_videotimeplugin_live_subplugin.class.php | 2 +- ...e_videotimeplugin_live_subplugin.class.php | 2 +- plugin/live/classes/event/video_ended.php | 2 +- plugin/live/classes/event/video_started.php | 2 +- plugin/live/classes/external/join_room.php | 4 +- plugin/live/classes/form/options.php | 2 +- plugin/live/db/access.php | 4 +- plugin/live/db/services.php | 10 ++-- plugin/live/lib.php | 8 +-- plugin/live/settings.php | 2 +- ...ideotimeplugin_videojs_subplugin.class.php | 2 +- ...ideotimeplugin_videojs_subplugin.class.php | 2 +- plugin/videojs/classes/form/options.php | 4 +- plugin/videojs/lib.php | 6 +- plugin/videojs/settings.php | 2 +- ..._videotimeplugin_vimeo_subplugin.class.php | 2 +- ..._videotimeplugin_vimeo_subplugin.class.php | 2 +- plugin/vimeo/classes/form/options.php | 4 +- plugin/vimeo/lib.php | 4 +- report.php | 10 ++-- settings.php | 8 +-- ...kup_videotimetab_block_subplugin.class.php | 4 +- ...ore_videotimetab_block_subplugin.class.php | 2 +- tab/block/classes/tab.php | 26 ++++----- tab/block/version.php | 2 +- ...p_videotimetab_chapter_subplugin.class.php | 4 +- ...e_videotimetab_chapter_subplugin.class.php | 2 +- tab/chapter/classes/tab.php | 22 +++---- ...ckup_videotimetab_chat_subplugin.class.php | 4 +- ...tore_videotimetab_chat_subplugin.class.php | 2 +- tab/chat/classes/privacy/provider.php | 2 +- tab/chat/classes/tab.php | 26 ++++----- ...deotimetab_information_subplugin.class.php | 4 +- ...deotimetab_information_subplugin.class.php | 2 +- tab/information/classes/tab.php | 38 ++++++------ tab/information/lib.php | 2 +- tab/information/version.php | 2 +- ...deotimetab_information_subplugin.class.php | 4 +- ...deotimetab_information_subplugin.class.php | 2 +- tab/related/classes/tab.php | 38 ++++++------ tab/related/lib.php | 2 +- tab/related/version.php | 2 +- ...videotimetab_texttrack_subplugin.class.php | 4 +- ...videotimetab_texttrack_subplugin.class.php | 2 +- tab/texttrack/classes/tab.php | 58 +++++++++---------- tab/texttrack/version.php | 2 +- tab/watch/version.php | 2 +- tests/behat/behat_mod_videotime.php | 2 +- tests/external_test.php | 2 +- tests/lib_test.php | 20 +++---- 75 files changed, 345 insertions(+), 331 deletions(-) diff --git a/action.php b/action.php index 59f6d217..21c100b3 100644 --- a/action.php +++ b/action.php @@ -39,11 +39,11 @@ if ($id) { $cm = get_coursemodule_from_id('videotime', $id, 0, false, MUST_EXIST); - $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); - $moduleinstance = $DB->get_record('videotime', array('id' => $cm->instance), '*', MUST_EXIST); + $course = $DB->get_record('course', ['id' => $cm->course], '*', MUST_EXIST); + $moduleinstance = $DB->get_record('videotime', ['id' => $cm->instance], '*', MUST_EXIST); } else if ($v) { - $moduleinstance = $DB->get_record('videotime', array('id' => $n), '*', MUST_EXIST); - $course = $DB->get_record('course', array('id' => $moduleinstance->course), '*', MUST_EXIST); + $moduleinstance = $DB->get_record('videotime', ['id' => $n], '*', MUST_EXIST); + $course = $DB->get_record('course', ['id' => $moduleinstance->course], '*', MUST_EXIST); $cm = get_coursemodule_from_instance('videotime', $moduleinstance->id, $course->id, false, MUST_EXIST); } else { throw new moodle_exception('invalidcoursemodule', 'mod_videotime'); @@ -65,7 +65,7 @@ 'v' => $v, 'action' => $action, 'return' => $return, - 'userid' => $userid + 'userid' => $userid, ]); $PAGE->set_title(format_string($moduleinstance->name)); $PAGE->set_heading(format_string($course->fullname)); @@ -77,7 +77,7 @@ $task = new \videotimeplugin_pro\task\delete_session_data(); $task->set_custom_data([ 'user_id' => $userid, - 'module_id' => $cm->id + 'module_id' => $cm->id, ]); break; } diff --git a/backup/moodle2/backup_videotime_stepslib.php b/backup/moodle2/backup_videotime_stepslib.php index 29bab76d..07979bab 100644 --- a/backup/moodle2/backup_videotime_stepslib.php +++ b/backup/moodle2/backup_videotime_stepslib.php @@ -87,7 +87,7 @@ protected function define_structure() { 'resume_playback', 'preview_picture', 'show_description_in_player', - 'enabletabs' + 'enabletabs', ]); // Build the tree. @@ -99,7 +99,7 @@ protected function define_structure() { $this->add_subplugin_structure('videotimeplugin', $module, true); // Define sources. - $module->set_source_table('videotime', array('id' => backup::VAR_ACTIVITYID)); + $module->set_source_table('videotime', ['id' => backup::VAR_ACTIVITYID]); // Define file annotations. $module->annotate_files('mod_videotime', 'intro', null); // This file area hasn't itemid. diff --git a/backup/moodle2/restore_videotime_activity_task.class.php b/backup/moodle2/restore_videotime_activity_task.class.php index 5d4b4862..de0529a3 100644 --- a/backup/moodle2/restore_videotime_activity_task.class.php +++ b/backup/moodle2/restore_videotime_activity_task.class.php @@ -55,10 +55,10 @@ protected function define_my_steps() { * processed by the link decoder */ public static function define_decode_contents() { - $contents = array(); + $contents = []; - $contents[] = new restore_decode_content('videotime', array('intro'), 'videotime'); - $contents[] = new restore_decode_content('videotime', array('video_description'), 'videotime'); + $contents[] = new restore_decode_content('videotime', ['intro'], 'videotime'); + $contents[] = new restore_decode_content('videotime', ['video_description'], 'videotime'); return $contents; } @@ -68,7 +68,7 @@ public static function define_decode_contents() { * to the activity to be executed by the link decoder */ public static function define_decode_rules() { - return array(); + return []; } /** @@ -76,7 +76,7 @@ public static function define_decode_rules() { * videotime logs. It must return one array of restore_log_rule objects */ public static function define_restore_log_rules() { - $rules = array(); + $rules = []; $rules[] = new restore_log_rule('videotime', 'add', 'view.php?id={course_module}', '{videotime}'); $rules[] = new restore_log_rule('videotime', 'update', 'view.php?id={course_module}', '{videotime}'); @@ -93,7 +93,7 @@ public static function define_restore_log_rules() { * activity level. All them are rules not linked to any module instance (cmid = 0) */ public static function define_restore_log_rules_for_course() { - $rules = array(); + $rules = []; $rules[] = new restore_log_rule('videotime', 'view all', 'index.php?id={course}', null); diff --git a/classes/event/course_module_viewed.php b/classes/event/course_module_viewed.php index 9bb97a75..4971dec8 100644 --- a/classes/event/course_module_viewed.php +++ b/classes/event/course_module_viewed.php @@ -50,6 +50,6 @@ protected function init() { * return array */ public static function get_objectid_mapping() { - return array('db' => 'videotime', 'restore' => 'videotime'); + return ['db' => 'videotime', 'restore' => 'videotime']; } } diff --git a/classes/external/get_videotime.php b/classes/external/get_videotime.php index 16bcc9c8..b9486713 100644 --- a/classes/external/get_videotime.php +++ b/classes/external/get_videotime.php @@ -42,7 +42,7 @@ trait get_videotime { */ public static function get_videotime_parameters() { return new external_function_parameters([ - 'cmid' => new external_value(PARAM_INT, 'Course module ID', VALUE_REQUIRED) + 'cmid' => new external_value(PARAM_INT, 'Course module ID', VALUE_REQUIRED), ]); } @@ -54,7 +54,7 @@ public static function get_videotime_parameters() { */ public static function get_videotime($cmid) { $params = external_api::validate_parameters(self::get_videotime_parameters(), [ - 'cmid' => $cmid + 'cmid' => $cmid, ]); $context = \context_module::instance($params['cmid']); diff --git a/classes/external/view_videotime.php b/classes/external/view_videotime.php index 864a6d6e..e9d364f4 100644 --- a/classes/external/view_videotime.php +++ b/classes/external/view_videotime.php @@ -46,7 +46,7 @@ trait view_videotime { */ public static function view_videotime_parameters() { return new external_function_parameters([ - 'cmid' => new external_value(PARAM_INT, 'Course module ID.') + 'cmid' => new external_value(PARAM_INT, 'Course module ID.'), ]); } @@ -60,7 +60,7 @@ public static function view_videotime($cmid) { global $DB; $params = external_api::validate_parameters(self::view_videotime_parameters(), [ - 'cmid' => $cmid + 'cmid' => $cmid, ]); $cm = get_coursemodule_from_id('videotime', $params['cmid']); diff --git a/classes/local/dash_framework/structure/videotime_session_table.php b/classes/local/dash_framework/structure/videotime_session_table.php index da6ec27e..c7b88f8d 100644 --- a/classes/local/dash_framework/structure/videotime_session_table.php +++ b/classes/local/dash_framework/structure/videotime_session_table.php @@ -86,22 +86,22 @@ public function get_title(): string { public function get_fields(): array { $fields = [ new field('id', new lang_string('pluginname', 'videotime'), $this, null, [ - new identifier_attribute() + new identifier_attribute(), ]), new field('time', new lang_string('watch_time', 'videotime'), $this, 'SUM(time)', [ - new time_attribute() + new time_attribute(), ]), new field('state', new lang_string('state_finished', 'videotime'), $this, 'MAX(vtn.state)', [ - new bool_attribute() + new bool_attribute(), ]), new field('timestarted', new lang_string('timestarted', 'videotime'), $this, 'MIN(vtn.timecreated)', [ - new date_attribute() + new date_attribute(), ]), new field('percent_watch', new lang_string('watch_percent', 'videotime'), $this, 'MAX(percent_watch)', [ - new percent_attribute() + new percent_attribute(), ]), new field('current_watch_time', new lang_string('currentwatchtime', 'videotime'), $this, 'MAX(current_watch_time)', [ - new time_attribute() + new time_attribute(), ]), ]; @@ -110,7 +110,7 @@ public function get_fields(): array { new field('watched_time', new lang_string('watchedtime', 'videotime'), $this, 'MAX( CASE WHEN vtn.current_watch_time - vtn.start_time > 1 THEN vtn.current_watch_time ELSE 0 END )', [ - new time_attribute() + new time_attribute(), ]), new field('time_left', new lang_string('timeleft', 'videotime'), $this, 'MIN( CASE WHEN vtn.current_watch_time - vtn.start_time > 1 @@ -118,17 +118,17 @@ public function get_fields(): array { ELSE vvv.duration END )', [ - new time_attribute() + new time_attribute(), ]), new field('status', new lang_string('activitystatus', 'videotime'), $this, 'MAX(cmc.completionstate)', [ - new completion_status_attribute() + new completion_status_attribute(), ]), new field('timecompleted', new lang_string('timecompleted', 'videotime'), $this, 'CASE WHEN MAX(cmc.completionstate) > 0 THEN MAX(cmc.timemodified) ELSE NULL END', [ - new date_attribute() + new date_attribute(), ]), ]; $fields = array_merge($fields, $addfields); diff --git a/classes/local/dash_framework/structure/videotime_table.php b/classes/local/dash_framework/structure/videotime_table.php index 3ae41bbf..8f4cb890 100644 --- a/classes/local/dash_framework/structure/videotime_table.php +++ b/classes/local/dash_framework/structure/videotime_table.php @@ -85,21 +85,21 @@ public function get_fields(): array { $fields = [ new field('id', new lang_string('pluginname', 'videotime'), $this, null, [ - new identifier_attribute() + new identifier_attribute(), ]), new field('name', new lang_string('activity_name', 'videotime'), $this, 'vt.name'), new field('url', new lang_string('videotimeurl', 'videotime'), $this, 'vt.id', [ - new moodle_url_attribute(['url' => new moodle_url('/mod/videotime/view.php', ['v' => 'vt_id'])]) + new moodle_url_attribute(['url' => new moodle_url('/mod/videotime/view.php', ['v' => 'vt_id'])]), ]), new field('link', new lang_string('videotimelink', 'videotime'), $this, 'vt.id', [ new moodle_url_attribute(['url' => new moodle_url('/mod/videotime/view.php', ['v' => 'vt_id'])]), - new link_attribute(['label' => get_string('view')]) + new link_attribute(['label' => get_string('view')]), ]), new field('video_description', new lang_string('video_description', 'videotime'), $this, 'vt.id', [ - new notes_attribute() + new notes_attribute(), ]), new field('intro', new lang_string('moduleintro'), $this, 'vt.id', [ - new intro_attribute() + new intro_attribute(), ]), ]; @@ -107,27 +107,27 @@ public function get_fields(): array { if (videotime_has_pro()) { $fields = array_merge($fields, [ new field('unique_visitors', new lang_string('totaluniquevisitors', 'videotime'), $this, 'vt.id', [ - new unique_visitors_attribute() + new unique_visitors_attribute(), ]), new field('views', new lang_string('totalviews', 'videotime'), $this, 'vt.id', [ - new views_attribute() + new views_attribute(), ]), new field('average_view_time', new lang_string('averageviewtime', 'videotime'), $this, 'vt.id', [ new average_view_time_attribute(), - new time_attribute() + new time_attribute(), ]), new field('percentage_of_video_finished', new lang_string( 'percentageofvideofinished', 'videotime'), $this, 'vt.id', [ - new percentage_of_video_finished_attribute() + new percentage_of_video_finished_attribute(), ] ), new field('firstsession', new lang_string('firstsession', 'videotime'), $this, 'vt.id', [ new first_session_attribute(), - new date_attribute() + new date_attribute(), ]), new field('lastsession', new lang_string('lastsession', 'videotime'), $this, 'vt.id', [ new last_session_attribute(), - new date_attribute() + new date_attribute(), ]), ]); } @@ -136,30 +136,30 @@ public function get_fields(): array { $fields = array_merge($fields, [ new field('videocreated', new lang_string('videocreated', 'videotime'), $this, 'vt.id', [ new video_created_attribute(), - new date_attribute() + new date_attribute(), ]), new field('preview_url', new lang_string('preview_picture_url', 'videotime'), $this, 'vt.id', [ new image_url_attribute(), - new video_preview_attribute() + new video_preview_attribute(), ]), new field('preview_image', new lang_string('preview_picture', 'videotime'), $this, 'vt.id', [ new video_preview_attribute(), - new image_attribute() + new image_attribute(), ]), new field('preview_image_linked', new lang_string('preview_picture_linked', 'videotime'), $this, 'vt.id', [ new video_preview_attribute(), new image_attribute(), - new linked_data_attribute(['url' => new moodle_url('/mod/videotime/view.php', ['v' => 'vt_id'])]) + new linked_data_attribute(['url' => new moodle_url('/mod/videotime/view.php', ['v' => 'vt_id'])]), ]), new field('completion_on_view_time', new lang_string('completion_on_view', 'videotime'), $this, null, [ - new bool_attribute() + new bool_attribute(), ]), new field('completion_on_view_time_second', new lang_string('completion_on_view_seconds', 'videotime'), $this), new field('completion_on_finish', new lang_string('completion_on_finish', 'videotime'), $this, null, [ - new bool_attribute() + new bool_attribute(), ]), new field('completion_on_percent', new lang_string('completion_on_percent', 'videotime'), $this, null, [ - new bool_attribute() + new bool_attribute(), ]), new field('completion_on_percent_value', new lang_string('completion_on_percent_value', 'videotime'), $this, null), ]); diff --git a/classes/local/tabs/tab.php b/classes/local/tabs/tab.php index 7fec55ee..1d1f2ce0 100644 --- a/classes/local/tabs/tab.php +++ b/classes/local/tabs/tab.php @@ -147,7 +147,7 @@ public function get_data(): array { 'label' => $this->get_label(), 'active' => $this->get_active(), 'persistent' => $this->get_persistent(), - 'tabcontent' => $this->get_tab_content() + 'tabcontent' => $this->get_tab_content(), ]; } @@ -199,7 +199,7 @@ public static function data_preprocessing(array &$defaultvalues, int $instance) * @return array */ public static function get_config_file_areas(): array { - return array(); + return []; } /** @@ -231,7 +231,7 @@ protected function get_record(): stdClass { $name = preg_replace('/^videotimetab_(.*)\\\\tab/', '$1', get_called_class()); if (is_null($this->record)) { - $this->record = $DB->get_record("videotimetab_$name", array('videotime' => $this->get_instance()->id)); + $this->record = $DB->get_record("videotimetab_$name", ['videotime' => $this->get_instance()->id]); } return $this->record; } diff --git a/classes/output/mobile.php b/classes/output/mobile.php index 96746540..5d932c46 100644 --- a/classes/output/mobile.php +++ b/classes/output/mobile.php @@ -63,7 +63,7 @@ public static function mobile_course_view($args) { require_capability('mod/videotime:view', $context); - $videotime = $DB->get_record('videotime', array('id' => $cm->instance)); + $videotime = $DB->get_record('videotime', ['id' => $cm->instance]); $videotime->name = format_string($videotime->name); list($videotime->intro, $videotime->introformat) = @@ -73,13 +73,13 @@ public static function mobile_course_view($args) { 'id' => $cm->id, 'token' => self::create_service_token($context), ]); - $data = array( + $data = [ 'instance' => $videotime, 'cmid' => $cm->id, 'has_pro' => videotime_has_pro(), 'iframe' => !empty(get_config('videotime', 'mobileiframe')), 'url' => $url->out(false), - ); + ]; if (empty(get_config('videotime', 'mobileiframe'))) { $js = file_get_contents($CFG->dirroot . '/mod/videotime/appjs/videotime.js'); @@ -109,7 +109,7 @@ public static function view_init(array $args) { return [ 'javascript' => file_get_contents($CFG->dirroot . '/mod/videotime/appjs/player.js') . - file_get_contents("$CFG->dirroot/mod/videotime/appjs/view_init.js") + file_get_contents("$CFG->dirroot/mod/videotime/appjs/view_init.js"), ]; } @@ -124,7 +124,7 @@ public static function view_init(array $args) { public static function create_service_token($context) { global $DB; - $service = $DB->get_record('external_services', array('shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE), '*', MUST_EXIST); + $service = $DB->get_record('external_services', ['shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE], '*', MUST_EXIST); return external_generate_token_for_current_user($service)->token; } } diff --git a/classes/output/next_activity_button.php b/classes/output/next_activity_button.php index 0fed9a02..4654b2d0 100644 --- a/classes/output/next_activity_button.php +++ b/classes/output/next_activity_button.php @@ -180,7 +180,7 @@ public function get_data() { 'availability_info' => $this->availabilityinfo, 'availability_title' => videotime_is_totara() ? strip_tags($this->availabilityinfo) : null, 'is_restricted' => $this->isrestricted, - 'instance' => $this->moduleinstance->to_record() + 'instance' => $this->moduleinstance->to_record(), ]; } diff --git a/classes/plugin_manager.php b/classes/plugin_manager.php index 101912a4..864d97e8 100644 --- a/classes/plugin_manager.php +++ b/classes/plugin_manager.php @@ -58,7 +58,7 @@ class plugin_manager { * @param string $subtype - only videotimetab implemented */ public function __construct($subtype) { - $this->pageurl = new moodle_url('/mod/videotime/adminmanageplugins.php', array('subtype' => $subtype)); + $this->pageurl = new moodle_url('/mod/videotime/adminmanageplugins.php', ['subtype' => $subtype]); $this->subtype = $subtype; } @@ -71,8 +71,8 @@ public function __construct($subtype) { public function get_sorted_plugins_list() { $names = core_component::get_plugin_list($this->subtype); - $result = array(); - $disabled = array(); + $result = []; + $disabled = []; foreach ($names as $name => $path) { $classname = '\\' . $this->subtype . '_' . $name . '\\tab'; @@ -122,9 +122,9 @@ private function format_icon_link($action, $plugin, $icon, $alt) { } return $OUTPUT->action_icon(new moodle_url($url, - array('action' => $action, 'plugin' => $plugin, 'sesskey' => sesskey())), - new pix_icon($icon, $alt, 'moodle', array('title' => $alt)), - null, array('title' => $alt)) . ' '; + ['action' => $action, 'plugin' => $plugin, 'sesskey' => sesskey()]), + new pix_icon($icon, $alt, 'moodle', ['title' => $alt]), + null, ['title' => $alt]) . ' '; } /** @@ -140,11 +140,15 @@ private function view_plugins_table() { $this->view_header(); $table = new flexible_table($this->subtype . 'pluginsadminttable'); $table->define_baseurl($this->pageurl); - $table->define_columns(array('pluginname', 'version', 'hideshow', 'order', - 'settings', 'status', 'uninstall')); - $table->define_headers(array(get_string($this->subtype . 'pluginname', 'videotime'), - get_string('version'), get_string('hideshow', 'videotime'), - get_string('order'), get_string('settings'), get_string('status'), get_string('uninstallplugin', 'core_admin'))); + $table->define_columns([ + 'pluginname', 'version', 'hideshow', 'order', 'settings', 'status', 'uninstall', + ]); + $table->define_headers([ + get_string($this->subtype . 'pluginname', 'videotime'), + get_string('version'), get_string('hideshow', 'videotime'), + get_string('order'), get_string('settings'), get_string('status'), + get_string('uninstallplugin', 'core_admin'), + ]); $table->set_attribute('id', $this->subtype . 'plugins'); $table->set_attribute('class', 'admintable generaltable'); $table->setup(); @@ -153,7 +157,7 @@ private function view_plugins_table() { $shortsubtype = substr($this->subtype, strlen('videotime')); foreach ($plugins as $idx => $plugin) { - $row = array(); + $row = []; $class = ''; $row[] = get_string('pluginname', $this->subtype . '_' . $plugin); @@ -177,7 +181,7 @@ private function view_plugins_table() { if (!$idx == 0) { $movelinks .= $this->format_icon_link('moveup', $plugin, 't/up', get_string('up')); } else { - $movelinks .= $OUTPUT->spacer(array('width' => 16)); + $movelinks .= $OUTPUT->spacer(['width' => 16]); } if ($idx != count($plugins) - 1) { $movelinks .= $this->format_icon_link('movedown', $plugin, 't/down', get_string('down')); @@ -187,7 +191,7 @@ private function view_plugins_table() { $exists = file_exists($CFG->dirroot . '/mod/videotime/' . $shortsubtype . '/' . $plugin . '/settings.php'); if ($row[1] != '' && $exists) { $row[] = html_writer::link(new moodle_url('/admin/settings.php', - array('section' => $this->subtype . '_' . $plugin)), get_string('settings')); + ['section' => $this->subtype . '_' . $plugin]), get_string('settings')); } else { $row[] = ' '; } diff --git a/classes/plugininfo/videotimeplugin.php b/classes/plugininfo/videotimeplugin.php index 6c801b24..9141355f 100644 --- a/classes/plugininfo/videotimeplugin.php +++ b/classes/plugininfo/videotimeplugin.php @@ -50,18 +50,18 @@ public function available_updates() { switch ($this->name) { case 'pro': - $info = array( + $info = [ 'maturity' => MATURITY_RC, 'release' => '1.8 RC', 'version' => 2023101100, - ); + ]; break; case 'repository': - $info = array( + $info = [ 'maturity' => MATURITY_RC, 'release' => '1.8', 'version' => 2023101100, - ); + ]; break; } if (!empty($info) && $this->versiondb < $info['version']) { diff --git a/classes/plugininfo/videotimetab.php b/classes/plugininfo/videotimetab.php index 59a75927..9569d952 100644 --- a/classes/plugininfo/videotimetab.php +++ b/classes/plugininfo/videotimetab.php @@ -38,7 +38,7 @@ class videotimetab extends \core\plugininfo\base { * @return moodle_url */ public static function get_manage_url() { - return new moodle_url('/mod/videotime/adminmanageplugins.php', array('subtype' => 'videotimetab')); + return new moodle_url('/mod/videotime/adminmanageplugins.php', ['subtype' => 'videotimetab']); } /** diff --git a/classes/search/texttrack.php b/classes/search/texttrack.php index e174ed1f..535d2485 100644 --- a/classes/search/texttrack.php +++ b/classes/search/texttrack.php @@ -86,7 +86,7 @@ public function get_document_recordset($modifiedfrom = 0, \context $context = nu * @param array $options * @return \core_search\document */ - public function get_document($record, $options = array()) { + public function get_document($record, $options = []) { try { $cm = $this->get_cm($this->get_module_name(), $record->moduleinstanceid, $record->course); @@ -139,12 +139,12 @@ public function get_context_url(\core_search\document $doc) { $record = $DB->get_record_sql('SELECT te.*, tr.lang, tr.videotime FROM {videotimetab_texttrack_text} te JOIN {videotimetab_texttrack_track} tr ON te.track = tr.id - WHERE te.id = :itemid', array('itemid' => $itemid)); + WHERE te.id = :itemid', ['itemid' => $itemid]); - $url = new \moodle_url('/mod/videotime/view.php', array( + $url = new \moodle_url('/mod/videotime/view.php', [ 'id' => $contextmodule->instanceid, 'q' => optional_param('q', '', PARAM_TEXT), - )); + ]); if (!empty($record)) { $url->param('time', $record->starttime); @@ -180,7 +180,7 @@ public function get_doc_url(\core_search\document $doc) { $contextmodule = \context::instance_by_id($doc->get('contextid')); - $docparams = array('id' => $contextmodule->instanceid); + $docparams = ['id' => $contextmodule->instanceid]; return new \moodle_url('/mod/videotime/view.php', $docparams); } diff --git a/classes/videotime_instance.php b/classes/videotime_instance.php index ae52737c..9822a64c 100644 --- a/classes/videotime_instance.php +++ b/classes/videotime_instance.php @@ -116,7 +116,7 @@ class videotime_instance implements \renderable, \templatable { 'pip', 'dnt', 'width', - 'preventfastforwarding' + 'preventfastforwarding', ]; /** @@ -401,7 +401,7 @@ public static function create_additional_field_form_elements( $newelement = $mform->createElement('static', $fieldname . '_forced', '', get_string('option_forced', 'videotime', [ 'option' => $label, - 'value' => $value + 'value' => $value, ])); if ($group) { $group[] = $newelement; @@ -423,7 +423,7 @@ public static function get_mode_options() { return [ self::NORMAL_MODE => get_string('normal_mode', 'videotime'), self::LABEL_MODE => get_string('label_mode', 'videotime'), - self::PREVIEW_MODE => get_string('preview_mode', 'videotime') + self::PREVIEW_MODE => get_string('preview_mode', 'videotime'), ]; } diff --git a/db/access.php b/db/access.php index f6dc4b74..7e5997c0 100644 --- a/db/access.php +++ b/db/access.php @@ -24,35 +24,35 @@ defined('MOODLE_INTERNAL') || die; -$capabilities = array( - 'mod/videotime:view' => array( +$capabilities = [ + 'mod/videotime:view' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_MODULE, - 'archetypes' => array( + 'archetypes' => [ 'guest' => CAP_ALLOW, 'user' => CAP_ALLOW, - ) - ), + ], + ], - 'mod/videotime:addinstance' => array( + 'mod/videotime:addinstance' => [ 'riskbitmask' => RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - 'clonepermissionsfrom' => 'moodle/course:manageactivities' - ), + 'manager' => CAP_ALLOW, + ], + 'clonepermissionsfrom' => 'moodle/course:manageactivities', + ], - 'mod/videotime:view_report' => array( + 'mod/videotime:view_report' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_MODULE, - 'archetypes' => array( + 'archetypes' => [ 'editingteacher' => CAP_ALLOW, - 'teacher' => CAP_ALLOW - ) - ), -); + 'teacher' => CAP_ALLOW, + ], + ], +]; diff --git a/db/events.php b/db/events.php index 400f81e0..8ef07271 100644 --- a/db/events.php +++ b/db/events.php @@ -28,5 +28,5 @@ [ 'eventname' => '\core\event\admin_settings_changed', 'callback' => '\mod_videotime\event\settings_observer::changed', - ] + ], ]; diff --git a/db/mobile.php b/db/mobile.php index 2829b294..b81d43fa 100644 --- a/db/mobile.php +++ b/db/mobile.php @@ -38,7 +38,7 @@ 'offlinefunctions' => [ 'mobile_course_view' => [], ], - 'init' => 'view_init' + 'init' => 'view_init', ], ], 'lang' => [ diff --git a/db/services.php b/db/services.php index eacd02be..355fe6e9 100644 --- a/db/services.php +++ b/db/services.php @@ -42,5 +42,5 @@ 'type' => 'write', 'ajax' => true, 'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE, 'local_mobile'], - ] + ], ]; diff --git a/db/upgrade.php b/db/upgrade.php index 13098d5c..552d8512 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -511,7 +511,7 @@ function xmldb_videotime_upgrade($oldversion) { // Launch change of default for field controls. $dbman->change_field_default($table, $field); - $DB->set_field('videotime', 'controls', 1, array('controls' => 0)); + $DB->set_field('videotime', 'controls', 1, ['controls' => 0]); // Videotime savepoint reached. upgrade_mod_savepoint(true, 2022022100, 'videotime'); @@ -560,7 +560,7 @@ function xmldb_videotime_upgrade($oldversion) { if ($oldversion < 2022022802) { - $DB->set_field('videotime', 'controls', 1, array('controls' => 0)); + $DB->set_field('videotime', 'controls', 1, ['controls' => 0]); // Videotime savepoint reached. upgrade_mod_savepoint(true, 2022022802, 'videotime'); @@ -569,11 +569,11 @@ function xmldb_videotime_upgrade($oldversion) { if ($oldversion < 2022030104) { // Assign view_report to editing teacher if assigned to non editing teacher. $context = context_system::instance(); - $roles = $DB->get_records_menu('role', array(), '', 'shortname, id'); - $capabilities = $DB->get_records_menu('role_capabilities', array( + $roles = $DB->get_records_menu('role', [], '', 'shortname, id'); + $capabilities = $DB->get_records_menu('role_capabilities', [ 'contextid' => $context->id, - 'capability' => 'mod/videotime:view_report' - ), '', 'roleid, permission'); + 'capability' => 'mod/videotime:view_report', + ], '', 'roleid, permission'); if ( key_exists('editingteacher', $roles) && !key_exists($roles['editingteacher'], $capabilities) diff --git a/index.php b/index.php index 7a779055..6a7b0edb 100644 --- a/index.php +++ b/index.php @@ -28,18 +28,18 @@ $id = required_param('id', PARAM_INT); -$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST); +$course = $DB->get_record('course', ['id' => $id], '*', MUST_EXIST); require_course_login($course); $coursecontext = context_course::instance($course->id); -$event = \mod_videotime\event\course_module_instance_list_viewed::create(array( - 'context' => $coursecontext -)); +$event = \mod_videotime\event\course_module_instance_list_viewed::create([ + 'context' => $coursecontext, +]); $event->add_record_snapshot('course', $course); $event->trigger(); -$PAGE->set_url('/mod/videotime/index.php', array('id' => $id)); +$PAGE->set_url('/mod/videotime/index.php', ['id' => $id]); $PAGE->set_title(format_string($course->fullname)); $PAGE->set_heading(format_string($course->fullname)); $PAGE->set_context($coursecontext); @@ -52,21 +52,21 @@ $videotimes = get_all_instances_in_course('videotime', $course); if (empty($videotimes)) { - notice(get_string('nonewmodules', 'mod_videotime'), new moodle_url('/course/view.php', array('id' => $course->id))); + notice(get_string('nonewmodules', 'mod_videotime'), new moodle_url('/course/view.php', ['id' => $course->id])); } $table = new html_table(); $table->attributes['class'] = 'generaltable mod_index'; if ($course->format == 'weeks') { - $table->head = array(get_string('week'), get_string('name')); - $table->align = array('center', 'left'); + $table->head = [get_string('week'), get_string('name')]; + $table->align = ['center', 'left']; } else if ($course->format == 'topics') { - $table->head = array(get_string('topic'), get_string('name')); - $table->align = array('center', 'left', 'left', 'left'); + $table->head = [get_string('topic'), get_string('name')]; + $table->align = ['center', 'left', 'left', 'left']; } else { - $table->head = array(get_string('name')); - $table->align = array('left', 'left', 'left'); + $table->head = [get_string('name')]; + $table->align = ['left', 'left', 'left']; } if (videotime_has_pro() && has_capability('mod/videotime:view_report', $coursecontext)) { @@ -77,19 +77,19 @@ foreach ($videotimes as $videotime) { if (!$videotime->visible) { $link = html_writer::link( - new moodle_url('/mod/videotime/view.php', array('id' => $videotime->coursemodule)), + new moodle_url('/mod/videotime/view.php', ['id' => $videotime->coursemodule]), format_string($videotime->name, true), - array('class' => 'dimmed')); + ['class' => 'dimmed']); } else { $link = html_writer::link( - new moodle_url('/mod/videotime/view.php', array('id' => $videotime->coursemodule)), + new moodle_url('/mod/videotime/view.php', ['id' => $videotime->coursemodule]), format_string($videotime->name, true)); } if ($course->format == 'weeks' || $course->format == 'topics') { - $data = array($videotime->section, $link); + $data = [$videotime->section, $link]; } else { - $data = array($link); + $data = [$link]; } if (videotime_has_pro() && has_capability('mod/videotime:view_report', $coursecontext)) { diff --git a/lib.php b/lib.php index a5ec2996..1cd0ff40 100644 --- a/lib.php +++ b/lib.php @@ -196,7 +196,7 @@ function videotime_add_instance($moduleinstance, $mform = null) { // Plugins may need to use context now, so we need to make sure all needed info is already in db. $cmid = $moduleinstance->coursemodule; - $DB->set_field('course_modules', 'instance', $moduleinstance->id, array('id' => $cmid)); + $DB->set_field('course_modules', 'instance', $moduleinstance->id, ['id' => $cmid]); foreach (array_keys(core_component::get_plugin_list('videotimetab')) as $name) { $classname = "\\videotimetab_$name\\tab"; $classname::save_settings($moduleinstance); @@ -284,7 +284,7 @@ function videotime_update_instance($moduleinstance, $mform = null) { function videotime_delete_instance($id) { global $DB; - $exists = $DB->get_record('videotime', array('id' => $id)); + $exists = $DB->get_record('videotime', ['id' => $id]); if (!$exists) { return false; } @@ -301,7 +301,7 @@ function videotime_delete_instance($id) { component_callback("videotimeplugin_$name", 'delete_instance', [$id]); } - $DB->delete_records('videotime', array('id' => $id)); + $DB->delete_records('videotime', ['id' => $id]); return true; } @@ -318,7 +318,7 @@ function videotime_process_video_description($moduleinstance) { $videodescription = $moduleinstance->video_description; $moduleinstance->video_description = file_save_draft_area_files($videodescription['itemid'], $modcontext->id, 'mod_videotime', 'video_description', 0, - array('subdirs' => true), $videodescription['text']); + ['subdirs' => true], $videodescription['text']); $moduleinstance->video_description_format = $videodescription['format']; } return $moduleinstance; @@ -405,7 +405,7 @@ function videotime_update_completion($cmid) { $cm = get_coursemodule_from_id('videotime', $cmid, 0, false, MUST_EXIST); $course = get_course($cm->course); - $moduleinstance = $DB->get_record('videotime', array('id' => $cm->instance), '*', MUST_EXIST); + $moduleinstance = $DB->get_record('videotime', ['id' => $cm->instance], '*', MUST_EXIST); $completion = new \completion_info($course); // Update completion status only if any extra criteria is set on the activity. @@ -428,7 +428,7 @@ function videotime_update_completion($cmid) { * @param array $options additional options affecting the file serving * @return bool false if the file was not found, just send the file otherwise and do not return anything */ -function videotime_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { +function videotime_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=[]) { if ($context->contextlevel != CONTEXT_MODULE) { return false; @@ -463,10 +463,10 @@ function videotime_view(videotime_instance $videotime, $course, $cm, $context) { global $USER; // Trigger course_module_viewed event. - $params = array( + $params = [ 'context' => $context, 'objectid' => $videotime->id, - ); + ]; $event = \mod_videotime\event\course_module_viewed::create($params); $event->add_record_snapshot('course_modules', $cm); @@ -554,14 +554,14 @@ function videotime_extend_settings_navigation($settings, $videtimenode) { has_capability('mod/videotime:addinstance', $PAGE->cm->context) ) { $node = navigation_node::create(get_string('embed_options', 'mod_videotime'), - new moodle_url('/mod/videotime/options.php', array('id' => $PAGE->cm->id)), + new moodle_url('/mod/videotime/options.php', ['id' => $PAGE->cm->id]), navigation_node::TYPE_SETTING, null, 'mod_videotime_options', new pix_icon('t/play', '')); $videtimenode->add_node($node, $beforekey); } if (videotime_has_pro() && $PAGE->cm && has_capability('mod/videotime:view_report', $PAGE->cm->context)) { $node = navigation_node::create(get_string('report'), - new moodle_url('/mod/videotime/report.php', array('id' => $PAGE->cm->id)), + new moodle_url('/mod/videotime/report.php', ['id' => $PAGE->cm->id]), navigation_node::TYPE_SETTING, null, 'mod_videotime_report', new pix_icon('t/grades', '')); $videtimenode->add_node($node, $beforekey); diff --git a/mod_form.php b/mod_form.php index 166daf87..0ab88960 100644 --- a/mod_form.php +++ b/mod_form.php @@ -97,7 +97,7 @@ public function definition() { $mform->setType('vimeo_url', PARAM_URL); // Adding the standard "name" field. - $mform->addElement('text', 'name', get_string('activity_name', 'mod_videotime'), array('size' => '64')); + $mform->addElement('text', 'name', get_string('activity_name', 'mod_videotime'), ['size' => '64']); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); @@ -122,8 +122,14 @@ public function definition() { // Video Time video description. $mform->addElement('editor', 'video_description', get_string('video_description', 'videotime'), - array('rows' => 10), array('maxfiles' => EDITOR_UNLIMITED_FILES, - 'noclean' => true, 'context' => $this->context, 'subdirs' => true)); + ['rows' => 10], + [ + 'maxfiles' => EDITOR_UNLIMITED_FILES, + 'noclean' => true, + 'context' => $this->context, + 'subdirs' => true, + ], + ); $mform->setType('video_description', PARAM_RAW); // No XSS prevention here, users must be trusted. $mform->addHelpButton('video_description', 'video_description', 'videotime'); @@ -175,8 +181,12 @@ protected function standard_intro_elements($customlabel=null) { $mform = $this->_form; $label = is_null($customlabel) ? get_string('moduleintro') : $customlabel; - $mform->addElement('editor', 'introeditor', $label, array('rows' => 10), array('maxfiles' => EDITOR_UNLIMITED_FILES, - 'noclean' => true, 'context' => $this->context, 'subdirs' => true)); + $mform->addElement('editor', 'introeditor', $label, ['rows' => 10], [ + 'maxfiles' => EDITOR_UNLIMITED_FILES, + 'noclean' => true, + 'context' => $this->context, + 'subdirs' => true, + ]); $mform->setType('introeditor', PARAM_RAW); // No XSS prevention here, users must be trusted. if ($required) { $mform->addRule('introeditor', get_string('required'), 'required', null, 'client'); @@ -207,7 +217,7 @@ public function add_completion_rules() { $group[] =& $mform->createElement('text', 'completion_on_view_time_second', '', ['size' => 3]); $group[] =& $mform->createElement('static', 'seconds', '', get_string('seconds', 'videotime')); $mform->setType('completion_on_view_time_second', PARAM_INT); - $mform->addGroup($group, 'completion_on_view', '', array(' '), false); + $mform->addGroup($group, 'completion_on_view', '', [' '], false); $mform->disabledIf('completion_on_view_time_second', 'completion_on_view_time', 'notchecked'); $group = []; @@ -216,7 +226,7 @@ public function add_completion_rules() { $group[] =& $mform->createElement('text', 'completion_on_percent_value', '', ['size' => 3]); $group[] =& $mform->createElement('static', 'percent_label', '', '%'); $mform->setType('completion_on_percent_value', PARAM_INT); - $mform->addGroup($group, 'completion_on_percent', '', array(' '), false); + $mform->addGroup($group, 'completion_on_percent', '', [' '], false); $mform->disabledIf('completion_on_percent_value', 'completion_on_percent', 'notchecked'); $mform->addElement('advcheckbox', 'completion_on_finish', '', get_string('completion_on_finish', 'videotime')); diff --git a/options.php b/options.php index 2655ba5e..76eaa995 100644 --- a/options.php +++ b/options.php @@ -38,11 +38,11 @@ if ($id) { $cm = get_coursemodule_from_id('videotime', $id, 0, false, MUST_EXIST); - $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); - $moduleinstance = $DB->get_record('videotime', array('id' => $cm->instance), '*', MUST_EXIST); + $course = $DB->get_record('course', ['id' => $cm->course], '*', MUST_EXIST); + $moduleinstance = $DB->get_record('videotime', ['id' => $cm->instance], '*', MUST_EXIST); } else if ($v) { - $moduleinstance = $DB->get_record('videotime', array('id' => $n), '*', MUST_EXIST); - $course = $DB->get_record('course', array('id' => $moduleinstance->course), '*', MUST_EXIST); + $moduleinstance = $DB->get_record('videotime', ['id' => $n], '*', MUST_EXIST); + $course = $DB->get_record('course', ['id' => $moduleinstance->course], '*', MUST_EXIST); $cm = get_coursemodule_from_instance('videotime', $moduleinstance->id, $course->id, false, MUST_EXIST); } else { throw new moodle_exception('invalidcoursemodule', 'mod_videotime'); diff --git a/plugin/live/backup/moodle2/backup_videotimeplugin_live_subplugin.class.php b/plugin/live/backup/moodle2/backup_videotimeplugin_live_subplugin.class.php index bd25f7cb..e067a135 100644 --- a/plugin/live/backup/moodle2/backup_videotimeplugin_live_subplugin.class.php +++ b/plugin/live/backup/moodle2/backup_videotimeplugin_live_subplugin.class.php @@ -56,7 +56,7 @@ protected function define_videotime_subplugin_structure() { // Set source to populate the data. $subplugintablesettings->set_source_table('videotimeplugin_live', - array('videotime' => backup::VAR_ACTIVITYID)); + ['videotime' => backup::VAR_ACTIVITYID]); return $subplugin; } diff --git a/plugin/live/backup/moodle2/restore_videotimeplugin_live_subplugin.class.php b/plugin/live/backup/moodle2/restore_videotimeplugin_live_subplugin.class.php index fd233b15..62bd9f8f 100644 --- a/plugin/live/backup/moodle2/restore_videotimeplugin_live_subplugin.class.php +++ b/plugin/live/backup/moodle2/restore_videotimeplugin_live_subplugin.class.php @@ -42,7 +42,7 @@ class restore_videotimeplugin_live_subplugin extends restore_subplugin { */ protected function define_videotime_subplugin_structure() { - $paths = array(); + $paths = []; $elename = $this->get_namefor(''); $elepath = $this->get_pathfor('/live_settings'); diff --git a/plugin/live/classes/event/video_ended.php b/plugin/live/classes/event/video_ended.php index 4db3b93b..6117ba66 100644 --- a/plugin/live/classes/event/video_ended.php +++ b/plugin/live/classes/event/video_ended.php @@ -16,7 +16,7 @@ namespace videotimeplugin_live\event; -use \core\event\base; +use core\event\base; /** * The video ended event diff --git a/plugin/live/classes/event/video_started.php b/plugin/live/classes/event/video_started.php index b8593ce5..fe25079d 100644 --- a/plugin/live/classes/event/video_started.php +++ b/plugin/live/classes/event/video_started.php @@ -16,7 +16,7 @@ namespace videotimeplugin_live\event; -use \core\event\base; +use core\event\base; /** * The video started event diff --git a/plugin/live/classes/external/join_room.php b/plugin/live/classes/external/join_room.php index 792e0e86..8ddd68e6 100644 --- a/plugin/live/classes/external/join_room.php +++ b/plugin/live/classes/external/join_room.php @@ -105,8 +105,8 @@ public static function execute($handle, $id, $plugin, $ptype, $room, $session, $ if ($feed) { $message['streams'] = [ [ - 'feed' => $feed - ] + 'feed' => $feed, + ], ]; } else { require_capability('block/deft:sharevideo', $context); diff --git a/plugin/live/classes/form/options.php b/plugin/live/classes/form/options.php index d07224e3..329cc483 100644 --- a/plugin/live/classes/form/options.php +++ b/plugin/live/classes/form/options.php @@ -190,7 +190,7 @@ public static function create_additional_field_form_elements(string $fieldname, $element = $mform->createElement('static', $fieldname . '_forced', '', get_string('option_forced', 'videotime', [ 'option' => $label, - 'value' => $value + 'value' => $value, ])); if ($group) { $group[] = $element; diff --git a/plugin/live/db/access.php b/plugin/live/db/access.php index 87dc7e31..5b5c10cc 100644 --- a/plugin/live/db/access.php +++ b/plugin/live/db/access.php @@ -32,7 +32,7 @@ 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ 'teacher' => CAP_ALLOW, - 'editingteacher' => CAP_ALLOW + 'editingteacher' => CAP_ALLOW, ], ], @@ -41,7 +41,7 @@ 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ 'teacher' => CAP_ALLOW, - 'editingteacher' => CAP_ALLOW + 'editingteacher' => CAP_ALLOW, ], ], ]; diff --git a/plugin/live/db/services.php b/plugin/live/db/services.php index 655b57a9..92019eeb 100644 --- a/plugin/live/db/services.php +++ b/plugin/live/db/services.php @@ -32,7 +32,7 @@ 'description' => 'Get currect video feed', 'type' => 'read', 'ajax' => true, - 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), + 'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE], ], 'videotimeplugin_live_get_room' => [ @@ -41,7 +41,7 @@ 'description' => 'Get currect room parameters for module', 'type' => 'read', 'ajax' => true, - 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), + 'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE], ], 'videotimeplugin_live_join_room' => [ @@ -50,7 +50,7 @@ 'description' => 'Join Janus room', 'type' => 'write', 'ajax' => true, - 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), + 'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE], ], 'videotimeplugin_live_publish_feed' => [ @@ -59,7 +59,7 @@ 'description' => 'Publish a video feed', 'type' => 'write', 'ajax' => true, - 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), + 'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE], ], 'videotimeplugin_live_renew_token' => [ @@ -68,6 +68,6 @@ 'description' => 'Get new token to access message service', 'type' => 'read', 'ajax' => true, - 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), + 'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE], ], ]; diff --git a/plugin/live/lib.php b/plugin/live/lib.php index c9e1aff6..ce52bdab 100644 --- a/plugin/live/lib.php +++ b/plugin/live/lib.php @@ -60,7 +60,7 @@ function videotimeplugin_live_update_instance($moduleinstance, $mform = null) { $record['id'] = $DB->insert_record('videotimeplugin_live', $record); } } else { - $DB->delete_records('videotimeplugin_live', array('videotime' => $moduleinstance->id)); + $DB->delete_records('videotimeplugin_live', ['videotime' => $moduleinstance->id]); } } @@ -73,7 +73,7 @@ function videotimeplugin_live_update_instance($moduleinstance, $mform = null) { function videotimeplugin_live_delete_instance($id) { global $DB; - $DB->delete_records('videotimeplugin_live', array('videotime' => $id)); + $DB->delete_records('videotimeplugin_live', ['videotime' => $id]); \block_deft\janus_room::remove('videotimeplugin_live', $id); return true; @@ -98,7 +98,7 @@ function videotimeplugin_live_load_settings($instance) { $instance = (array) $instance; if ( - $record = $DB->get_record('videotimeplugin_live', array('videotime' => $instance['id'])) + $record = $DB->get_record('videotimeplugin_live', ['videotime' => $instance['id']]) ) { unset($record->id); unset($record->videotime); @@ -189,7 +189,7 @@ function videotimeplugin_live_data_preprocessing(array &$defaultvalues, int $ins if (empty($instance)) { $settings = (array) get_config('videotimeplugin_live'); } else { - $settings = (array) $DB->get_record('videotimeplugin_live', array('videotime' => $instance)); + $settings = (array) $DB->get_record('videotimeplugin_live', ['videotime' => $instance]); $defaultvalues['livefeed'] = !empty($settings['id']); unset($settings['id']); unset($settings['videotime']); diff --git a/plugin/live/settings.php b/plugin/live/settings.php index 87783015..bcc32691 100644 --- a/plugin/live/settings.php +++ b/plugin/live/settings.php @@ -60,7 +60,7 @@ $options = [ 'accepted_types' => [ - '.png', '.jpg', '.gif', '.webp', '.tiff', '.svg' + '.png', '.jpg', '.gif', '.webp', '.tiff', '.svg', ], ]; $settings->add(new admin_setting_configstoredfile( diff --git a/plugin/videojs/backup/moodle2/backup_videotimeplugin_videojs_subplugin.class.php b/plugin/videojs/backup/moodle2/backup_videotimeplugin_videojs_subplugin.class.php index b1fe5429..6c9577d2 100644 --- a/plugin/videojs/backup/moodle2/backup_videotimeplugin_videojs_subplugin.class.php +++ b/plugin/videojs/backup/moodle2/backup_videotimeplugin_videojs_subplugin.class.php @@ -55,7 +55,7 @@ protected function define_videotime_subplugin_structure() { // Set source to populate the data. $subplugintablesettings->set_source_table('videotimeplugin_videojs', - array('videotime' => backup::VAR_ACTIVITYID)); + ['videotime' => backup::VAR_ACTIVITYID]); return $subplugin; } diff --git a/plugin/videojs/backup/moodle2/restore_videotimeplugin_videojs_subplugin.class.php b/plugin/videojs/backup/moodle2/restore_videotimeplugin_videojs_subplugin.class.php index 6cd9c890..eada958c 100644 --- a/plugin/videojs/backup/moodle2/restore_videotimeplugin_videojs_subplugin.class.php +++ b/plugin/videojs/backup/moodle2/restore_videotimeplugin_videojs_subplugin.class.php @@ -42,7 +42,7 @@ class restore_videotimeplugin_videojs_subplugin extends restore_subplugin { */ protected function define_videotime_subplugin_structure() { - $paths = array(); + $paths = []; $elename = $this->get_namefor(''); $elepath = $this->get_pathfor('/videojs_settings'); diff --git a/plugin/videojs/classes/form/options.php b/plugin/videojs/classes/form/options.php index 57e0b1d0..e72a8b02 100644 --- a/plugin/videojs/classes/form/options.php +++ b/plugin/videojs/classes/form/options.php @@ -63,7 +63,7 @@ class options extends moodleform { 'pip', 'dnt', 'width', - 'preventfastforwarding' + 'preventfastforwarding', ]; /** @@ -213,7 +213,7 @@ public static function create_additional_field_form_elements(string $fieldname, $element = $mform->createElement('static', $fieldname . '_forced', '', get_string('option_forced', 'videotime', [ 'option' => $label, - 'value' => $value + 'value' => $value, ])); if ($group) { $group[] = $element; diff --git a/plugin/videojs/lib.php b/plugin/videojs/lib.php index 2450f999..ec1e4229 100644 --- a/plugin/videojs/lib.php +++ b/plugin/videojs/lib.php @@ -94,7 +94,7 @@ function videotimeplugin_videojs_update_instance($moduleinstance, $mform = null) function videotimeplugin_videojs_delete_instance($id) { global $DB; - $DB->delete_records('videotimeplugin_videojs', array('videotime' => $id)); + $DB->delete_records('videotimeplugin_videojs', ['videotime' => $id]); return true; } @@ -128,7 +128,7 @@ function videotimeplugin_videojs_load_settings($instance) { if ( !mod_videotime_get_vimeo_id_from_link($instance['vimeo_url']) - && $record = $DB->get_record('videotimeplugin_videojs', array('videotime' => $instance['id'])) + && $record = $DB->get_record('videotimeplugin_videojs', ['videotime' => $instance['id']]) ) { unset($record->id); unset($record->videotime); @@ -286,7 +286,7 @@ function videotimeplugin_videojs_data_preprocessing(array &$defaultvalues, int $ * @param array $options additional options affecting the file serving * @return bool false if the file was not found, just send the file otherwise and do not return anything */ -function videotimeplugin_videojs_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { +function videotimeplugin_videojs_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=[]) { if ($context->contextlevel == CONTEXT_SYSTEM && $filearea == 'audioimage' ) { // Extract the filename / filepath from the $args array. diff --git a/plugin/videojs/settings.php b/plugin/videojs/settings.php index be419b7b..bc24af7e 100644 --- a/plugin/videojs/settings.php +++ b/plugin/videojs/settings.php @@ -67,7 +67,7 @@ $options = [ 'accepted_types' => [ - '.png', '.jpg', '.gif', '.webp', '.tiff', '.svg' + '.png', '.jpg', '.gif', '.webp', '.tiff', '.svg', ], ]; $settings->add(new admin_setting_configstoredfile( diff --git a/plugin/vimeo/backup/moodle2/backup_videotimeplugin_vimeo_subplugin.class.php b/plugin/vimeo/backup/moodle2/backup_videotimeplugin_vimeo_subplugin.class.php index 45c91ffb..81510828 100644 --- a/plugin/vimeo/backup/moodle2/backup_videotimeplugin_vimeo_subplugin.class.php +++ b/plugin/vimeo/backup/moodle2/backup_videotimeplugin_vimeo_subplugin.class.php @@ -62,7 +62,7 @@ protected function define_videotime_subplugin_structure() { // Set source to populate the data. $subplugintablesettings->set_source_table('videotimeplugin_vimeo', - array('videotime' => backup::VAR_ACTIVITYID)); + ['videotime' => backup::VAR_ACTIVITYID]); return $subplugin; } diff --git a/plugin/vimeo/backup/moodle2/restore_videotimeplugin_vimeo_subplugin.class.php b/plugin/vimeo/backup/moodle2/restore_videotimeplugin_vimeo_subplugin.class.php index b555d048..8476c968 100644 --- a/plugin/vimeo/backup/moodle2/restore_videotimeplugin_vimeo_subplugin.class.php +++ b/plugin/vimeo/backup/moodle2/restore_videotimeplugin_vimeo_subplugin.class.php @@ -42,7 +42,7 @@ class restore_videotimeplugin_vimeo_subplugin extends restore_subplugin { */ protected function define_videotime_subplugin_structure() { - $paths = array(); + $paths = []; $elename = $this->get_namefor(''); $elepath = $this->get_pathfor('/vimeo_settings'); diff --git a/plugin/vimeo/classes/form/options.php b/plugin/vimeo/classes/form/options.php index cf1a0d9c..b8a1dca4 100644 --- a/plugin/vimeo/classes/form/options.php +++ b/plugin/vimeo/classes/form/options.php @@ -64,7 +64,7 @@ class options extends moodleform { 'pip', 'dnt', 'width', - 'preventfastforwarding' + 'preventfastforwarding', ]; /** @@ -252,7 +252,7 @@ public static function create_additional_field_form_elements(string $fieldname, $element = $mform->createElement('static', $fieldname . '_forced', '', get_string('option_forced', 'videotime', [ 'option' => $label, - 'value' => $value + 'value' => $value, ])); if ($group) { $group[] = $element; diff --git a/plugin/vimeo/lib.php b/plugin/vimeo/lib.php index 759276bc..c6663cc2 100644 --- a/plugin/vimeo/lib.php +++ b/plugin/vimeo/lib.php @@ -66,7 +66,7 @@ function videotimeplugin_vimeo_update_instance($moduleinstance, $mform = null) { function videotimeplugin_vimeo_delete_instance($id) { global $DB; - $DB->delete_records('videotimeplugin_vimeo', array('videotime' => $id)); + $DB->delete_records('videotimeplugin_vimeo', ['videotime' => $id]); return true; } @@ -99,7 +99,7 @@ function videotimeplugin_vimeo_load_settings($instance) { $instance = (array) $instance; if ( - $record = $DB->get_record('videotimeplugin_vimeo', array('videotime' => $instance['id'])) + $record = $DB->get_record('videotimeplugin_vimeo', ['videotime' => $instance['id']]) ) { unset($record->id); unset($record->videotime); diff --git a/report.php b/report.php index 5f74879d..cb6a4d9d 100644 --- a/report.php +++ b/report.php @@ -40,11 +40,11 @@ if ($id) { $cm = get_coursemodule_from_id('videotime', $id, 0, false, MUST_EXIST); - $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); - $moduleinstance = $DB->get_record('videotime', array('id' => $cm->instance), '*', MUST_EXIST); + $course = $DB->get_record('course', ['id' => $cm->course], '*', MUST_EXIST); + $moduleinstance = $DB->get_record('videotime', ['id' => $cm->instance], '*', MUST_EXIST); } else if ($v) { - $moduleinstance = $DB->get_record('videotime', array('id' => $n), '*', MUST_EXIST); - $course = $DB->get_record('course', array('id' => $moduleinstance->course), '*', MUST_EXIST); + $moduleinstance = $DB->get_record('videotime', ['id' => $n], '*', MUST_EXIST); + $course = $DB->get_record('course', ['id' => $moduleinstance->course], '*', MUST_EXIST); $cm = get_coursemodule_from_instance('videotime', $moduleinstance->id, $course->id, false, MUST_EXIST); } else { throw new moodle_exception('invalidcoursemodule', 'mod_videotime'); @@ -118,7 +118,7 @@ echo $OUTPUT->header(); if (videotime_has_repository()) { echo '
' . get_string('totalvideotime', 'videotime', [ - 'time' => session::format_time($videoduration) + 'time' => session::format_time($videoduration), ]) . '
'; } if (!class_exists('core\\output\\activity_header')) { diff --git a/settings.php b/settings.php index 09fe1ac3..4f995d18 100644 --- a/settings.php +++ b/settings.php @@ -54,11 +54,11 @@ new lang_string('enabletabs_help', 'videotime'), 0)); $settings->add(new admin_setting_configselect('videotime/defaulttabsize', get_string('defaulttabsize', 'videotime'), - get_string('defaulttabsize_help', 'videotime'), 'videotime-size-6', array( + get_string('defaulttabsize_help', 'videotime'), 'videotime-size-6', [ 'videotime-size-3' => get_string('panelwidthsmall', 'videotime'), 'videotime-size-6' => get_string('panelwidthmedium', 'videotime'), 'videotime-size-9' => get_string('panelwidthlarge', 'videotime'), - ))); + ])); $settings->add(new admin_setting_configcheckbox( 'videotime/mobileiframe', @@ -96,7 +96,7 @@ new lang_string('videotimetabplugins', 'videotime'), !$module->is_enabled())); $ADMIN->add('videotimetabplugins', new admin_externalpage('managevideotimetabplugins', get_string('managevideotimetabplugins', 'videotime'), - new moodle_url('/mod/videotime/adminmanageplugins.php', array('subtype' => 'videotimetab')))); + new moodle_url('/mod/videotime/adminmanageplugins.php', ['subtype' => 'videotimetab']))); foreach (core_plugin_manager::instance()->get_plugins_of_type('videotimetab') as $plugin) { $plugin->load_settings($ADMIN, 'videotimetabplugins', $hassiteconfig); @@ -106,7 +106,7 @@ new lang_string('subplugintype_videotimeplugin_plural', 'videotime'), !$module->is_enabled())); $ADMIN->add('videotimepluginplugins', new admin_externalpage('managevideotimepluginplugins', get_string('managevideotimepluginplugins', 'videotime'), - new moodle_url('/mod/videotime/adminmanageplugins.php', array('subtype' => 'videotimeplugin')))); + new moodle_url('/mod/videotime/adminmanageplugins.php', ['subtype' => 'videotimeplugin']))); foreach (core_plugin_manager::instance()->get_plugins_of_type('videotimeplugin') as $plugin) { $plugin->load_settings($ADMIN, 'videotimepluginplugins', $hassiteconfig); diff --git a/tab/block/backup/moodle2/backup_videotimetab_block_subplugin.class.php b/tab/block/backup/moodle2/backup_videotimetab_block_subplugin.class.php index ee5b2287..67ca0edc 100644 --- a/tab/block/backup/moodle2/backup_videotimetab_block_subplugin.class.php +++ b/tab/block/backup/moodle2/backup_videotimetab_block_subplugin.class.php @@ -38,7 +38,7 @@ protected function define_videotime_subplugin_structure() { $subplugin = $this->get_subplugin_element(); $subpluginwrapper = new backup_nested_element($this->get_recommended_name()); $subplugintablesettings = new backup_nested_element('videotimetab_block', - null, array('videotime', 'name')); + null, ['videotime', 'name']); // Connect XML elements into the tree. $subplugin->add_child($subpluginwrapper); @@ -46,7 +46,7 @@ protected function define_videotime_subplugin_structure() { // Set source to populate the data. $subplugintablesettings->set_source_table('videotimetab_block', - array('videotime' => backup::VAR_ACTIVITYID)); + ['videotime' => backup::VAR_ACTIVITYID]); return $subplugin; } diff --git a/tab/block/backup/moodle2/restore_videotimetab_block_subplugin.class.php b/tab/block/backup/moodle2/restore_videotimetab_block_subplugin.class.php index aba575b5..cd2ff96b 100644 --- a/tab/block/backup/moodle2/restore_videotimetab_block_subplugin.class.php +++ b/tab/block/backup/moodle2/restore_videotimetab_block_subplugin.class.php @@ -42,7 +42,7 @@ class restore_videotimetab_block_subplugin extends restore_subplugin { */ protected function define_videotime_subplugin_structure() { - $paths = array(); + $paths = []; $elename = $this->get_namefor(''); $elepath = $this->get_pathfor('/videotimetab_block'); diff --git a/tab/block/classes/tab.php b/tab/block/classes/tab.php index e97845cc..2ccd10d6 100644 --- a/tab/block/classes/tab.php +++ b/tab/block/classes/tab.php @@ -70,7 +70,7 @@ public function get_tab_content(): string { // We do not want to try editing or the course page. if ($PAGE->user_is_editing()) { - $url = new moodle_url('/mod/videotime/view.php', array('id' => $instance->get_cm()->id)); + $url = new moodle_url('/mod/videotime/view.php', ['id' => $instance->get_cm()->id]); return $OUTPUT->render_from_template('videotimetab_block/edit_label', [ 'id' => $instance->id, 'url' => $url->out(), @@ -80,7 +80,7 @@ public function get_tab_content(): string { $page = new \moodle_page(); $page->set_cm($instance->get_cm()); $page->set_context($instance->get_context()); - $page->set_url('/mod/videotime/view.php', array('id' => $instance->get_cm()->id)); + $page->set_url('/mod/videotime/view.php', ['id' => $instance->get_cm()->id]); $page->set_title('title'); $page->set_heading('heading'); $page->set_activity_record($instance->to_record()); @@ -125,9 +125,9 @@ public function is_visible(): bool { global $DB; $record = $this->get_instance()->to_record(); - return $this->is_enabled() && $DB->record_exists('videotimetab_block', array( - 'videotime' => $record->id - )); + return $this->is_enabled() && $DB->record_exists('videotimetab_block', [ + 'videotime' => $record->id, + ]); } /** @@ -139,17 +139,17 @@ public static function save_settings(stdClass $data) { global $DB; if (empty($data->enable_block)) { - $DB->delete_records('videotimetab_block', array( + $DB->delete_records('videotimetab_block', [ 'videotime' => $data->id, - )); - } else if ($record = $DB->get_record('videotimetab_block', array('videotime' => $data->id))) { + ]); + } else if ($record = $DB->get_record('videotimetab_block', ['videotime' => $data->id])) { $record->name = $data->blocktab_name; $DB->update_record('videotimetab_block', $record); } else { - $DB->insert_record('videotimetab_block', array( + $DB->insert_record('videotimetab_block', [ 'videotime' => $data->id, 'name' => $data->blocktab_name, - )); + ]); } } @@ -161,9 +161,9 @@ public static function save_settings(stdClass $data) { public static function delete_settings(int $id) { global $DB; - $DB->delete_records('videotimetab_block', array( + $DB->delete_records('videotimetab_block', [ 'videotime' => $id, - )); + ]); } /** @@ -177,7 +177,7 @@ public static function data_preprocessing(array &$defaultvalues, int $instance) if (empty($instance)) { $defaultvalues['enable_block'] = get_config('videotimetab_block', 'default'); - } else if ($record = $DB->get_record('videotimetab_block', array('videotime' => $instance))) { + } else if ($record = $DB->get_record('videotimetab_block', ['videotime' => $instance])) { $defaultvalues['enable_block'] = 1; $defaultvalues['blocktab_name'] = $record->name; } else { diff --git a/tab/block/version.php b/tab/block/version.php index eae7d6c1..154e1c9d 100644 --- a/tab/block/version.php +++ b/tab/block/version.php @@ -30,5 +30,5 @@ $plugin->requires = 2015111610; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ - 'videotime' => 2023011200 + 'videotime' => 2023011200, ]; diff --git a/tab/chapter/backup/moodle2/backup_videotimetab_chapter_subplugin.class.php b/tab/chapter/backup/moodle2/backup_videotimetab_chapter_subplugin.class.php index 666b6acf..7f8bb194 100644 --- a/tab/chapter/backup/moodle2/backup_videotimetab_chapter_subplugin.class.php +++ b/tab/chapter/backup/moodle2/backup_videotimetab_chapter_subplugin.class.php @@ -38,7 +38,7 @@ protected function define_videotime_subplugin_structure() { $subplugin = $this->get_subplugin_element(); $subpluginwrapper = new backup_nested_element($this->get_recommended_name()); $subplugintablesettings = new backup_nested_element('videotimetab_chapter', - null, array('videotime')); + null, ['videotime']); // Connect XML elements into the tree. $subplugin->add_child($subpluginwrapper); @@ -46,7 +46,7 @@ protected function define_videotime_subplugin_structure() { // Set source to populate the data. $subplugintablesettings->set_source_table('videotimetab_chapter', - array('videotime' => backup::VAR_ACTIVITYID)); + ['videotime' => backup::VAR_ACTIVITYID]); return $subplugin; } diff --git a/tab/chapter/backup/moodle2/restore_videotimetab_chapter_subplugin.class.php b/tab/chapter/backup/moodle2/restore_videotimetab_chapter_subplugin.class.php index 353102cb..c6c94023 100644 --- a/tab/chapter/backup/moodle2/restore_videotimetab_chapter_subplugin.class.php +++ b/tab/chapter/backup/moodle2/restore_videotimetab_chapter_subplugin.class.php @@ -42,7 +42,7 @@ class restore_videotimetab_chapter_subplugin extends restore_subplugin { */ protected function define_videotime_subplugin_structure() { - $paths = array(); + $paths = []; $elename = $this->get_namefor(''); $elepath = $this->get_pathfor('/videotimetab_chapter'); diff --git a/tab/chapter/classes/tab.php b/tab/chapter/classes/tab.php index 979d69d3..8a8fb806 100644 --- a/tab/chapter/classes/tab.php +++ b/tab/chapter/classes/tab.php @@ -82,9 +82,9 @@ public function is_visible(): bool { global $DB; $record = $this->get_instance()->to_record(); - return $this->is_enabled() && $DB->record_exists('videotimetab_chapter', array( - 'videotime' => $record->id - )); + return $this->is_enabled() && $DB->record_exists('videotimetab_chapter', [ + 'videotime' => $record->id, + ]); } /** @@ -96,14 +96,14 @@ public static function save_settings(stdClass $data) { global $DB; if (empty($data->enable_chapter)) { - $DB->delete_records('videotimetab_chapter', array( + $DB->delete_records('videotimetab_chapter', [ 'videotime' => $data->id, - )); + ]); } else { - if (!$record = $DB->get_record('videotimetab_chapter', array('videotime' => $data->id))) { - $DB->insert_record('videotimetab_chapter', array( + if (!$record = $DB->get_record('videotimetab_chapter', ['videotime' => $data->id])) { + $DB->insert_record('videotimetab_chapter', [ 'videotime' => $data->id, - )); + ]); } } } @@ -116,9 +116,9 @@ public static function save_settings(stdClass $data) { public static function delete_settings(int $id) { global $DB; - $DB->delete_records('videotimetab_chapter', array( + $DB->delete_records('videotimetab_chapter', [ 'videotime' => $id, - )); + ]); } /** @@ -132,7 +132,7 @@ public static function data_preprocessing(array &$defaultvalues, int $instance) if (empty($instance)) { $defaultvalues['enable_chapter'] = get_config('videotimetab_chapter', 'default'); - } else if ($record = $DB->get_record('videotimetab_chapter', array('videotime' => $instance))) { + } else if ($record = $DB->get_record('videotimetab_chapter', ['videotime' => $instance])) { $defaultvalues['enable_chapter'] = 1; } else { $defaultvalues['enable_chapter'] = 0; diff --git a/tab/chat/backup/moodle2/backup_videotimetab_chat_subplugin.class.php b/tab/chat/backup/moodle2/backup_videotimetab_chat_subplugin.class.php index b646cdfa..bc17a2f8 100644 --- a/tab/chat/backup/moodle2/backup_videotimetab_chat_subplugin.class.php +++ b/tab/chat/backup/moodle2/backup_videotimetab_chat_subplugin.class.php @@ -38,7 +38,7 @@ protected function define_videotime_subplugin_structure() { $subplugin = $this->get_subplugin_element(); $subpluginwrapper = new backup_nested_element($this->get_recommended_name()); $subplugintablesettings = new backup_nested_element('videotimetab_chat', - null, array('videotime', 'name')); + null, ['videotime', 'name']); // Connect XML elements into the tree. $subplugin->add_child($subpluginwrapper); @@ -46,7 +46,7 @@ protected function define_videotime_subplugin_structure() { // Set source to populate the data. $subplugintablesettings->set_source_table('videotimetab_chat', - array('videotime' => backup::VAR_ACTIVITYID)); + ['videotime' => backup::VAR_ACTIVITYID]); return $subplugin; } diff --git a/tab/chat/backup/moodle2/restore_videotimetab_chat_subplugin.class.php b/tab/chat/backup/moodle2/restore_videotimetab_chat_subplugin.class.php index 4be29e37..5f3457d6 100644 --- a/tab/chat/backup/moodle2/restore_videotimetab_chat_subplugin.class.php +++ b/tab/chat/backup/moodle2/restore_videotimetab_chat_subplugin.class.php @@ -42,7 +42,7 @@ class restore_videotimetab_chat_subplugin extends restore_subplugin { */ protected function define_videotime_subplugin_structure() { - $paths = array(); + $paths = []; $elename = $this->get_namefor(''); $elepath = $this->get_pathfor('/videotimetab_chat'); diff --git a/tab/chat/classes/privacy/provider.php b/tab/chat/classes/privacy/provider.php index da03d3fc..02db192d 100644 --- a/tab/chat/classes/privacy/provider.php +++ b/tab/chat/classes/privacy/provider.php @@ -75,7 +75,7 @@ public static function get_contexts_for_userid(int $userid) : contextlist { AND userid = :userid"; $params = [ 'component' => 'videotimetab_chat', - 'userid' => $userid + 'userid' => $userid, ]; $contextlist->add_from_sql($sql, $params); diff --git a/tab/chat/classes/tab.php b/tab/chat/classes/tab.php index f3e4fd76..8fa5b706 100644 --- a/tab/chat/classes/tab.php +++ b/tab/chat/classes/tab.php @@ -49,7 +49,7 @@ public function get_tab_content(): string { global $DB, $OUTPUT; $instance = $this->get_instance(); - if ($record = $DB->get_record('videotimetab_chat', array('videotime' => $instance->id))) { + if ($record = $DB->get_record('videotimetab_chat', ['videotime' => $instance->id])) { $cm = get_coursemodule_from_instance('videotime', $instance->id, $instance->course); $context = context_module::instance($cm->id); $main = new output\main($context, $record); @@ -82,17 +82,17 @@ public static function save_settings(stdClass $data) { global $DB; if (empty($data->enable_chat)) { - $DB->delete_records('videotimetab_chat', array( + $DB->delete_records('videotimetab_chat', [ 'videotime' => $data->id, - )); - } else if ($record = $DB->get_record('videotimetab_chat', array('videotime' => $data->id))) { + ]); + } else if ($record = $DB->get_record('videotimetab_chat', ['videotime' => $data->id])) { $record->name = $data->chattab_name; $DB->update_record('videotimetab_chat', $record); } else { - $DB->insert_record('videotimetab_chat', array( + $DB->insert_record('videotimetab_chat', [ 'videotime' => $data->id, 'name' => $data->chattab_name, - )); + ]); } } @@ -104,9 +104,9 @@ public static function save_settings(stdClass $data) { public static function delete_settings(int $id) { global $DB; - $DB->delete_records('videotimetab_chat', array( + $DB->delete_records('videotimetab_chat', [ 'videotime' => $id, - )); + ]); } /** @@ -121,11 +121,11 @@ public static function data_preprocessing(array &$defaultvalues, int $instance) if (empty($instance)) { $defaultvalues['enable_chat'] = get_config('videotimetab_chat', 'default'); } else { - $defaultvalues['enable_chat'] = $DB->record_exists('videotimetab_chat', array('videotime' => $instance)); + $defaultvalues['enable_chat'] = $DB->record_exists('videotimetab_chat', ['videotime' => $instance]); } if (empty($instance)) { $defaultvalues['enable_chat'] = get_config('videotimetab_chat', 'default'); - } else if ($record = $DB->get_record('videotimetab_chat', array('videotime' => $instance))) { + } else if ($record = $DB->get_record('videotimetab_chat', ['videotime' => $instance])) { $defaultvalues['enable_chat'] = 1; $defaultvalues['chattab_name'] = $record->name; } else { @@ -142,9 +142,9 @@ public function is_visible(): bool { global $DB; $record = $this->get_instance()->to_record(); - return $this->is_enabled() && $DB->record_exists('videotimetab_chat', array( - 'videotime' => $record->id - )); + return $this->is_enabled() && $DB->record_exists('videotimetab_chat', [ + 'videotime' => $record->id, + ]); } /** diff --git a/tab/information/backup/moodle2/backup_videotimetab_information_subplugin.class.php b/tab/information/backup/moodle2/backup_videotimetab_information_subplugin.class.php index 31723457..186d8989 100644 --- a/tab/information/backup/moodle2/backup_videotimetab_information_subplugin.class.php +++ b/tab/information/backup/moodle2/backup_videotimetab_information_subplugin.class.php @@ -38,7 +38,7 @@ protected function define_videotime_subplugin_structure() { $subplugin = $this->get_subplugin_element(); $subpluginwrapper = new backup_nested_element($this->get_recommended_name()); $subplugintablesettings = new backup_nested_element('videotimetab_information', - null, array('text', 'format', 'videotime', 'name')); + null, ['text', 'format', 'videotime', 'name']); // Connect XML elements into the tree. $subplugin->add_child($subpluginwrapper); @@ -46,7 +46,7 @@ protected function define_videotime_subplugin_structure() { // Set source to populate the data. $subplugintablesettings->set_source_table('videotimetab_information', - array('videotime' => backup::VAR_ACTIVITYID)); + ['videotime' => backup::VAR_ACTIVITYID]); return $subplugin; } diff --git a/tab/information/backup/moodle2/restore_videotimetab_information_subplugin.class.php b/tab/information/backup/moodle2/restore_videotimetab_information_subplugin.class.php index c4767776..ae5bab43 100644 --- a/tab/information/backup/moodle2/restore_videotimetab_information_subplugin.class.php +++ b/tab/information/backup/moodle2/restore_videotimetab_information_subplugin.class.php @@ -42,7 +42,7 @@ class restore_videotimetab_information_subplugin extends restore_subplugin { */ protected function define_videotime_subplugin_structure() { - $paths = array(); + $paths = []; $elename = $this->get_namefor(''); $elepath = $this->get_pathfor('/videotimetab_information'); diff --git a/tab/information/classes/tab.php b/tab/information/classes/tab.php index 0d95aa0c..fa779bea 100644 --- a/tab/information/classes/tab.php +++ b/tab/information/classes/tab.php @@ -47,7 +47,7 @@ public function get_tab_content(): string { global $DB; $instance = $this->get_instance(); - if ($record = $DB->get_record('videotimetab_information', array('videotime' => $instance->id))) { + if ($record = $DB->get_record('videotimetab_information', ['videotime' => $instance->id])) { $cm = get_coursemodule_from_instance('videotime', $instance->id, $instance->course); $context = context_module::instance($cm->id); return format_text(file_rewrite_pluginfile_urls( @@ -80,12 +80,12 @@ public static function add_form_fields($mform) { 'editor', 'information', get_string('information', 'videotimetab_information'), - array('rows' => 10), - array( + ['rows' => 10], + [ 'maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true, 'subdirs' => true, - ) + ] ); $mform->setType('information', PARAM_RAW); $mform->disabledIf('information', 'enable_information'); @@ -104,9 +104,9 @@ public static function save_settings(stdClass $data) { global $DB; if (empty($data->enable_information)) { - $DB->delete_records('videotimetab_information', array( + $DB->delete_records('videotimetab_information', [ 'videotime' => $data->id, - )); + ]); } else { $cm = get_coursemodule_from_instance('videotime', $data->id, $data->course); $text = file_save_draft_area_files( @@ -115,21 +115,21 @@ public static function save_settings(stdClass $data) { 'videotimetab_information', 'text', 0, - array('subdirs' => true), + ['subdirs' => true], $data->information['text'] ); - if ($record = $DB->get_record('videotimetab_information', array('videotime' => $data->id))) { + if ($record = $DB->get_record('videotimetab_information', ['videotime' => $data->id])) { $record->text = $text; $record->format = $data->information['format']; $record->name = $data->informationtab_name ?? ''; $DB->update_record('videotimetab_information', $record); } else { - $DB->insert_record('videotimetab_information', array( + $DB->insert_record('videotimetab_information', [ 'videotime' => $data->id, 'text' => $text, 'format' => $data->information['format'], 'name' => $data->informationtab_name, - )); + ]); } } } @@ -142,9 +142,9 @@ public static function save_settings(stdClass $data) { public static function delete_settings(int $id) { global $DB; - $DB->delete_records('videotimetab_information', array( + $DB->delete_records('videotimetab_information', [ 'videotime' => $id, - )); + ]); } /** @@ -158,17 +158,17 @@ public static function data_preprocessing(array &$defaultvalues, int $instance) if (empty($instance)) { $defaultvalues['enable_information'] = get_config('videotimetab_information', 'default'); - } else if ($record = $DB->get_record('videotimetab_information', array('videotime' => $instance))) { + } else if ($record = $DB->get_record('videotimetab_information', ['videotime' => $instance])) { $defaultvalues['enable_information'] = 1; $cm = get_coursemodule_from_instance('videotime', $record->videotime, $COURSE->id); $context = context_module::instance($cm->id); $draftitemid = file_get_submitted_draft_itemid('information'); - $defaultvalues['information'] = array( + $defaultvalues['information'] = [ 'text' => file_prepare_draft_area($draftitemid, $context->id, 'videotimetab_information', 'text', 0, [], $record->text), 'format' => $record->format, 'itemid' => $draftitemid, - ); + ]; $defaultvalues['informationtab_name'] = $record->name; } else { $defaultvalues['enable_information'] = 0; @@ -181,7 +181,7 @@ public static function data_preprocessing(array &$defaultvalues, int $instance) * @return array */ public static function get_config_file_areas(): array { - return array('text'); + return ['text']; } /** @@ -193,9 +193,9 @@ public function is_visible(): bool { global $DB; $record = $this->get_instance()->to_record(); - return $this->is_enabled() && $DB->record_exists('videotimetab_information', array( - 'videotime' => $record->id - )); + return $this->is_enabled() && $DB->record_exists('videotimetab_information', [ + 'videotime' => $record->id, + ]); } /** diff --git a/tab/information/lib.php b/tab/information/lib.php index eea6a646..0cb4dd2f 100644 --- a/tab/information/lib.php +++ b/tab/information/lib.php @@ -36,7 +36,7 @@ * @param array $options additional options affecting the file serving * @return bool false if the file was not found, just send the file otherwise and do not return anything */ -function videotimetab_information_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { +function videotimetab_information_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = []) { if ($context->contextlevel != CONTEXT_MODULE) { return false; diff --git a/tab/information/version.php b/tab/information/version.php index 1b20c892..3466641c 100644 --- a/tab/information/version.php +++ b/tab/information/version.php @@ -30,5 +30,5 @@ $plugin->requires = 2015111610; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ - 'videotime' => 2023011200 + 'videotime' => 2023011200, ]; diff --git a/tab/related/backup/moodle2/backup_videotimetab_information_subplugin.class.php b/tab/related/backup/moodle2/backup_videotimetab_information_subplugin.class.php index f6e20221..a0558124 100644 --- a/tab/related/backup/moodle2/backup_videotimetab_information_subplugin.class.php +++ b/tab/related/backup/moodle2/backup_videotimetab_information_subplugin.class.php @@ -38,7 +38,7 @@ protected function define_videotime_subplugin_structure() { $subplugin = $this->get_subplugin_element(); $subpluginwrapper = new backup_nested_element($this->get_recommended_name()); $subplugintablesettings = new backup_nested_element('videotimetab_related', - null, array('text', 'format', 'videotime', 'name')); + null, ['text', 'format', 'videotime', 'name']); // Connect XML elements into the tree. $subplugin->add_child($subpluginwrapper); @@ -46,7 +46,7 @@ protected function define_videotime_subplugin_structure() { // Set source to populate the data. $subplugintablesettings->set_source_table('videotimetab_related', - array('videotime' => backup::VAR_ACTIVITYID)); + ['videotime' => backup::VAR_ACTIVITYID]); return $subplugin; } diff --git a/tab/related/backup/moodle2/restore_videotimetab_information_subplugin.class.php b/tab/related/backup/moodle2/restore_videotimetab_information_subplugin.class.php index bbca30c3..0a6c9c3b 100644 --- a/tab/related/backup/moodle2/restore_videotimetab_information_subplugin.class.php +++ b/tab/related/backup/moodle2/restore_videotimetab_information_subplugin.class.php @@ -42,7 +42,7 @@ class restore_videotimetab_related_subplugin extends restore_subplugin { */ protected function define_videotime_subplugin_structure() { - $paths = array(); + $paths = []; $elename = $this->get_namefor(''); $elepath = $this->get_pathfor('/videotimetab_related'); diff --git a/tab/related/classes/tab.php b/tab/related/classes/tab.php index 2570c259..0227ed90 100644 --- a/tab/related/classes/tab.php +++ b/tab/related/classes/tab.php @@ -48,7 +48,7 @@ public function get_tab_content(): string { global $DB, $OUTPUT; $instance = $this->get_instance(); - if ($record = $DB->get_record('videotimetab_related', array('videotime' => $instance->id))) { + if ($record = $DB->get_record('videotimetab_related', ['videotime' => $instance->id])) { $cm = get_coursemodule_from_instance('videotime', $instance->id, $instance->course); $context = context_module::instance($cm->id); $text = format_text(file_rewrite_pluginfile_urls( @@ -99,12 +99,12 @@ public static function add_form_fields($mform) { 'editor', 'relatedinformation', get_string('relatedinformation', 'videotimetab_related'), - array('rows' => 10), - array( + ['rows' => 10], + [ 'maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true, 'subdirs' => true, - ) + ] ); $mform->setType('relatedinformation', PARAM_RAW); $mform->disabledIf('relatedinformation', 'enable_related'); @@ -123,9 +123,9 @@ public static function save_settings(stdClass $data) { global $DB; if (empty($data->enable_related)) { - $DB->delete_records('videotimetab_related', array( + $DB->delete_records('videotimetab_related', [ 'videotime' => $data->id, - )); + ]); } else { $cm = get_coursemodule_from_instance('videotime', $data->id, $data->course); $text = file_save_draft_area_files( @@ -134,21 +134,21 @@ public static function save_settings(stdClass $data) { 'videotimetab_related', 'text', 0, - array('subdirs' => true), + ['subdirs' => true], $data->relatedinformation['text'] ); - if ($record = $DB->get_record('videotimetab_related', array('videotime' => $data->id))) { + if ($record = $DB->get_record('videotimetab_related', ['videotime' => $data->id])) { $record->text = $text; $record->format = $data->relatedinformation['format']; $record->name = $data->relatedtab_name; $DB->update_record('videotimetab_related', $record); } else { - $DB->insert_record('videotimetab_related', array( + $DB->insert_record('videotimetab_related', [ 'videotime' => $data->id, 'text' => $text, 'format' => $data->relatedinformation['format'], 'name' => $data->relatedtab_name, - )); + ]); } } } @@ -161,9 +161,9 @@ public static function save_settings(stdClass $data) { public static function delete_settings(int $id) { global $DB; - $DB->delete_records('videotimetab_related', array( + $DB->delete_records('videotimetab_related', [ 'videotime' => $id, - )); + ]); } /** @@ -177,17 +177,17 @@ public static function data_preprocessing(array &$defaultvalues, int $instance) if (empty($instance)) { $defaultvalues['enable_related'] = get_config('videotimetab_related', 'default'); - } else if ($record = $DB->get_record('videotimetab_related', array('videotime' => $instance))) { + } else if ($record = $DB->get_record('videotimetab_related', ['videotime' => $instance])) { $defaultvalues['enable_related'] = 1; $cm = get_coursemodule_from_instance('videotime', $record->videotime, $COURSE->id); $context = context_module::instance($cm->id); $draftitemid = file_get_submitted_draft_itemid('relatedinformation'); - $defaultvalues['relatedinformation'] = array( + $defaultvalues['relatedinformation'] = [ 'text' => file_prepare_draft_area($draftitemid, $context->id, 'videotimetab_related', 'text', 0, [], $record->text), 'format' => $record->format, 'itemid' => $draftitemid, - ); + ]; $defaultvalues['relatedtab_name'] = $record->name; } else { $defaultvalues['enable_related'] = 0; @@ -200,7 +200,7 @@ public static function data_preprocessing(array &$defaultvalues, int $instance) * @return array */ public static function get_config_file_areas(): array { - return array('text'); + return ['text']; } /** @@ -212,9 +212,9 @@ public function is_visible(): bool { global $DB; $record = $this->get_instance()->to_record(); - return $this->is_enabled() && $DB->record_exists('videotimetab_related', array( - 'videotime' => $record->id - )); + return $this->is_enabled() && $DB->record_exists('videotimetab_related', [ + 'videotime' => $record->id, + ]); } /** diff --git a/tab/related/lib.php b/tab/related/lib.php index 07401e9e..67a566f8 100644 --- a/tab/related/lib.php +++ b/tab/related/lib.php @@ -36,7 +36,7 @@ * @param array $options additional options affecting the file serving * @return bool false if the file was not found, just send the file otherwise and do not return anything */ -function videotimetab_related_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { +function videotimetab_related_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = []) { if ($context->contextlevel != CONTEXT_MODULE) { return false; diff --git a/tab/related/version.php b/tab/related/version.php index 4004dd23..e66e2f1d 100644 --- a/tab/related/version.php +++ b/tab/related/version.php @@ -30,5 +30,5 @@ $plugin->requires = 2015111610; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ - 'videotime' => 2023011200 + 'videotime' => 2023011200, ]; diff --git a/tab/texttrack/backup/moodle2/backup_videotimetab_texttrack_subplugin.class.php b/tab/texttrack/backup/moodle2/backup_videotimetab_texttrack_subplugin.class.php index ea93a728..3322bfc7 100644 --- a/tab/texttrack/backup/moodle2/backup_videotimetab_texttrack_subplugin.class.php +++ b/tab/texttrack/backup/moodle2/backup_videotimetab_texttrack_subplugin.class.php @@ -38,7 +38,7 @@ protected function define_videotime_subplugin_structure() { $subplugin = $this->get_subplugin_element(); $subpluginwrapper = new backup_nested_element($this->get_recommended_name()); $subplugintablesettings = new backup_nested_element('videotimetab_texttrack', - null, array('text', 'format', 'videotime')); + null, ['text', 'format', 'videotime']); $subpluginelementtrack = new backup_nested_element('videotimetab_texttrack_track'); $subpluginelementtext = new backup_nested_element('videotimetab_texttrack_text'); @@ -48,7 +48,7 @@ protected function define_videotime_subplugin_structure() { // Set source to populate the data. $subplugintablesettings->set_source_table('videotimetab_texttrack', - array('videotime' => backup::VAR_ACTIVITYID)); + ['videotime' => backup::VAR_ACTIVITYID]); return $subplugin; } diff --git a/tab/texttrack/backup/moodle2/restore_videotimetab_texttrack_subplugin.class.php b/tab/texttrack/backup/moodle2/restore_videotimetab_texttrack_subplugin.class.php index 3b913b12..ac4e6136 100644 --- a/tab/texttrack/backup/moodle2/restore_videotimetab_texttrack_subplugin.class.php +++ b/tab/texttrack/backup/moodle2/restore_videotimetab_texttrack_subplugin.class.php @@ -42,7 +42,7 @@ class restore_videotimetab_texttrack_subplugin extends restore_subplugin { */ protected function define_videotime_subplugin_structure() { - $paths = array(); + $paths = []; $elename = $this->get_namefor(''); $elepath = $this->get_pathfor('/videotimetab_texttrack'); diff --git a/tab/texttrack/classes/tab.php b/tab/texttrack/classes/tab.php index 46a8b788..e3ccb09e 100644 --- a/tab/texttrack/classes/tab.php +++ b/tab/texttrack/classes/tab.php @@ -68,18 +68,18 @@ public static function add_form_fields($mform) { * @return array */ public function parse_texttrack(string $track): array { - $matches = array(); + $matches = []; preg_match_all('/([.:0-9]+) *--> *([.:0-9]+)(.*?)^$/ms', $track . '\n', $matches); return array_map(function($starttime, $endtime, $text) { - return array( + return [ 'starttime' => $starttime, 'endtime' => $endtime, 'lines' => array_map(function($text) { - return array('text' => $text); + return ['text' => $text]; }, explode("\n", $text)), 'text' => $text, - ); + ]; }, $matches[1], $matches[2], $matches[3]); } @@ -93,21 +93,21 @@ public function export_for_template(): array { $record = $this->get_instance()->to_record(); - $lastupdate = $DB->get_field('videotimetab_texttrack', 'lastupdate', array('videotime' => $record->id)); + $lastupdate = $DB->get_field('videotimetab_texttrack', 'lastupdate', ['videotime' => $record->id]); if ( ($lastupdate < $record->timemodified) - || $lastupdate < $DB->get_field('videotime_vimeo_video', 'modified_time', array('link' => $record->vimeo_url)) + || $lastupdate < $DB->get_field('videotime_vimeo_video', 'modified_time', ['link' => $record->vimeo_url]) ) { $this->update_tracks(); } $texttracks = []; $show = true; - foreach ($DB->get_records('videotimetab_texttrack_track', array('videotime' => $record->id)) as $track) { - $captions = $DB->get_records('videotimetab_texttrack_text', array('track' => $track->id), 'starttime, endtime'); + foreach ($DB->get_records('videotimetab_texttrack_track', ['videotime' => $record->id]) as $track) { + $captions = $DB->get_records('videotimetab_texttrack_text', ['track' => $track->id], 'starttime, endtime'); foreach ($captions as $caption) { $caption->lines = array_map(function($text) { - return array('text' => $text); + return ['text' => $text]; }, explode("\n", $caption->text)); $caption->starttimedisplay = preg_replace('/\\..*/', '', $caption->starttime); $caption = (array) $captions; @@ -119,10 +119,10 @@ public function export_for_template(): array { $texttracks[] = $track; } - return array( + return [ 'texttracks' => $texttracks, 'showselector' => count($texttracks) > 1, - ); + ]; } /** @@ -143,10 +143,10 @@ public function update_tracks() { return; } - if ($trackids = $DB->get_fieldset_select('videotimetab_texttrack_track', 'id', 'videotime = ?', array($record->id))) { + if ($trackids = $DB->get_fieldset_select('videotimetab_texttrack_track', 'id', 'videotime = ?', [$record->id])) { list($sql, $params) = $DB->get_in_or_equal($trackids); $DB->delete_records_select('videotimetab_texttrack_text', "track $sql", $params); - $DB->delete_records('videotimetab_texttrack_track', array('videotime' => $record->id)); + $DB->delete_records('videotimetab_texttrack_track', ['videotime' => $record->id]); } try { @@ -154,12 +154,12 @@ public function update_tracks() { foreach ($request['body']['data'] as $texttrack) { if ($texttrack['active']) { - $trackid = $DB->insert_record('videotimetab_texttrack_track', array( + $trackid = $DB->insert_record('videotimetab_texttrack_track', [ 'videotime' => $record->id, 'lang' => $texttrack['language'], 'uri' => $texttrack['uri'], 'type' => $texttrack['type'], - $texttrack['link']) + $texttrack['link']], ); foreach ($this->parse_texttrack(file_get_contents($texttrack['link'])) as $text) { $text['track'] = $trackid; @@ -167,7 +167,7 @@ public function update_tracks() { } } } - $DB->set_field('videotimetab_texttrack', 'lastupdate', time(), array('videotime' => $record->id)); + $DB->set_field('videotimetab_texttrack', 'lastupdate', time(), ['videotime' => $record->id]); $transaction->allow_commit(); } catch (Exception $e) { $transaction->rollback($e); @@ -183,14 +183,14 @@ public static function save_settings(stdClass $data) { global $DB; if (empty($data->enable_texttrack)) { - $DB->delete_records('videotimetab_texttrack', array( + $DB->delete_records('videotimetab_texttrack', [ 'videotime' => $data->id, - )); - } else if (!$DB->get_record('videotimetab_texttrack', array('videotime' => $data->id))) { - $DB->insert_record('videotimetab_texttrack', array( + ]); + } else if (!$DB->get_record('videotimetab_texttrack', ['videotime' => $data->id])) { + $DB->insert_record('videotimetab_texttrack', [ 'videotime' => $data->id, 'lastupdate' => 0, - )); + ]); } } @@ -202,15 +202,15 @@ public static function save_settings(stdClass $data) { public static function delete_settings(int $id) { global $DB; - if ($trackids = $DB->get_fieldset_select('videotimetab_texttrack_track', 'id', 'videotime = ?', array($id))) { + if ($trackids = $DB->get_fieldset_select('videotimetab_texttrack_track', 'id', 'videotime = ?', [$id])) { list($sql, $params) = $DB->get_in_or_equal($trackids); $DB->delete_records_select('videotimetab_texttrack_text', "track $sql", $params); - $DB->delete_records('videotimetab_texttrack_track', array('videotime' => $record->id)); + $DB->delete_records('videotimetab_texttrack_track', ['videotime' => $record->id]); } - $DB->delete_records('videotimetab_texttrack', array( + $DB->delete_records('videotimetab_texttrack', [ 'videotime' => $id, - )); + ]); } /** @@ -225,7 +225,7 @@ public static function data_preprocessing(array &$defaultvalues, int $instance) if (empty($instance)) { $defaultvalues['enable_texttrack'] = get_config('videotimetab_texttrack', 'default'); } else { - $defaultvalues['enable_texttrack'] = $DB->record_exists('videotimetab_texttrack', array('videotime' => $instance)); + $defaultvalues['enable_texttrack'] = $DB->record_exists('videotimetab_texttrack', ['videotime' => $instance]); } } @@ -238,9 +238,9 @@ public function is_visible(): bool { global $DB; $record = $this->get_instance()->to_record(); - return videotime_has_repository() && $this->is_enabled() && $DB->record_exists('videotimetab_texttrack', array( - 'videotime' => $record->id - )); + return videotime_has_repository() && $this->is_enabled() && $DB->record_exists('videotimetab_texttrack', [ + 'videotime' => $record->id, + ]); } /** diff --git a/tab/texttrack/version.php b/tab/texttrack/version.php index c7ef6b42..225ebfba 100644 --- a/tab/texttrack/version.php +++ b/tab/texttrack/version.php @@ -30,5 +30,5 @@ $plugin->requires = 2015111610; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ - 'videotime' => 2023011200 + 'videotime' => 2023011200, ]; diff --git a/tab/watch/version.php b/tab/watch/version.php index 928fab93..b8b865e8 100644 --- a/tab/watch/version.php +++ b/tab/watch/version.php @@ -30,5 +30,5 @@ $plugin->requires = 2015111610; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ - 'videotime' => 2023011200 + 'videotime' => 2023011200, ]; diff --git a/tests/behat/behat_mod_videotime.php b/tests/behat/behat_mod_videotime.php index 71dd5803..9a0dcde9 100644 --- a/tests/behat/behat_mod_videotime.php +++ b/tests/behat/behat_mod_videotime.php @@ -90,7 +90,7 @@ protected function resolve_page_instance_url(string $type, string $identifier): */ protected function get_videotime_by_name(string $name): stdClass { global $DB; - return $DB->get_record('videotime', array('name' => $name), '*', MUST_EXIST); + return $DB->get_record('videotime', ['name' => $name], '*', MUST_EXIST); } /** diff --git a/tests/external_test.php b/tests/external_test.php index 86e36da2..8f500f11 100644 --- a/tests/external_test.php +++ b/tests/external_test.php @@ -57,7 +57,7 @@ public function setUp(): void { 'course' => $this->course->id, 'autoplay' => 1, 'vimeo_embed' => 'https://vimeo.com/347119375', - 'responsive' => 1 + 'responsive' => 1, ]); $this->student = $this->getDataGenerator()->create_user(); $this->getDataGenerator()->enrol_user($this->student->id, $this->course->id); diff --git a/tests/lib_test.php b/tests/lib_test.php index fd15f411..4204fdb7 100644 --- a/tests/lib_test.php +++ b/tests/lib_test.php @@ -52,7 +52,7 @@ public function setUp(): void { public function test_videotime_core_calendar_provide_event_action() { // Create the activity. $course = $this->getDataGenerator()->create_course(); - $videotime = $this->getDataGenerator()->create_module('videotime', array('course' => $course->id)); + $videotime = $this->getDataGenerator()->create_module('videotime', ['course' => $course->id]); // Create a calendar event. $event = $this->create_action_event($course->id, $videotime->id, @@ -75,7 +75,7 @@ public function test_videotime_core_calendar_provide_event_action() { public function test_videotime_core_calendar_provide_event_action_in_hidden_section() { // Create the activity. $course = $this->getDataGenerator()->create_course(); - $videotime = $this->getDataGenerator()->create_module('videotime', array('course' => $course->id)); + $videotime = $this->getDataGenerator()->create_module('videotime', ['course' => $course->id]); // Enrol a student in the course. $student = $this->getDataGenerator()->create_and_enrol($course, 'student'); @@ -103,7 +103,7 @@ public function test_videotime_core_calendar_provide_event_action_in_hidden_sect public function test_videotime_core_calendar_provide_event_action_for_user() { // Create the activity. $course = $this->getDataGenerator()->create_course(); - $videotime = $this->getDataGenerator()->create_module('videotime', array('course' => $course->id)); + $videotime = $this->getDataGenerator()->create_module('videotime', ['course' => $course->id]); // Enrol a student in the course. $student = $this->getDataGenerator()->create_and_enrol($course, 'student'); @@ -134,7 +134,7 @@ public function test_videotime_core_calendar_provide_event_action_as_non_user() // Create the activity. $course = $this->getDataGenerator()->create_course(); - $videotime = $this->getDataGenerator()->create_module('videotime', array('course' => $course->id)); + $videotime = $this->getDataGenerator()->create_module('videotime', ['course' => $course->id]); // Create a calendar event. $event = $this->create_action_event($course->id, $videotime->id, @@ -160,9 +160,9 @@ public function test_videotime_core_calendar_provide_event_action_already_comple $CFG->enablecompletion = 1; // Create the activity. - $course = $this->getDataGenerator()->create_course(array('enablecompletion' => 1)); - $videotime = $this->getDataGenerator()->create_module('videotime', array('course' => $course->id), - array('completion' => 2, 'completionview' => 1, 'completionexpected' => time() + DAYSECS)); + $course = $this->getDataGenerator()->create_course(['enablecompletion' => 1]); + $videotime = $this->getDataGenerator()->create_module('videotime', ['course' => $course->id], + ['completion' => 2, 'completionview' => 1, 'completionexpected' => time() + DAYSECS]); // Get some additional data. $cm = get_coursemodule_from_instance('videotime', $videotime->id); @@ -191,9 +191,9 @@ public function test_videotime_core_calendar_provide_event_action_already_comple $CFG->enablecompletion = 1; // Create the activity. - $course = $this->getDataGenerator()->create_course(array('enablecompletion' => 1)); - $videotime = $this->getDataGenerator()->create_module('videotime', array('course' => $course->id), - array('completion' => 2, 'completionview' => 1, 'completionexpected' => time() + DAYSECS)); + $course = $this->getDataGenerator()->create_course(['enablecompletion' => 1]); + $videotime = $this->getDataGenerator()->create_module('videotime', ['course' => $course->id], + ['completion' => 2, 'completionview' => 1, 'completionexpected' => time() + DAYSECS]); // Enrol a student in the course. $student = $this->getDataGenerator()->create_and_enrol($course, 'student');