diff --git a/classes/admin/manage_mediatimesrc_plugins_page.php b/classes/admin/manage_mediatimesrc_plugins_page.php index 7b042c5..77247a8 100644 --- a/classes/admin/manage_mediatimesrc_plugins_page.php +++ b/classes/admin/manage_mediatimesrc_plugins_page.php @@ -31,14 +31,17 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class manage_mediatimesrc_plugins_page extends \admin_setting { - /** * Class manage_mediatimesrc_plugins_page constructor. */ public function __construct() { $this->nosave = true; - parent::__construct('managemediatimesrc', - new \lang_string('managemediatimesrcplugins', 'tool_mediatime'), '', ''); + parent::__construct( + 'managemediatimesrc', + new \lang_string('managemediatimesrcplugins', 'tool_mediatime'), + '', + '' + ); } /** @@ -82,8 +85,10 @@ public function is_related($query): bool { } $types = \core_plugin_manager::instance()->get_plugins_of_type('mediatimesrc'); foreach ($types as $type) { - if (strpos($type->component, $query) !== false || - strpos(\core_text::strtolower($type->displayname), $query) !== false) { + if ( + strpos($type->component, $query) !== false || + strpos(\core_text::strtolower($type->displayname), $query) !== false + ) { return true; } } @@ -131,20 +136,26 @@ public function output_html($data, $query = ''): string { ]); $class = ''; - if ($pluginmanager->get_plugin_info('mediatimesrc_'.$type->name)->get_status() === - \core_plugin_manager::PLUGIN_STATUS_MISSING) { - $strtypename = $type->displayname.' ('.get_string('missingfromdisk').')'; + if ( + $pluginmanager->get_plugin_info('mediatimesrc_' . $type->name)->get_status() === + \core_plugin_manager::PLUGIN_STATUS_MISSING + ) { + $strtypename = $type->displayname . ' (' . get_string('missingfromdisk') . ')'; } else { $strtypename = $type->displayname; } if ($type->is_enabled()) { - $hideshow = \html_writer::link($url->out(false, ['action' => 'disable']), - $OUTPUT->pix_icon('t/hide', $txt->disable, 'moodle', ['class' => 'iconsmall'])); + $hideshow = \html_writer::link( + $url->out(false, ['action' => 'disable']), + $OUTPUT->pix_icon('t/hide', $txt->disable, 'moodle', ['class' => 'iconsmall']) + ); } else { $class = 'dimmed_text'; - $hideshow = \html_writer::link($url->out(false, ['action' => 'enable']), - $OUTPUT->pix_icon('t/show', $txt->enable, 'moodle', ['class' => 'iconsmall'])); + $hideshow = \html_writer::link( + $url->out(false, ['action' => 'enable']), + $OUTPUT->pix_icon('t/show', $txt->enable, 'moodle', ['class' => 'iconsmall']) + ); } $settings = ''; @@ -153,8 +164,12 @@ public function output_html($data, $query = ''): string { } $uninstall = ''; - if ($uninstallurl = \core_plugin_manager::instance()->get_uninstall_url( - 'mediatimesrc_'.$type->name, 'manage')) { + if ( + $uninstallurl = \core_plugin_manager::instance()->get_uninstall_url( + 'mediatimesrc_' . $type->name, + 'manage' + ) + ) { $uninstall = \html_writer::link($uninstallurl, $txt->uninstall); } @@ -167,7 +182,7 @@ public function output_html($data, $query = ''): string { } // Sort table data. - usort($table->data, function($a, $b) { + usort($table->data, function ($a, $b) { $aid = $a->cells[0]->text; $bid = $b->cells[0]->text; diff --git a/classes/event/resource_created.php b/classes/event/resource_created.php index 0c90a6e..006302d 100644 --- a/classes/event/resource_created.php +++ b/classes/event/resource_created.php @@ -27,7 +27,6 @@ * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class resource_created extends base { - // For more information about the Events API please visit {@link https://docs.moodle.org/dev/Events_API}. /** diff --git a/classes/event/resource_deleted.php b/classes/event/resource_deleted.php index e9d67a4..abf7b4b 100644 --- a/classes/event/resource_deleted.php +++ b/classes/event/resource_deleted.php @@ -27,7 +27,6 @@ * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class resource_deleted extends base { - // For more information about the Events API please visit {@link https://docs.moodle.org/dev/Events_API}. /** diff --git a/classes/event/resource_updated.php b/classes/event/resource_updated.php index 19bcb56..1b10219 100644 --- a/classes/event/resource_updated.php +++ b/classes/event/resource_updated.php @@ -27,7 +27,6 @@ * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class resource_updated extends base { - // For more information about the Events API please visit {@link https://docs.moodle.org/dev/Events_API}. /** diff --git a/classes/form/delete_resource.php b/classes/form/delete_resource.php index 2075edc..b7a8367 100644 --- a/classes/form/delete_resource.php +++ b/classes/form/delete_resource.php @@ -34,7 +34,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class delete_resource extends moodleform { - /** * Definition */ diff --git a/classes/form/edit_resource.php b/classes/form/edit_resource.php index 2d0645c..3d49434 100644 --- a/classes/form/edit_resource.php +++ b/classes/form/edit_resource.php @@ -34,7 +34,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class edit_resource extends moodleform { - /** * Definition */ diff --git a/classes/form/search.php b/classes/form/search.php index 97c5a99..c5f3ba8 100644 --- a/classes/form/search.php +++ b/classes/form/search.php @@ -34,7 +34,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class search extends moodleform { - /** * Definition */ diff --git a/classes/media_manager.php b/classes/media_manager.php index 97a3dbd..accc0f3 100644 --- a/classes/media_manager.php +++ b/classes/media_manager.php @@ -185,7 +185,7 @@ public static function search($filters = []) { if (!$sources = plugininfo\mediatimesrc::get_enabled_plugins()) { return $result; } - list($sql, $params) = $DB->get_in_or_equal($sources, SQL_PARAMS_NAMED); + [$sql, $params] = $DB->get_in_or_equal($sources, SQL_PARAMS_NAMED); $sql = "source $sql"; $order = 'timecreated DESC'; @@ -205,7 +205,7 @@ public static function search($filters = []) { $tags = core_tag_tag::get_by_name_bulk($tagcollid, $tags); $tags = array_column($tags, 'id'); if (!empty($tags)) { - list($tagsql, $tagparams) = $DB->get_in_or_equal($tags, SQL_PARAMS_NAMED, 'tagparams'); + [$tagsql, $tagparams] = $DB->get_in_or_equal($tags, SQL_PARAMS_NAMED, 'tagparams'); $sql .= " AND id IN (SELECT itemid FROM {tag_instance} WHERE tagid $tagsql)"; $params += $tagparams; } diff --git a/classes/plugininfo/mediatimesrc.php b/classes/plugininfo/mediatimesrc.php index 35d99bf..d3120f5 100644 --- a/classes/plugininfo/mediatimesrc.php +++ b/classes/plugininfo/mediatimesrc.php @@ -35,7 +35,6 @@ * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class mediatimesrc extends base { - /** * Allow uninstall * @@ -67,8 +66,12 @@ public function load_settings(\part_of_admin_tree $adminroot, $parentnodename, $ return; } $section = $this->get_settings_section_name(); - $settings = new \admin_settingpage($section, $this->displayname, - 'moodle/site:config', $this->is_enabled() === false); + $settings = new \admin_settingpage( + $section, + $this->displayname, + 'moodle/site:config', + $this->is_enabled() === false + ); include($this->full_path('settings.php')); // This may also set $settings to null. diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 6c67930..e4ab28f 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -41,21 +41,16 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements - // The Plenary meeting module stores user provided data. - \core_privacy\local\metadata\provider, - - // This plugin is a core_user_data_provider. - \core_privacy\local\request\plugin\provider, - - \core_privacy\local\request\core_userlist_provider { - + \core_privacy\local\request\core_userlist_provider, + \core_privacy\local\metadata\provider, + \core_privacy\local\request\plugin\provider { /** * Returns meta data about this system. * * @param collection $collection * @return collection */ - public static function get_metadata(collection $collection) : collection { + public static function get_metadata(collection $collection): collection { return $collection->add_database_table( 'tool_mediatime', @@ -76,7 +71,7 @@ public static function get_metadata(collection $collection) : collection { * @param int $userid The user to search. * @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin. */ - public static function get_contexts_for_userid(int $userid) : contextlist { + public static function get_contexts_for_userid(int $userid): contextlist { $sql = "SELECT c.id FROM {tool_mediatime} m JOIN {context} c ON c.contextlevel = :contextlevel @@ -121,7 +116,7 @@ public static function export_user_data(approved_contextlist $contextlist) { global $DB; // Remove contexts different from CONTEXT_SYSTEM. - $contexts = array_reduce($contextlist->get_contexts(), function($carry, $context) { + $contexts = array_reduce($contextlist->get_contexts(), function ($carry, $context) { if ($context->contextlevel == CONTEXT_SYSTEM) { $carry[] = $context->id; } @@ -135,7 +130,7 @@ public static function export_user_data(approved_contextlist $contextlist) { $user = $contextlist->get_user(); $userid = $user->id; // Get motion data. - list($insql, $inparams) = $DB->get_in_or_equal($contexts, SQL_PARAMS_NAMED); + [$insql, $inparams] = $DB->get_in_or_equal($contexts, SQL_PARAMS_NAMED); $sql = "SELECT m.id, m.name, m.content, @@ -194,7 +189,6 @@ public static function delete_data_for_users(approved_userlist $userlist) { if (!$context instanceof \context_system) { return; } - } /** @@ -206,6 +200,5 @@ public static function delete_data_for_user(approved_contextlist $contextlist) { global $DB; return; - } } diff --git a/lang/en/tool_mediatime.php b/lang/en/tool_mediatime.php index daff3fc..93514c5 100644 --- a/lang/en/tool_mediatime.php +++ b/lang/en/tool_mediatime.php @@ -25,17 +25,18 @@ defined('MOODLE_INTERNAL') || die(); -$string['pluginname'] = 'Media Time'; $string['addnewcontent'] = 'Add new content'; $string['event_resource_created'] = 'Resource created'; $string['event_resource_deleted'] = 'Resource deleted'; $string['event_resource_updated'] = 'Resource updated'; $string['filelinks'] = 'File links'; -$string['library'] = 'Library'; $string['keyword'] = 'Keyword'; +$string['library'] = 'Library'; +$string['managemediatimesrcplugins'] = 'Manage source plugins'; $string['mediatime:create'] = 'Create media in library'; $string['mediatime:manage'] = 'Manage media in library'; $string['mediatime:view'] = 'View media in library'; +$string['pluginname'] = 'Media Time'; $string['privacy:metadata:tool_mediatime'] = 'The Media Time plugin stores and transmits data that is not normally private, but does record the last user to modify it.'; $string['privacy:metadata:tool_mediatime:content'] = 'Media content'; $string['privacy:metadata:tool_mediatime:name'] = 'Media name'; @@ -44,10 +45,8 @@ $string['privacy:metadata:tool_mediatime:usermodified'] = 'User modified'; $string['resourcename'] = 'Resource name'; $string['resourcename_help'] = 'The name for a resource is used internally in the library to identify the resource, but not displayed when it is used.'; -$string['managemediatimesrcplugins'] = 'Manage source plugins'; $string['subplugin_mediatimesrc_plural'] = 'Media sources'; +$string['subplugintype_mediatimesrc_plural'] = 'Media Time sources'; $string['tagarea_tool_mediatime'] = 'Media resources'; $string['title'] = 'Title'; $string['title_help'] = 'The title may be displayed by the video player when used'; -$string['subplugintype_mediatimesrc_plural'] = 'Media Time sources'; -$string['filelinks'] = 'File links'; diff --git a/lib.php b/lib.php index fc1af86..c179ce0 100644 --- a/lib.php +++ b/lib.php @@ -38,16 +38,18 @@ * @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 tool_mediatime_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=[]) { +function tool_mediatime_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = []) { if ($context->contextlevel != CONTEXT_SYSTEM) { return false; } require_login(); - if (in_array($filearea, [ + if ( + in_array($filearea, [ 'm3u8', - ])) { + ]) + ) { $itemid = array_shift($args); $relativepath = implode('/', $args); diff --git a/settings.php b/settings.php index c676857..dac5e37 100644 --- a/settings.php +++ b/settings.php @@ -28,13 +28,11 @@ if ($hassiteconfig) { $settings = new admin_settingpage('tool_mediatime_settings', new lang_string('pluginname', 'tool_mediatime')); - // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf - if ($ADMIN->fulltree) { - // TODO: Define actual plugin settings page and add it to the tree - {@link https://docs.moodle.org/dev/Admin_settings}. - } - - $ADMIN->add('tools', new admin_category('toolmediatime', - new lang_string('pluginname', 'tool_mediatime'), false)); + $ADMIN->add('tools', new admin_category( + 'toolmediatime', + new lang_string('pluginname', 'tool_mediatime'), + false + )); $pluginmanager = core_plugin_manager::instance(); $ADMIN->add('toolmediatime', new admin_category( diff --git a/source/streamio/templates/file_upload.mustache b/source/streamio/templates/file_upload.mustache index 41bac31..d4da91b 100644 --- a/source/streamio/templates/file_upload.mustache +++ b/source/streamio/templates/file_upload.mustache @@ -36,13 +36,13 @@
- +
- +
diff --git a/source/vimeo/classes/external/create_token.php b/source/vimeo/classes/external/create_token.php index 1cce5d4..2043e4c 100644 --- a/source/vimeo/classes/external/create_token.php +++ b/source/vimeo/classes/external/create_token.php @@ -56,9 +56,8 @@ public static function execute_parameters(): external_function_parameters { /** * Create place holder * - * @param int $filesize Video file size * @param string $description Name of resource - * @param string $filesize Video file size + * @param int $filesize Video file size * @param string $name Name of resource * @param string $tags Name of resource * @param string $title Name of resource diff --git a/source/vimeo/templates/file_upload.mustache b/source/vimeo/templates/file_upload.mustache index 51487ec..0752409 100644 --- a/source/vimeo/templates/file_upload.mustache +++ b/source/vimeo/templates/file_upload.mustache @@ -25,6 +25,9 @@ Example context (json): { + name: "Donald", + title: "DucK", + description: "Quack, quack, quack" } }} @@ -51,6 +54,6 @@ {{# js }} require(['mediatimesrc_vimeo/file_upload'], function(FileUpload) { - FileUpload.init('{{ filesize }}'); + FileUpload.init(); }); {{/ js }} diff --git a/source/vimeo/templates/video.mustache b/source/vimeo/templates/video.mustache index cd6d091..c5c88ca 100644 --- a/source/vimeo/templates/video.mustache +++ b/source/vimeo/templates/video.mustache @@ -25,10 +25,13 @@ Example context (json): { - "id": "324lk32sK", - "screenshot": { - "normal": "example.com/image.jpg" - } + "uniqueid": "324lk32sK", + "interval": 0, + "instance": '{ + "vimeo_url": "https://vimeo.com/1309243098", + "speed": 1, + "responsive": 1 + }' } }} diff --git a/subplugins.php b/subplugins.php index 818bdd0..2a42598 100644 --- a/subplugins.php +++ b/subplugins.php @@ -23,7 +23,7 @@ */ require_once('../../../config.php'); -require_once($CFG->libdir.'/adminlib.php'); +require_once($CFG->libdir . '/adminlib.php'); $action = required_param('action', PARAM_ALPHANUMEXT); $name = required_param('name', PARAM_PLUGIN);