mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-25573_m20' of git://github.com/rwijaya/moodle
This commit is contained in:
commit
63786031f2
1 changed files with 22 additions and 0 deletions
|
@ -125,6 +125,9 @@ class filter_mediaplugin extends moodle_text_filter {
|
||||||
|
|
||||||
$search = '/<a[^>]*href="([^<]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
|
$search = '/<a[^>]*href="([^<]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
|
||||||
$newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_callback', $newtext);
|
$newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_callback', $newtext);
|
||||||
|
|
||||||
|
$search = '/<a(\s+[^>]+?)?\s+href="((([^"]+)youtube\.com)\/view_play_list\?p=([^"]*))"[^>]*>(.*?)<\/a>/is';
|
||||||
|
$newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_playlist_callback', $newtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($CFG->filter_mediaplugin_enable_img)) {
|
if (!empty($CFG->filter_mediaplugin_enable_img)) {
|
||||||
|
@ -349,6 +352,25 @@ function filter_mediaplugin_youtube_callback($link, $autostart=false) {
|
||||||
'</object>';
|
'</object>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change Youtube playlist into embedded Youtube playlist videos
|
||||||
|
*/
|
||||||
|
function filter_mediaplugin_youtube_playlist_callback($link, $autostart=false) {
|
||||||
|
|
||||||
|
$site = s($link[4]);
|
||||||
|
$param = s($link[5]);
|
||||||
|
$info = s($link[6]);
|
||||||
|
|
||||||
|
return '<object title="'.$info.'"
|
||||||
|
class="mediaplugin mediaplugin_youtube" type="application/x-shockwave-flash"
|
||||||
|
data="'.$site.'youtube.com/p/'.$param.'&fs=1&rel=0" width="400" height="320">'.
|
||||||
|
'<param name="movie" value="'.$site.'youtube.com/p/'.$param.'&fs=1&rel=0" />'.
|
||||||
|
'<param name="FlashVars" value="playerMode=embedded" />'.
|
||||||
|
'<param name="wmode" value="transparent" />'.
|
||||||
|
'<param name="allowFullScreen" value="true" />'.
|
||||||
|
'</object>';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change links to images into embedded images
|
* Change links to images into embedded images
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue