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 '