Differences Between: [Versions 311 and 402] [Versions 311 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * External API to get language strings for the videojs. 19 * 20 * @package media_videojs 21 * @copyright 2020 Shamim Rezaie <shamim@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace media_videojs\external; 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 require_once("$CFG->libdir/externallib.php"); 30 31 use external_api; 32 use external_function_parameters; 33 use external_value; 34 35 /** 36 * The API to get language strings for the videojs. 37 * 38 * @copyright 2020 Shamim Rezaie <shamim@moodle.com> 39 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 40 */ 41 class get_language extends external_api { 42 /** 43 * Returns description of parameters. 44 * 45 * @return external_function_parameters 46 */ 47 public static function execute_parameters() { 48 return new external_function_parameters([ 49 'lang' => new external_value(PARAM_ALPHAEXT, 'language') 50 ]); 51 } 52 53 /** 54 * Returns language strings in the JSON format 55 * 56 * @param string $lang The language code 57 * @return string 58 */ 59 public static function execute(string $lang) { 60 [ 61 'lang' => $lang, 62 ] = external_api::validate_parameters(self::execute_parameters(), [ 63 'lang' => $lang, 64 ]); 65 66 return \media_videojs_plugin::get_language_content($lang); 67 } 68 69 /** 70 * Returns description of method result value 71 * 72 * @return external_value 73 */ 74 public static function execute_returns() { 75 return new external_value(PARAM_RAW, 'language pack json'); 76 } 77 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body