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[] ="<object>\n".
15 " <a class=\"".$flowplayerholder_class."\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"##MEDIA1##.flv\"></a>\n".
17 " <div style=\"margin-top:-2em;\">\n".
18 " <a href=\"##MEDIA1##.flv\">##MEDIA1##.flv</a>\n".
23 preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+)\.mp4\[/media\]#i",$_input,$media_matches[],PREG_SET_ORDER);
24 //$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>";
25 $media_replace[] ="<object>\n".
27 " <a class=\"".$flowplayerholder_class."\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"##MEDIA1##.mp4\"></a>\n".
29 " <div style=\"margin-top:-3em;\">\n".
30 " <a href=\"##MEDIA1##.mp4\">##MEDIA1##.mp4</a>\n".
35 //preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+)\.mov\[/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##.mov\"></a>";
39 //preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+)\.mp3\[/media\]#i",$_input,$media_matches[],PREG_SET_ORDER);
40 //$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>";
42 // Executing the replace
43 for ($i=0;$i<count($media_replace);$i++){
44 foreach($media_matches[$i] as $media)
46 //find width and height for each matched media
47 if (preg_match("/\[media\|([0-9]*)\|([0-9]*)\]*/", $media[0], $matches))
50 $height = $matches[2];
58 //replace media tags with embedded media for each media tag
59 $media_input = $media_replace[$i];
60 $media_input = str_replace("##WIDTH##","$width",$media_input);
61 $media_input = str_replace("##HEIGHT##","$height",$media_input);
62 $media_input = str_replace("##MEDIA1##","$media[1]",$media_input);
63 $media_input = str_replace("##MEDIA2##","$media[2]",$media_input);
64 $_input = str_replace($media[0],$media_input,$_input);
68 // Include the javascript only if:
69 // 1. $flowplayerholder_class is used but not defined
70 // 2. exclude from export common cartridge or content package
71 if (strpos($_input, $flowplayerholder_class)
72 && !strpos($_input, $flowplayerholder_def)
73 && !strpos($_SERVER['PHP_SELF'], "ims_export.php"))
75 $_input .= '<script type="text/javascript">
76 '.$flowplayerholder_def.', "'.AT_BASE_HREF.'mods/_standard/flowplayer/flowplayer-3.2.4.swf", {
79 baseUrl: \''.AT_BASE_HREF.'get.php/'.$_content_base_href.'\'},