diff --git a/filter/mediaplugin/filter.php b/filter/mediaplugin/filter.php index 222c9f45a7f..a6b0bfaead6 100644 --- a/filter/mediaplugin/filter.php +++ b/filter/mediaplugin/filter.php @@ -53,6 +53,16 @@ class filter_mediaplugin extends moodle_text_filter { $newtext = preg_replace_callback($search, 'filter_mediaplugin_mp3_callback', $newtext); } + if ($CFG->filter_mediaplugin_enable_ogg) { + $search = '/]*?href="([^<]+\.ogg)"[^>]*>.*?<\/a>/is'; + $newtext = preg_replace_callback($search, 'filter_mediaplugin_ogg_callback', $newtext); + } + + if ($CFG->filter_mediaplugin_enable_ogv) { + $search = '/]*?href="([^<]+\.ogv)"[^>]*>.*?<\/a>/is'; + $newtext = preg_replace_callback($search, 'filter_mediaplugin_ogv_callback', $newtext); + } + if ($CFG->filter_mediaplugin_enable_swf) { $search = '/]*?href="([^<]+\.swf)(\?d=([\d]{1,3}%?)x([\d]{1,3}%?))?"[^>]*>.*?<\/a>/is'; $newtext = preg_replace_callback($search, 'filter_mediaplugin_swf_callback', $newtext); @@ -195,6 +205,44 @@ OET; return $output; } +function filter_mediaplugin_ogg_callback($link) { + global $CFG, $OUTPUT, $PAGE; + + static $count = 0; + $count++; + $id = 'filter_ogg_'.time().$count; //we need something unique because it might be stored in text cache + + $url = addslashes_js($link[1]); + $printlink = html_writer::link($url, get_string('oggaudio', 'filter_mediaplugin')); + $unsupportedplugins = get_string('unsupportedplugins', 'filter_mediaplugin', $printlink); + $output = << + $unsupportedplugins + +OET; + + return $output; +} + +function filter_mediaplugin_ogv_callback($link) { + global $CFG, $OUTPUT, $PAGE; + + static $count = 0; + $count++; + $id = 'filter_ogv_'.time().$count; //we need something unique because it might be stored in text cache + + $url = addslashes_js($link[1]); + $printlink = html_writer::link($url, get_string('ogvvideo', 'filter_mediaplugin')); + $unsupportedplugins = get_string('unsupportedplugins', 'filter_mediaplugin', $printlink); + $output = << + $unsupportedplugins + +OET; + + return $output; +} + function filter_mediaplugin_swf_callback($link) { global $PAGE; static $count = 0; diff --git a/filter/mediaplugin/filtersettings.php b/filter/mediaplugin/filtersettings.php index 86cee95a2dc..a0f4bc97548 100644 --- a/filter/mediaplugin/filtersettings.php +++ b/filter/mediaplugin/filtersettings.php @@ -26,5 +26,9 @@ if ($ADMIN->fulltree) { $settings->add(new admin_setting_configcheckbox('filter_mediaplugin_enable_youtube', get_string('mediapluginyoutube','admin'), '', 1)); + $settings->add(new admin_setting_configcheckbox('filter_mediaplugin_enable_ogg', get_string('mediapluginogg','admin'), '', 1)); + + $settings->add(new admin_setting_configcheckbox('filter_mediaplugin_enable_ogv', get_string('mediapluginogv','admin'), '', 1)); + $settings->add(new admin_setting_configcheckbox('filter_mediaplugin_enable_img', get_string('mediapluginimg','admin'), '', 1)); } diff --git a/filter/mediaplugin/lang/en/filter_mediaplugin.php b/filter/mediaplugin/lang/en/filter_mediaplugin.php index 98d81062b8f..fadff70527a 100644 --- a/filter/mediaplugin/lang/en/filter_mediaplugin.php +++ b/filter/mediaplugin/lang/en/filter_mediaplugin.php @@ -27,3 +27,6 @@ $string['filtername'] = 'Multimedia Plugins'; $string['flashanimation'] = 'Flash animation'; $string['flashvideo'] = 'Flash video'; $string['mp3audio'] = 'MP3 audio'; +$string['oggaudio'] = 'OGG audio'; +$string['ogvvideo'] = 'OGV video'; +$string['unsupportedplugins'] = '(The browser does not support this type of file. {$a})'; diff --git a/lang/en/admin.php b/lang/en/admin.php index 217cf036778..274ba4b972d 100755 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -657,6 +657,8 @@ $string['mediapluginimg'] = 'Enable auto-embedding of linked images'; $string['mediapluginmov'] = 'Enable .mov filter'; $string['mediapluginmpg'] = 'Enable .mpg filter'; $string['mediapluginmp3'] = 'Enable .mp3 filter'; +$string['mediapluginogg'] = 'Enable .ogg filter'; +$string['mediapluginogv'] = 'Enable .ogv filter'; $string['mediapluginram'] = 'Enable .ram filter'; $string['mediapluginrm'] = 'Enable .rm filter'; $string['mediapluginrpm'] = 'Enable .rpm filter'; diff --git a/lib/filelib.php b/lib/filelib.php index f835c9273ea..bd201d1ec30 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -1193,6 +1193,8 @@ function get_mimetypes_array() { 'odf' => array ('type'=>'application/vnd.oasis.opendocument.formula', 'icon'=>'odf'), 'odb' => array ('type'=>'application/vnd.oasis.opendocument.database', 'icon'=>'odb'), 'odi' => array ('type'=>'application/vnd.oasis.opendocument.image', 'icon'=>'odi'), + 'ogg' => array ('type'=>'audio/ogg', 'icon'=>'audio'), + 'ogv' => array ('type'=>'video/ogg', 'icon'=>'video'), 'pct' => array ('type'=>'image/pict', 'icon'=>'image'), 'pdf' => array ('type'=>'application/pdf', 'icon'=>'pdf'), diff --git a/lib/filestorage/file_types.mm b/lib/filestorage/file_types.mm index a447f0d0bd9..841fce7e774 100644 --- a/lib/filestorage/file_types.mm +++ b/lib/filestorage/file_types.mm @@ -1,106 +1,107 @@ - - - - - - - - + + + + + + + - - - - + + + + - - - - - - + + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - + + + - - - - - - - + + + + + + + - - - - + + + + - - + + - - + +