ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç PKD\H styles.cssnu[.block_tag_youtube .youtube-thumb { padding: 3px; padding-bottom: 0.5em; display: block; float: left; } .block_tag_youtube .yt-video-entry li { clear: left; }PKD\X(Xdb/install.phpnu[. /** * Tag Youtube block installation. * * @package block_tag_youtube * @copyright 2015 Jun Pataleta * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Sets the install values for the tag_youtube entry in the block table. * * @return void */ function xmldb_block_tag_youtube_install() { global $DB; // Disable this block by default. $DB->set_field('block', 'visible', 0, array('name' => 'tag_youtube')); } PKD\  db/access.phpnu[. /** * Tag youtube block caps. * * @package block_tag_youtube * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $capabilities = array( 'block/tag_youtube:addinstance' => array( 'riskbitmask' => RISK_SPAM | RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_BLOCK, 'archetypes' => array( 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW ), 'clonepermissionsfrom' => 'moodle/site:manageblocks' ), ); PKD\ [aadb/upgrade.phpnu[. /** * This file keeps track of upgrades to the tag_youtube block * * @package block_tag_youtube * @copyright 2020 Mihail Geshoski * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Upgrade code for the Tag Youtube block. * * @param int $oldversion */ function xmldb_block_tag_youtube_upgrade($oldversion) { // Automatically generated Moodle v4.2.0 release upgrade line. // Put any upgrade step following this. // Automatically generated Moodle v4.3.0 release upgrade line. // Put any upgrade step following this. // Automatically generated Moodle v4.4.0 release upgrade line. // Put any upgrade step following this. // Automatically generated Moodle v4.5.0 release upgrade line. // Put any upgrade step following this. // Automatically generated Moodle v5.0.0 release upgrade line. // Put any upgrade step following this. return true; } PKD\VdU lang/en/block_tag_youtube.phpnu[. /** * Strings for component 'block_tag_youtube', language 'en', branch 'MOODLE_20_STABLE' * * @package block_tag_youtube * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['anycategory'] = 'Any category'; $string['apierror'] = 'The YouTube API key is not set. Contact your administrator.'; $string['apikey'] = 'API key'; $string['apikeyinfo'] = 'Get a Google API key for your Moodle site.'; $string['autosvehicles'] = 'Autos & Vehicles'; $string['category'] = 'Category'; $string['comedy'] = 'Comedy'; $string['configtitle'] = 'YouTube block title'; $string['education'] = 'Education'; $string['entertainment'] = 'Entertainment'; $string['categoryerror'] = 'Failed to obtain the list of categories.
{$a}'; $string['filmsanimation'] = 'Films & Animation'; $string['gadgetsgames'] = 'Gadgets & Games'; $string['howtodiy'] = 'How-to & DIY'; $string['includeonlyvideosfromplaylist'] = 'Include only videos from the playlist with id'; $string['music'] = 'Music'; $string['newspolitics'] = 'News & Politics'; $string['nonprofitactivism'] = 'Nonprofits & Activism'; $string['numberofvideos'] = 'Number of videos'; $string['peopleblogs'] = 'People & Blogs'; $string['petsanimals'] = 'Pets & Animals'; $string['pluginname'] = 'YouTube'; $string['requesterror'] = 'Data could not be obtained from the server. Contact your administrator if the problem persists.'; $string['scienceandtech'] = 'Science & Tech'; $string['sports'] = 'Sports'; $string['tag_youtube:addinstance'] = 'Add a new YouTube block'; $string['travel'] = 'Travel & Places'; $string['privacy:metadata'] = 'The YouTube block only shows data stored in other locations.'; PKD\邤 edit_form.phpnu[. /** * Form for editing tag_youtube block instances. * * @package block_tag_youtube * @copyright 2009 Tim Hunt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Form for editing tag_youtube block instances. * * @copyright 2009 Tim Hunt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class block_tag_youtube_edit_form extends block_edit_form { protected function specific_definition($mform) { global $OUTPUT; $mform->addElement('header', 'configheader', get_string('blocksettings', 'block')); $mform->addElement('text', 'config_title', get_string('configtitle', 'block_tag_youtube')); $mform->setType('config_title', PARAM_TEXT); $mform->addElement('text', 'config_numberofvideos', get_string('numberofvideos', 'block_tag_youtube'), array('size' => 5)); $mform->setType('config_numberofvideos', PARAM_INT); // Category setting. $categorychoices = ['0' => get_string('anycategory', 'block_tag_youtube')]; $hascategoryerror = false; $categoryerror = ''; try { // Get all video categories through an API call and add them to the category list. $categorychoices += $this->block->get_categories(); } catch (Exception $e) { $hascategoryerror = true; $categoryerror = $e->getMessage(); } $mform->addElement('select', 'config_category', get_string('category', 'block_tag_youtube'), $categorychoices); $mform->setDefault('config_category', 0); if ($hascategoryerror) { $notification = $OUTPUT->notification(get_string('categoryerror', 'block_tag_youtube', $categoryerror), 'error'); $mform->addElement('static', 'config_category_error', '', $notification); } $mform->addElement('text', 'config_playlist', get_string('includeonlyvideosfromplaylist', 'block_tag_youtube')); $mform->setType('config_playlist', PARAM_ALPHANUM); } } PKD\~ version.phpnu[. /** * Version details * * @package block_tag_youtube * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2025041400; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2025040800; // Requires this Moodle version. $plugin->component = 'block_tag_youtube'; // Full name of the plugin (used for diagnostics) PKD\Qpp\9\9block_tag_youtube.phpnu[. /** * Tag youtube block * * @package block_tag_youtube * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('DEFAULT_NUMBER_OF_VIDEOS', 5); class block_tag_youtube extends block_base { /** * @var Google_Service_Youtube */ protected $service = null; function init() { $this->title = get_string('pluginname','block_tag_youtube'); $this->config = new stdClass(); } function applicable_formats() { return array('tag' => true); } /** * It can be configured. * * @return bool */ public function has_config() { return true; } function specialization() { $this->title = !empty($this->config->title) ? $this->config->title : get_string('pluginname', 'block_tag_youtube'); } function instance_allow_multiple() { return true; } function get_content() { global $CFG; //note: do NOT include files at the top of this file require_once($CFG->libdir . '/filelib.php'); if ($this->content !== NULL) { return $this->content; } $this->content = new stdClass(); $this->content->footer = ''; if (!$this->get_service()) { $this->content->text = $this->get_error_message(); return $this->content; } $text = ''; if(!empty($this->config->playlist)){ //videos from a playlist $text = $this->get_videos_by_playlist(); } else{ if(!empty($this->config->category)){ //videos from category with tag $text = $this->get_videos_by_tag_and_category(); } else { //videos with tag $text = $this->get_videos_by_tag(); } } $this->content->text = $text; return $this->content; } function get_videos_by_playlist(){ if (!$service = $this->get_service()) { return $this->get_error_message(); } $numberofvideos = DEFAULT_NUMBER_OF_VIDEOS; if( !empty($this->config->numberofvideos)) { $numberofvideos = $this->config->numberofvideos; } try { $response = $service->playlistItems->listPlaylistItems('id,snippet', array( 'playlistId' => $this->config->playlist, 'maxResults' => $numberofvideos )); } catch (Google_Service_Exception $e) { debugging('Google service exception: ' . $e->getMessage(), DEBUG_DEVELOPER); return $this->get_error_message(get_string('requesterror', 'block_tag_youtube')); } return $this->render_items($response); } function get_videos_by_tag(){ if (!$service = $this->get_service()) { return $this->get_error_message(); } $tagid = optional_param('id', 0, PARAM_INT); // tag id - for backware compatibility $tag = optional_param('tag', '', PARAM_TAG); // tag $tc = optional_param('tc', 0, PARAM_INT); // Tag collection id. if ($tagid) { $tagobject = core_tag_tag::get($tagid); } else if ($tag) { $tagobject = core_tag_tag::get_by_name($tc, $tag); } if (empty($tagobject)) { return ''; } $querytag = urlencode($tagobject->name); $numberofvideos = DEFAULT_NUMBER_OF_VIDEOS; if ( !empty($this->config->numberofvideos) ) { $numberofvideos = $this->config->numberofvideos; } try { $response = $service->search->listSearch('id,snippet', array( 'q' => $querytag, 'type' => 'video', 'maxResults' => $numberofvideos )); } catch (Google_Service_Exception $e) { debugging('Google service exception: ' . $e->getMessage(), DEBUG_DEVELOPER); return $this->get_error_message(get_string('requesterror', 'block_tag_youtube')); } return $this->render_items($response); } function get_videos_by_tag_and_category(){ if (!$service = $this->get_service()) { return $this->get_error_message(); } $tagid = optional_param('id', 0, PARAM_INT); // tag id - for backware compatibility $tag = optional_param('tag', '', PARAM_TAG); // tag $tc = optional_param('tc', 0, PARAM_INT); // Tag collection id. if ($tagid) { $tagobject = core_tag_tag::get($tagid); } else if ($tag) { $tagobject = core_tag_tag::get_by_name($tc, $tag); } if (empty($tagobject)) { return ''; } $querytag = urlencode($tagobject->name); $numberofvideos = DEFAULT_NUMBER_OF_VIDEOS; if( !empty($this->config->numberofvideos)) { $numberofvideos = $this->config->numberofvideos; } try { $response = $service->search->listSearch('id,snippet', array( 'q' => $querytag, 'type' => 'video', 'maxResults' => $numberofvideos, 'videoCategoryId' => $this->config->category )); } catch (Google_Service_Exception $e) { debugging('Google service exception: ' . $e->getMessage(), DEBUG_DEVELOPER); return $this->get_error_message(get_string('requesterror', 'block_tag_youtube')); } return $this->render_items($response); } /** * Returns an error message. * * Useful when the block is not properly set or something goes wrong. * * @param string $message The message to display. * @return string HTML */ protected function get_error_message($message = null) { global $OUTPUT; if (empty($message)) { $message = get_string('apierror', 'block_tag_youtube'); } return $OUTPUT->notification($message); } /** * Gets the youtube service object. * * @return Google_Service_YouTube */ protected function get_service() { global $CFG; if (!$apikey = get_config('block_tag_youtube', 'apikey')) { return false; } // Wrapped in an if in case we call different get_videos_* multiple times. if (!isset($this->service)) { require_once($CFG->libdir . '/google/lib.php'); $client = get_google_client(); $client->setDeveloperKey($apikey); $client->setScopes(array(Google_Service_YouTube::YOUTUBE_READONLY)); $this->service = new Google_Service_YouTube($client); } return $this->service; } /** * Renders the list of items. * * @param stdClass $videosdata * @return string HTML */ protected function render_items($videosdata) { if (!$videosdata || empty($videosdata->items)) { if (!empty($videosdata->error)) { debugging('Error fetching data from youtube: ' . $videosdata->error->message, DEBUG_DEVELOPER); } return ''; } // If we reach that point we already know that the API key is set. $service = $this->get_service(); $text = html_writer::start_tag('ul', array('class' => 'yt-video-entry unlist img-text')); foreach ($videosdata->items as $video) { // Link to the video included in the playlist if listing a playlist. if (!empty($video->snippet->resourceId)) { $id = $video->snippet->resourceId->videoId; $playlist = '&list=' . $video->snippet->playlistId; } else { $id = $video->id->videoId; $playlist = ''; } $thumbnail = $video->snippet->getThumbnails()->getDefault(); $url = 'http://www.youtube.com/watch?v=' . $id . $playlist; $videodetails = $service->videos->listVideos('id,contentDetails', array('id' => $id)); if ($videodetails && !empty($videodetails->items)) { // We fetch by id so we just use the first one. $details = $videodetails->items[0]; $start = new DateTime('@0'); $start->add(new DateInterval($details->contentDetails->duration)); $seconds = $start->format('U'); } $text .= html_writer::start_tag('li'); $imgattrs = array('class' => 'youtube-thumb', 'src' => $thumbnail->url, 'alt' => $video->snippet->title); $thumbhtml = html_writer::empty_tag('img', $imgattrs); $link = html_writer::tag('a', $thumbhtml, array('href' => $url)); $text .= html_writer::tag('div', $link, array('class' => 'clearfix')); $text .= html_writer::tag('span', html_writer::tag('a', $video->snippet->title, array('href' => $url))); if (!empty($seconds)) { $text .= html_writer::tag('div', format_time($seconds)); } $text .= html_writer::end_tag('li'); } $text .= html_writer::end_tag('ul'); return $text; } /** * Method that returns an array containing all relevant video categories obtained through an API call, where the * array index represents the category ID and the array value represents the category name. * * @return array The array containing the relevant video categories * @throws moodle_exception If the API key is not set * @throws Google_Service_Exception If an error occurs while obtaining the categories through the API call */ public function get_categories() { // Get the default categories and it's translations. $categorytranslations = $this->category_map_translation(); if ($service = $this->get_service()) { // Call the API to fetch the youtube video categories. // This API call requires the regionCode parameter which instructs the API to return the list of video // categories available in the specified country. Currently 'us' is hardcoded as the returned categories // for this region correspond to the previously used (legacy) hardcoded list of categories. // TODO: We should improve this in the future and avoid hardcoding this value. $response = $service->videoCategories->listVideoCategories('snippet', ['regionCode' => 'us']); $categoryitems = $response['modelData']['items']; // Return an array with the relevant categories. return array_reduce($categoryitems, function($categories, $category) use ($categorytranslations) { $categoryid = $category['id']; $categoryname = $category['snippet']['title']; // Videos can be associated with this category. if ($category['snippet']['assignable']) { // If the category name can be mapped with a translation, add it to the categories array. if (array_key_exists($categoryname, $categorytranslations)) { $categories[$categoryid] = $categorytranslations[$categoryname]; } else { // Otherwise, display the untranslated category name and show a debugging message. $categories[$categoryid] = $categoryname; debugging("The category '{$categoryname}' does not have a translatable language string."); } } return $categories; }, []); } else { throw new \moodle_exception('apierror', 'block_tag_youtube'); } } /** * Method that provides mapping between the video category names and their translations. * * @return array The array that maps the video category names with their translations */ private function category_map_translation() { return [ 'Film & Animation' => get_string('filmsanimation', 'block_tag_youtube'), 'Autos & Vehicles' => get_string('autosvehicles', 'block_tag_youtube'), 'Music' => get_string('music', 'block_tag_youtube'), 'Pets & Animals' => get_string('petsanimals', 'block_tag_youtube'), 'Sports' => get_string('sports', 'block_tag_youtube'), 'Travel & Events' => get_string('travel', 'block_tag_youtube'), 'Gaming' => get_string('gadgetsgames', 'block_tag_youtube'), 'People & Blogs' => get_string('peopleblogs', 'block_tag_youtube'), 'Comedy' => get_string('comedy', 'block_tag_youtube'), 'Entertainment' => get_string('entertainment', 'block_tag_youtube'), 'News & Politics' => get_string('newspolitics', 'block_tag_youtube'), 'Howto & Style' => get_string('howtodiy', 'block_tag_youtube'), 'Education' => get_string('education', 'block_tag_youtube'), 'Science & Technology' => get_string('scienceandtech', 'block_tag_youtube'), 'Nonprofits & Activism' => get_string('nonprofitactivism', 'block_tag_youtube'), ]; } /** * Return the plugin config settings for external functions. * * @return stdClass the configs for both the block instance and plugin * @since Moodle 3.8 */ public function get_config_for_external() { // There is a private key, only admins can see it. $pluginconfigs = get_config('block_tag_youtube'); if (!has_capability('moodle/site:config', context_system::instance())) { unset($pluginconfigs->apikey); } $instanceconfigs = !empty($this->config) ? $this->config : new stdClass(); return (object) [ 'instance' => $instanceconfigs, 'plugin' => $pluginconfigs, ]; } } PKD\classes/privacy/provider.phpnu[. /** * Privacy Subsystem implementation for block_tag_youtube. * * @package block_tag_youtube * @copyright 2018 Zig Tan * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace block_tag_youtube\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for block_tag_youtube implementing null_provider. * * @copyright 2018 Zig Tan * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements \core_privacy\local\metadata\null_provider { /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. * * @return string */ public static function get_reason(): string { return 'privacy:metadata'; } } PKD\, upgrade.txtnu[=== 4.5 Onwards === This file has been replaced by UPGRADING.md. See MDL-81125 for further information. === This files describes API changes in the block tag_youtube code. === 3.10.1 === * The config category now stores the category ID, instead of a string representation of the category name. In YouTube Data API v3, the API call to fetch the videos related to a certain category expects the category ID to be passed to the videoCategoryId parameter, instead of the category name. === 3.0 === * Due to the final YouTube API v2.0 deprecation we needed to adapt the current code to YouTube Data API v3. block_tag_youtube::fetch_request and block_tag_youtube::render_video_list have been deprecated as they can not be used any more. PKD\. tests/block_tag_youtube_test.phpnu[. namespace block_tag_youtube; /** * Block Tag Youtube test class. * * @package block_tag_youtube * @category test * @copyright 2015 Jun Pataleta * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ final class block_tag_youtube_test extends \advanced_testcase { /** * Testing the tag youtube block's initial state after a new installation. * * @return void */ public function test_after_install(): void { global $DB; $this->resetAfterTest(true); // Assert that tag_youtube entry exists and that its visible attribute is set to 0 (disabled). $this->assertTrue($DB->record_exists('block', array('name' => 'tag_youtube', 'visible' => 0))); } } PKD\  /tests/behat/configure_tag_youtube_block.featurenu[@block @block_tag_youtube Feature: Adding and configuring YouTube block In order to have the YouTube block used As a admin I need to add the YouTube block to the tags site page Background: Given I log in as "admin" And I navigate to "Plugins > Blocks > Manage blocks" in site administration And I toggle the "Enable YouTube" admin switch "on" @javascript Scenario: Category options are not available (except default) in the block settings if the YouTube API key is not set. Given the following config values are set as admin: | apikey | | block_tag_youtube | And I follow "Dashboard" And I turn editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost | # TODO MDL-57120 site "Tags" link not accessible without navigation block. And I add the "Navigation" block if not present And I click on "Site pages" "list_item" in the "Navigation" "block" And I click on "Tags" "link" in the "Navigation" "block" And I add the "YouTube" block When I configure the "YouTube" block Then I should see "Category" And I should see "Failed to obtain the list of categories." And I should see "The YouTube API key is not set. Contact your administrator." And the "Category" select box should contain "Any category" And the "Category" select box should not contain "Films & Animation" And the "Category" select box should not contain "Entertainment" And the "Category" select box should not contain "Education" @javascript Scenario: Category options are not available (except default) in the block settings when invalid YouTube API key is set. Given the following config values are set as admin: | apikey | invalidapikeyvalue | block_tag_youtube | And I follow "Dashboard" And I turn editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost | And I add the "Navigation" block if not present And I click on "Site pages" "list_item" in the "Navigation" "block" And I click on "Tags" "link" in the "Navigation" "block" And I add the "YouTube" block When I configure the "YouTube" block Then I should see "Category" And I should see "Failed to obtain the list of categories." And the "Category" select box should contain "Any category" And the "Category" select box should not contain "Comedy" And the "Category" select box should not contain "Autos & Vehicles" And the "Category" select box should not contain "News & Politics" PKD\\. settings.phpnu[. /** * Settings for the RSS client block. * * @package block_tag_youtube * @copyright 2015 David Monllao * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { $settings->add(new admin_setting_configtext('block_tag_youtube/apikey', get_string('apikey', 'block_tag_youtube'), get_string('apikeyinfo', 'block_tag_youtube'), '', PARAM_RAW_TRIMMED, 40)); } PKD\H styles.cssnu[PKD\X(Xdb/install.phpnu[PKD\  db/access.phpnu[PKD\ [aa db/upgrade.phpnu[PKD\VdU lang/en/block_tag_youtube.phpnu[PKD\邤 edit_form.phpnu[PKD\~ &version.phpnu[PKD\Qpp\9\9+block_tag_youtube.phpnu[PKD\!eclasses/privacy/provider.phpnu[PKD\, akupgrade.txtnu[PKD\. ntests/block_tag_youtube_test.phpnu[PKD\  /kttests/behat/configure_tag_youtube_block.featurenu[PKD\\. ~settings.phpnu[PK ?