Added support for FLV. Might need to replace the FLV player
authormoodler <moodler>
Tue, 25 Oct 2005 07:40:09 +0000 (07:40 +0000)
committermoodler <moodler>
Tue, 25 Oct 2005 07:40:09 +0000 (07:40 +0000)
if we don't get explicit permission for this one.

Thanks to Julian Ridden for the code!

filter/mediaplugin/defaultsettings.php
filter/mediaplugin/filter.php
filter/mediaplugin/filterconfig.html
filter/mediaplugin/flvplayer.README.txt [new file with mode: 0644]
filter/mediaplugin/flvplayer.swf [new file with mode: 0644]

index e0ec1de..1f3427d 100644 (file)
             set_config( 'filter_mediaplugin_enable_avi', 1 );
         }
     }
+    if (!isset($CFG->filter_mediaplugin_enable_flv)) {
+        if (isset($CFG->filter_mediaplugin_ignore_flv)) {
+            set_config( 'filter_mediaplugin_enable_flv', !$CFG->filter_mediaplugin_ignore_flv );
+        }
+        else {
+            set_config( 'filter_mediaplugin_enable_flv', 1 );
+        }
+    }
 ?>
index 637d23a..0d57f82 100644 (file)
@@ -69,6 +69,27 @@ function mediaplugin_filter($courseid, $text) {
     
         $text = preg_replace($search, $replace, $text);
     }
+    
+    if ($CFG->filter_mediaplugin_enable_flv) {
+        $search = '/<a(.*?)href=\"([^<]+)\.flv\"([^>]*)>(.*?)<\/a>/is';
+            
+        $replace  = '\\0&nbsp;<object class="mediaplugin flv" 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="480" height="360" id="flvplayer">';
+        $replace .= " <param name=\"movie\" value=\"$CFG->wwwroot/filter/mediaplugin/flvplayer.swf?file=\\2.flv\" />";
+        $replace .= ' <param name="quality" value="high" />';
+        $replace .= ' <param name="bgcolor" value="#FFFFFF" />';
+        $replace .= ' <param name="flashvars" value="'.$c.'" />';
+        $replace .= " <embed src=\"$CFG->wwwroot/filter/mediaplugin/flvplayer.swf?file=\\2.flv\" ";
+        $replace .= "  quality=\"high\" bgcolor=\"#FFFFFF\" width=\"480\" height=\"360\" name=\"flvplayer\" ";
+        $replace .= ' type="application/x-shockwave-flash" ';
+        $replace .= ' flashvars="'.$c.'" ';
+        $replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
+        $replace .= '</embed>';
+        $replace .= '</object>&nbsp;';
+    
+        $text = preg_replace($search, $replace, $text);
+    }
 
     if ($CFG->filter_mediaplugin_enable_mov) {
         $search = '/<a(.*?)href=\"([^<]+)\.mov\"([^>]*)>(.*?)<\/a>/is';
index c57208c..c9f9983 100644 (file)
@@ -10,6 +10,7 @@
     $txt->mediapluginwmv = get_string( 'mediapluginwmv','admin' );
     $txt->mediapluginmpg = get_string( 'mediapluginmpg','admin' );
     $txt->mediapluginavi = get_string( 'mediapluginavi','admin' );
+    $txt->mediapluginflv = get_string( 'mediapluginflv','admin' );
     $txt->yes = get_string( 'yes' );
     $txt->no = get_string( 'no' );
 
@@ -47,4 +48,9 @@
         <td><?php choose_from_menu( $yesno,'filter_mediaplugin_enable_avi',
              $CFG->filter_mediaplugin_enable_avi ); ?></td> 
     </tr>
+    <tr valign="top">
+        <td align="right"><?php echo $txt->mediapluginflv ?></td>
+        <td><?php choose_from_menu( $yesno,'filter_mediaplugin_enable_flv',
+             $CFG->filter_mediaplugin_enable_flv ); ?></td> 
+    </tr>
 </table>
diff --git a/filter/mediaplugin/flvplayer.README.txt b/filter/mediaplugin/flvplayer.README.txt
new file mode 100644 (file)
index 0000000..85c7365
--- /dev/null
@@ -0,0 +1,7 @@
+The FLV player is by Jeroen Wijering - www.jeroenwijering.com 
+produced under the creative commons license 
+
+(exact terms: http://creativecommons.org/licenses/by-nc-sa/2.5/)
+
+We are currently waiting for clearance from him to include this 
+in Moodle under the GPL ... it will be removed if he says no.
diff --git a/filter/mediaplugin/flvplayer.swf b/filter/mediaplugin/flvplayer.swf
new file mode 100644 (file)
index 0000000..694e391
Binary files /dev/null and b/filter/mediaplugin/flvplayer.swf differ