]> git.mjollnir.org Git - moodle.git/commitdiff
Added Flash and some cleanups in display
authormoodler <moodler>
Sun, 18 Apr 2004 10:01:44 +0000 (10:01 +0000)
committermoodler <moodler>
Sun, 18 Apr 2004 10:01:44 +0000 (10:01 +0000)
filter/mediaplugin/filter.php

index 42efa94089f1dc6b6562b4b11b9af5dd27aec620..551717bf8e25d6cc8cc2135ae0ccabf8f8d6e4a0 100644 (file)
@@ -47,10 +47,28 @@ function mediaplugin_filter($courseid, $text) {
         $text = preg_replace($search, $replace, $text);
     }
 
+    if (empty($CFG->filter_mediaplugin_ignore_swf)) {
+        $search = '/<a(.*?)href=\"(.*?)\.swf\"([^>]*)>(.*?)<\/a>/i';
+
+        $replace  = '\\0<p class="mediaplugin"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
+        $replace .= ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
+        $replace .= ' width="400" height="300" id="mp3player" align="">';
+        $replace .= " <param name=movie value=\"\\2.swf\">";
+        $replace .= ' <param name=quality value=high>';
+        $replace .= " <embed src=\"\\2.swf\" ";
+        $replace .= "  quality=high width=\"400\" height=\"300\" name=\"flashfilter\" ";
+        $replace .= ' type="application/x-shockwave-flash" ';
+        $replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
+        $replace .= '</embed>';
+        $replace .= '</object></p>';
+    
+        $text = preg_replace($search, $replace, $text);
+    }
+
     if (empty($CFG->filter_mediaplugin_ignore_mov)) {
         $search = '/<a(.*?)href=\"(.*?)\.mov\"([^>]*)>(.*?)<\/a>/i';
 
-        $replace  = '\\0<br /><object classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"';
+        $replace  = '\\0<p class="mediaplugin"><object classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"';
         $replace .= '        codebase="http://www.apple.com/qtactivex/qtplugin.cab" ';
         $replace .= '        height="300" width="400"';
         $replace .= '        id="quicktime" align="" type="application/x-oleobject">';
@@ -64,7 +82,7 @@ function mediaplugin_filter($courseid, $text) {
         $replace .= ' autoplay="false" controller="true" loop="true" ';
         $replace .= ' pluginspage="http://quicktime.apple.com/">';
         $replace .= '</embed>';
-        $replace .= '</object><br />';
+        $replace .= '</object></p>';
 
         $text = preg_replace($search, $replace, $text);
     }
@@ -72,7 +90,7 @@ function mediaplugin_filter($courseid, $text) {
     if (empty($CFG->filter_mediaplugin_ignore_wmv)) {
         $search = '/<a(.*?)href=\"(.*?)\.wmv\"([^>]*)>(.*?)<\/a>/i';
 
-        $replace  = '\\0<br /><object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"';
+        $replace  = '\\0<p class="mediaplugin"><object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"';
         $replace .= ' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ';
         $replace .= ' standby="Loading Microsoft® Windows® Media Player components..." ';
         $replace .= ' id="msplayer" align="" type="application/x-oleobject">';
@@ -91,7 +109,7 @@ function mediaplugin_filter($courseid, $text) {
         $replace .= ' TransparentAtStart="0" AnimationAtStart="0" ShowGotoBar="0" EnableFullScreenControls="1"';
         $replace .= ' pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/">';
         $replace .= '</embed>';
-        $replace .= '</object><br />';
+        $replace .= '</object></p>';
 
         $text = preg_replace($search, $replace, $text);
     }