7fd69d36f1477b8e343457422582bcdfbec6f06e
[atutor.git] / docs / mods / _standard / vimeo / module_format_content.php
1 <?php
2
3 global $_input, $_content_base_href;
4
5 $media_replace = array();
6 $media_matches = array();
7
8 // vimeo videos
9 preg_match_all("/\[media(\|([0-9]+)\|([0-9]+))?\]http\:\/\/[0-9a-z.]*vimeo\.com\/(.*)\[\/media\]/i",$_input,$media_matches,PREG_SET_ORDER);
10
11 foreach ($media_matches as $media_match) {
12         $width = $media_match[2];
13         $height = $media_match[3];
14         if($width == ''){
15                 $width = DEFAULT_VIDEO_PLAYER_WIDTH;
16         }
17         if($height == ''){
18                 $height = DEFAULT_VIDEO_PLAYER_HEIGHT;
19         }
20         $video_id = $media_match[4];
21
22         $media_replace ='<iframe src="http://player.vimeo.com/video/'.$video_id.'" width="'.$width.'" height="'.$height.'" frameborder="0"></iframe>';
23         $_input = str_replace($media_match[0],$media_replace,$_input);
24 }
25
26 ?>