removed mods directory from the ATutor codebase
[atutor.git] / mods / atutor_opencaps / opencaps / conversion_service / include / classes / ccformats / cc_SubRipSrt_format.php
diff --git a/mods/atutor_opencaps/opencaps/conversion_service/include/classes/ccformats/cc_SubRipSrt_format.php b/mods/atutor_opencaps/opencaps/conversion_service/include/classes/ccformats/cc_SubRipSrt_format.php
deleted file mode 100755 (executable)
index 4ff92f0..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-<?php\r
-/**\r
- * SubRipSrt Class\r
- */\r
-class SubRipSrt extends CaptionFormat\r
-{\r
-       private $textStyles = array();\r
-\r
-       /**\r
-        * Imports a caption string into a CaptionCollection \r
-        *\r
-        * @param String $theCCString the caption file as string\r
-        * @return CaptionCollection $myCcCollection A CaptionCollection Object\r
-        */\r
-       public function importCC($theCCString) \r
-       {\r
-               $ccImport = '';\r
-\r
-        // clean malformed patterns creted when saving files on win notepad\r
-        $toSearch = array(chr(13).chr(10));\r
-        $toReplace = array(chr(10));\r
-        $theCCString = str_replace($toSearch,$toReplace,$theCCString);\r
-                \r
-        // split each caption by \n\n\r
-        $allCaptions=split(chr(10).chr(10),$theCCString);\r
-                \r
-        // create a collection object\r
-        $myCollection = new CaptionCollection();\r
-        \r
-        $txtStyles = Array();\r
-        \r
-        $counter=0;\r
-        \r
-        foreach($allCaptions as $singleCaption)\r
-        {\r
-               \r
-               //echo '<br/>'.chr(10).''.$counter;\r
-               \r
-               // split each line of the single caption\r
-               $captionParts=split(chr(10),$singleCaption);\r
-               \r
-               // add captions if minimal time and caption are set\r
-               if (isset($captionParts[1]) && isset($captionParts[2]))\r
-               {\r
-                       $counter++;\r
-                       $timeMark = '';\r
-                       $captionLines = '';\r
-                       \r
-                       // fix milisecond separator "," by "."\r
-                       $captionParts[1] = str_replace(',','.',$captionParts[1]);       \r
-                       \r
-                       // get time marks on line 2\r
-                       $timeMark = split('-->',$captionParts[1]);\r
-       \r
-                       // get time in and out\r
-                       $timeIn = trim($timeMark[0]);\r
-                       $timeOut = trim($timeMark[1]);\r
-                       \r
-                               $captionLines = $captionParts[2]; // add caption line 1\r
-                               \r
-                       // if caption has two lines\r
-                       if (count($captionParts)==4)\r
-                       {       \r
-                               $captionLines .= ''.chr(10).$captionParts[3]; // add a new line + caption line 2\r
-                       }\r
-                       \r
-                       // Create a caption Object\r
-                       $theNewCaption = new Caption($timeIn,$timeOut,$captionLines,$txtStyles);\r
-                       \r
-                               // add caption to CaptionCollection\r
-                               $myCollection->addCaption($theNewCaption); \r
-       \r
-                       \r
-                       //echo ''.chr(10).'IN: '.$timeIn.'****'.' OUT:'.$timeOut;\r
-                       //echo ''.chr(10).''.$captionLines;\r
-               }\r
-               \r
-        } // end foreach\r
-       \r
-           return $myCollection;\r
-                \r
-       } // end importCC()\r
-\r
-       /**\r
-        * Exports a CaptionCollection object into a string\r
-        *\r
-        * @param CaptionCollection $theCollection A CaptionCollection Object\r
-        * @return String $captionString The caption as a String\r
-        */\r
-       public function exportCC($theCollection)\r
-       {\r
-               \r
-               $ccExport = '';\r
-       \r
-               $myCollection = $theCollection->getCollection();\r
-  \r
-               // fix time Srt Time Format\r
-               $toSearch = array('.');\r
-        $toReplace = array(',');\r
-        \r
-               $srtCounter = 0;\r
-               \r
-               foreach ($myCollection as $captionObj)\r
-               {\r
-                       \r
-                       $srtCounter++;\r
-                       \r
-                       // fix QT time to SRT format, replace "." by ","\r
-                       $srtInTime = $captionObj->getInTime();\r
-                       $srtInTime  = str_replace($toSearch,$toReplace,$srtInTime);\r
-                       \r
-                       $srtOutTime = $captionObj->getOutTime();\r
-                       $srtOutTime  = str_replace($toSearch,$toReplace,$srtOutTime);\r
-                       \r
-                       $srtCaption = $captionObj->getCaption();\r
-                       $srtCaption = str_replace('<BR/>',chr(10),$srtCaption);\r
-                       $srtCaption = str_replace('<br/>',chr(10),$srtCaption);\r
-                        \r
-                       $ccExport .= "$srtCounter\n".$srtInTime." --> ".$srtOutTime."\n".$srtCaption."\n\n";\r
-                       \r
-               } // end foreach\r
-               \r
-               // Fix if there are more than the two empty line separator (standard)\r
-               $ccExport = str_replace(chr(10).chr(10).chr(10),chr(10).chr(10),$ccExport);\r
-               \r
-               return $ccExport;\r
-               \r
-       } // end  exportCC()\r
-       \r
-       /**\r
-        * Verify if the caption file is a QText caption file \r
-       */\r
-       public function checkFormat($theCCString)\r
-       {\r
-               $isValid = false;\r
-               $patternCheck = "/({(QTtext)})/"; // RegExp to look for QText \r
-               preg_match_all($patternCheck,$theCCString,$patternFound);\r
-               \r
-               if(count($patternFound)>0)\r
-               {\r
-                       $isValid = true;\r
-               }\r
-\r
-               return $isValid;\r
-               \r
-       } // end  checkFormat() \r
-\r
-       /*\r
-        * Here functions to re-define\r
-        */\r
-       public function getName()\r
-       {\r
-               return 'SubRip - Srt';\r
-       }\r
-       \r
-       public function getAbout()\r
-       {\r
-               return '???';\r
-       }\r
-       \r
-       public function getVersion()\r
-       {\r
-               return '???';\r
-       }\r
-               \r
-       public function getFileExtension()\r
-       {\r
-               return 'srt';\r
-       }\r
-       \r
-       public function getIdPattern()\r
-       {\r
-               $idPattern = '/([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}) (-->) ([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3})/';\r
-               //$idPattern = '/([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3})/';\r
-               //$idPattern = '';\r
-               //$idPattern .= '/'; // start pattern\r
-               \r
-               //$idPattern .= '([0-9]{2}\n)'; \r
-                \r
-               //$idPattern .= '/'; // end pattern\r
-\r
-               return $idPattern;\r
-       }\r
-       \r
-       public function allowsTextStyles()\r
-       {\r
-               return '0';\r
-       }       \r
-       \r
-       public function template()\r
-       {\r
-               $ccTemplate = '\r
-1\r
-00:00:42,360 --> 00:00:48,360\r
-With this device we can\r
-give anything an attitude.\r
-\r
-2\r
-';\r
-               \r
-               return $ccTemplate;\r
-       }\r
-}  // end SubRipSrt \r
-?>
\ No newline at end of file