Added support for .ram files and added config settings.

This commit is contained in:
ikawhero 2006-03-13 06:16:23 +00:00
parent a68dc79623
commit d539ccf3e8
3 changed files with 46 additions and 1 deletions

View File

@ -69,6 +69,15 @@
set_config( 'filter_mediaplugin_enable_flv', 1 );
}
}
if (!isset($CFG->filter_mediaplugin_enable_ram) or $forcereset) {
if (isset($CFG->filter_mediaplugin_ignore_ram)) {
set_config( 'filter_mediaplugin_enable_ram', !$CFG->filter_mediaplugin_ignore_ram );
set_config( 'filter_mediaplugin_ignore_ram','' );
}
else {
set_config( 'filter_mediaplugin_enable_ram', 1 );
}
}
if (!isset($CFG->filter_mediaplugin_enable_rm) or $forcereset) {
if (isset($CFG->filter_mediaplugin_ignore_rm)) {
set_config( 'filter_mediaplugin_enable_rm', !$CFG->filter_mediaplugin_ignore_rm );

View File

@ -184,7 +184,32 @@ function mediaplugin_filter($courseid, $text) {
$text = preg_replace($search, $replace, $text);
}
if ($CFG->filter_mediaplugin_enable_ram) {
$search = '/<a(.*?)href=\"([^<]+)\.ram\"([^>]*)>(.*?)<\/a>/is';
$replace = '\\0<p class="mediaplugin ram"><object width="240" height="180">';
$replace .= '<param name="src" value="\\2.ram" />';
$replace .= '<param name="autostart" value="true" />';
$replace .= '<param name="controls" value="imagewindow" />';
$replace .= '<param name="console" value="video" />';
$replace .= '<param name="loop" value="true" />';
$replace .= '<embed src="\\2.rm" width=240" height="180" loop="true" type="audio/x-pn-realaudio-plugin" controls="imagewindow" console="video" autostart="true">';
$replace .= '</embed>';
$replace .= '</object><br />';
$replace .= '<object width="320" height="30">';
$replace .= '<param name="src" value="\\2.ram" />';
$replace .= '<param name="autostart" value="true" />';
$replace .= '<param name="controls" value="ControlPanel" />';
$replace .= '<param name="console" value="video" />';
$replace .= '<embed src="\\2.rm" width="240" height="30" controls="ControlPanel" type="audio/x-pn-realaudio-plugin" console="video" autostart="true">';
$replace .= '</embed>';
$replace .= '</object></p>';
$text = preg_replace($search, $replace, $text);
}
if ($CFG->filter_mediaplugin_enable_rm) {
$search = '/<a(.*?)href=\"([^<]+)\.rm\"([^>]*)>(.*?)<\/a>/is';
@ -209,7 +234,6 @@ function mediaplugin_filter($courseid, $text) {
$text = preg_replace($search, $replace, $text);
}
return $text;

View File

@ -11,6 +11,8 @@
$txt->mediapluginmpg = get_string( 'mediapluginmpg','admin' );
$txt->mediapluginavi = get_string( 'mediapluginavi','admin' );
$txt->mediapluginflv = get_string( 'mediapluginflv','admin' );
$txt->mediapluginram = get_string( 'mediapluginram','admin' );
$txt->mediapluginrm = get_string( 'mediapluginrm','admin' );
$txt->yes = get_string( 'yes' );
$txt->no = get_string( 'no' );
@ -53,4 +55,14 @@
<td><?php choose_from_menu( $yesno,'filter_mediaplugin_enable_flv',
$CFG->filter_mediaplugin_enable_flv ); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php echo $txt->mediapluginram ?></td>
<td><?php choose_from_menu( $yesno,'filter_mediaplugin_enable_ram',
$CFG->filter_mediaplugin_enable_ram ); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php echo $txt->mediapluginrm ?></td>
<td><?php choose_from_menu( $yesno,'filter_mediaplugin_enable_rm',
$CFG->filter_mediaplugin_enable_rm ); ?></td>
</tr>
</table>