2 // input string. DO NOT CHANGE.
3 global $_input, $_content_base_href;
5 //Output for flowplayer module.
6 $media_replace = array();
7 $media_matches = array();
8 $flowplayerholder_class = "atutor.flowplayerholder"; // style class used to play flowplayer medias
9 $flowplayerholder_def = '$f("*.'.$flowplayerholder_class.'"'; // javascript definition for atutor.flowplayerholder
12 preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+)\.flv\[/media\]#i",$_input,$media_matches[],PREG_SET_ORDER);
13 $media_replace[] =" <div>\n".
14 " <a class=\"".$flowplayerholder_class."\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"##MEDIA1##.flv\"></a>\n".
16 " <div style=\"margin-top:-2em;\">\n".
17 " <a href=\"##MEDIA1##.flv\">##MEDIA1##.flv</a>\n".
21 preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+)\.mp4\[/media\]#i",$_input,$media_matches[],PREG_SET_ORDER);
22 //$media_replace[] ="<a class=\"".$flowplayerholder_class."\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"".AT_BASE_HREF."get.php/".$_content_base_href."##MEDIA1##.mp4\"></a>";
23 $media_replace[] =" <div>\n".
24 " <a class=\"".$flowplayerholder_class."\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"##MEDIA1##.mp4\"></a>\n".
26 " <div style=\"margin-top:-3em;\">\n".
27 " <a href=\"##MEDIA1##.mp4\">##MEDIA1##.mp4</a>\n".
31 //preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+)\.mov\[/media\]#i",$_input,$media_matches[],PREG_SET_ORDER);
32 //$media_replace[] ="<a class=\"".$flowplayerholder_class."\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"".AT_BASE_HREF."get.php/".$_content_base_href."##MEDIA1##.mov\"></a>";
35 //preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+)\.mp3\[/media\]#i",$_input,$media_matches[],PREG_SET_ORDER);
36 //$media_replace[] ="<a class=\"".$flowplayerholder_class."\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"".AT_BASE_HREF."get.php/".$_content_base_href."##MEDIA1##.mp3\"></a>";
38 // Executing the replace
39 for ($i=0;$i<count($media_replace);$i++){
40 foreach($media_matches[$i] as $media)
42 //find width and height for each matched media
43 if (preg_match("/\[media\|([0-9]*)\|([0-9]*)\]*/", $media[0], $matches))
46 $height = $matches[2];
50 $width = DEFAULT_VIDEO_PLAYER_WIDTH;
51 $height = DEFAULT_VIDEO_PLAYER_HEIGHT;
54 //replace media tags with embedded media for each media tag
55 $media_input = $media_replace[$i];
56 $media_input = str_replace("##WIDTH##","$width",$media_input);
57 $media_input = str_replace("##HEIGHT##","$height",$media_input);
58 $media_input = str_replace("##MEDIA1##","$media[1]",$media_input);
59 $media_input = str_replace("##MEDIA2##","$media[2]",$media_input);
60 $_input = str_replace($media[0],$media_input,$_input);
64 // Include the javascript only if:
65 // 1. $flowplayerholder_class is used but not defined
66 // 2. exclude from export common cartridge or content package
67 if (strpos($_input, $flowplayerholder_class)
68 && !strpos($_input, $flowplayerholder_def)
69 && !strpos($_SERVER['PHP_SELF'], "ims_export.php"))
71 $_input .= '<script type="text/javascript">
72 '.$flowplayerholder_def.', "'.AT_BASE_HREF.'mods/_standard/flowplayer/flowplayer-3.2.4.swf", {
75 baseUrl: \''.AT_BASE_HREF.'get.php/'.$_content_base_href.'\'},