1. replace AT_INCLUDE_PATH with TR_INCLUDE_PATH
authorCindy Li <cli@ocad.ca>
Fri, 8 Oct 2010 18:42:04 +0000 (18:42 -0000)
committerCindy Li <cli@ocad.ca>
Fri, 8 Oct 2010 18:42:04 +0000 (18:42 -0000)
2. copy over the flowplayer handling from ATutor

docs/home/classes/ContentUtility.class.php
docs/home/editor/editor_tab_functions.inc.php
docs/home/editor/editor_tabs/alternatives.inc.php

index 21e8e4d..f90f236 100644 (file)
@@ -140,19 +140,40 @@ class ContentUtility {
        private static function embedFLV($text) {\r
                global $content_base_href;\r
                \r
-               // .flv - uses Flowplayer 3.0 from flowplayer.org (playing file via full URL)\r
-               preg_match_all("#\[media[0-9a-z\|]*\]http://([\w\./-]+)\.flv\[/media\]#i",$text,$media_matches[0],PREG_SET_ORDER);\r
-               $media_replace[0] ="<a class=\"flowplayerholder\"\r
-               style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\"\r
-               href=\"http://##MEDIA1##.flv\">\r
-               </a>";\r
-               \r
-               // .flv - uses Flowplayer 3.0 from flowplayer.org (playing file from AT_content_dir)\r
-               preg_match_all("#\[media[0-9a-z\|]*\]([\w\./-]+)\.flv\[/media\]#i",$text,$media_matches[1],PREG_SET_ORDER);\r
-               $media_replace[1] ="<a class=\"flowplayerholder\"\r
-               style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\"\r
-               href=\"".TR_BASE_HREF."get.php/".$content_base_href."##MEDIA1##.flv\">\r
-               </a>";\r
+               $media_replace = array();\r
+               $media_matches = array();\r
+               \r
+               // .flv (playing file via full URL)\r
+               preg_match_all("#\[media[0-9a-z\|]*\]http://([\w\./-]+)\.flv\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER);\r
+               $media_replace[] ="<a class=\"flowplayerholder\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"http://##MEDIA1##.flv\"></a>";\r
+               \r
+               // .flv (playing file from TR_content_dir)\r
+               preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+)\.flv\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER);\r
+               $media_replace[] ="<a class=\"flowplayerholder\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"".TR_BASE_HREF."get.php/".$content_base_href."##MEDIA1##.flv\"></a>";\r
+               \r
+               // .mp4 (playing file via full URL)\r
+               preg_match_all("#\[media[0-9a-z\|]*\]http://([\w\./-]+)\.mp4\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER);\r
+               $media_replace[] ="<a class=\"flowplayerholder\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"http://##MEDIA1##.mp4\"></a>";\r
+               \r
+               // .mp4 (playing file from TR_content_dir)\r
+               preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+)\.mp4\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER);\r
+               $media_replace[] ="<a class=\"flowplayerholder\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"".TR_BASE_HREF."get.php/".$content_base_href."##MEDIA1##.mp4\"></a>";\r
+               \r
+               // .mov (playing file via full URL)\r
+               preg_match_all("#\[media[0-9a-z\|]*\]http://([\w\./-]+)\.mov\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER);\r
+               $media_replace[] ="<a class=\"flowplayerholder\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"http://##MEDIA1##.mov\"></a>";\r
+               \r
+               // .mov (playing file from TR_content_dir)\r
+               preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+)\.mov\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER);\r
+               $media_replace[] ="<a class=\"flowplayerholder\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"".TR_BASE_HREF."get.php/".$content_base_href."##MEDIA1##.mov\"></a>";\r
+               \r
+               // .mp3 (playing file via full URL)\r
+               preg_match_all("#\[media[0-9a-z\|]*\]http://([\w\./-]+)\.mp3\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER);\r
+               $media_replace[] ="<a class=\"flowplayerholder\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"http://##MEDIA1##.mp3\"></a>";\r
+               \r
+               // .mp3 (playing file from TR_content_dir)\r
+               preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+)\.mp3\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER);\r
+               $media_replace[] ="<a class=\"flowplayerholder\" style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\" href=\"".TR_BASE_HREF."get.php/".$content_base_href."##MEDIA1##.mp3\"></a>";\r
                \r
                $has_flv = false;\r
                // Executing the replace\r
index 58e8c62..fb004e2 100644 (file)
@@ -93,9 +93,9 @@ function isValidURL($url) {
 function populate_a4a($cid, $content, $formatting){
        global $db, $my_files;
        
-    include_once(AT_INCLUDE_PATH.'classes/A4a/A4a.class.php');
-       include_once(AT_INCLUDE_PATH.'classes/XML/XML_HTMLSax/XML_HTMLSax.php');        /* for XML_HTMLSax */
-       include_once(AT_INCLUDE_PATH.'classes/ContentOutputParser.class.php');  /* for parser */
+    include_once(TR_INCLUDE_PATH.'classes/A4a/A4a.class.php');
+       include_once(TR_INCLUDE_PATH.'classes/XML/XML_HTMLSax/XML_HTMLSax.php');        /* for XML_HTMLSax */
+       include_once(TR_INCLUDE_PATH.'classes/ContentOutputParser.class.php');  /* for parser */
        
        $body = format_content($content, $formatting,array());
     
index ebf1231..7fe20db 100644 (file)
@@ -97,7 +97,7 @@ function display_alternative_cell($secondary_resources, $alternative_type, $cont
 global $db, $content_row;
 populate_a4a($cid, $_POST['body_text'], $_POST['formatting']);
 
-include_once(AT_INCLUDE_PATH.'classes/A4a/A4a.class.php');
+include_once(TR_INCLUDE_PATH.'classes/A4a/A4a.class.php');
 
 $a4a = new A4a($cid);
 $primary_resources = $a4a->getPrimaryResources();