コード例 #1
0
ファイル: medialib_test.php プロジェクト: educakanchay/campus
 /**
  * Test for core_media::get_filename.
  */
 public function test_get_filename()
 {
     $this->assertSame('frog.mp4', core_media::get_filename(new moodle_url('/pluginfile.php/312/mod_page/content/7/frog.mp4')));
     // This should work even though slasharguments is true, because we want
     // it to support 'legacy' links if somebody toggles the option later.
     $this->assertSame('frog.mp4', core_media::get_filename(new moodle_url('/pluginfile.php?file=/312/mod_page/content/7/frog.mp4')));
 }
コード例 #2
0
ファイル: medialib.php プロジェクト: evltuma/moodle
 public function embed($urls, $name, $width, $height, $options)
 {
     // If link is turned off, return empty.
     if (!empty($options[core_media::OPTION_NO_LINK])) {
         return '';
     }
     // Build up link content.
     $output = '';
     foreach ($urls as $url) {
         $title = core_media::get_filename($url);
         $printlink = html_writer::link($url, $title, array('class' => 'mediafallbacklink'));
         if ($output) {
             // Where there are multiple available formats, there are fallback links
             // for all formats, separated by /.
             $output .= ' / ';
         }
         $output .= $printlink;
     }
     return $output;
 }