source: spip-zone/_plugins_/flash_flv_player/flvplayer.php @ 70522

Last change on this file since 70522 was 4552, checked in by cedric@…, 14 years ago

un player flv

File size: 1.2 KB
Line 
1<?php
2
3/**
4 * definition du plugin "flvplayer"
5 */
6
7function flvplayer($url, $width=320, $height=240){
8        static  $player = NULL;
9        $url = urlencode(url_absolue($url));
10        if ($player == NULL)
11                $player = find_in_path('flvplayer.swf');
12        $playa_ = "
13<object type='application/x-shockwave-flash' width='$width' height='$height'
14wmode='transparent' data='$player?file=$url&autoStart=false'>
15<param name='movie' value='$player?file=$url&autoStart=false' />
16<param name='wmode' value='transparent' />
17</object>";
18        return $playa_;
19}
20
21function flvplayer_post_propre($texte) {
22       
23        $reg_formats="flv";
24         
25        //trouver des liens complets
26        unset($matches) ;
27        preg_match_all("/<a href=['\"]?(http:\/\/[a-zA-Z0-9 ()\/\:\._%\?+'=~-]*\.($reg_formats))['\"]?[^>]*>(.*)<\/a>/iU", $texte, $matches);
28        $url_a=$matches[1];
29
30        if(!$matches[1][0]){
31                //trouver des url relatives
32                unset($matches) ;
33                preg_match_all("/<a(.*)href=['\"]([a-zA-Z0-9 ()\/\._&%\?+'=~-]*\.($reg_formats))['\"](.*)[^>]*>(.*)<\/a>/iU", $texte, $matches);
34                $url_a=$matches[2];
35        }
36        if (is_array($url_a)){
37                if ($player == NULL)
38                        $player = find_in_path('flvplayer.swf');
39                foreach($url_a as $url){
40                        $texte .= flvplayer($url);
41                }
42        }
43       
44        return $texte;
45}
46
47       
48?>
Note: See TracBrowser for help on using the repository browser.