+++ /dev/null
-<?php\r
-class CcService\r
-{ \r
- // Unique Variables\r
- private $ccResult; // $ccResult = 0 returns a caption string, $ccResult = 1 returns the caption URL\r
- private $ccSourceURL; // The URL where the caption source file is located\r
- \r
- // variables to be passed to ConversionManager Class \r
- private $ccStringTarget; // Caption Target file as String\r
- private $ccSourceFileName; // File Name of the Source caption\r
- private $ccTypeTarget; // Class name of the target caption format (e.g. 'Sami', or 'QTtext')\r
- \r
-\r
- public function __construct($theCcResult,$theCcSourceURL,$theCcTypeTarget,$theFileName)\r
- {\r
- // assign parameters to class members \r
-\r
- $this->ccResult = $theCcResult;\r
- $this->ccSourceURL = $theCcSourceURL;\r
- \r
- $this->ccStringTarget = '';\r
- $this->ccTypeTarget = $theCcTypeTarget;\r
- $this->ccSourceFileName = $theFileName;\r
- \r
- $this->_startService();\r
- }\r
- \r
- private function _startService()\r
- {\r
- global $rosettaCCSettings;\r
- \r
- // download remote caption file\r
- $myCCString = file_get_contents($this->ccSourceURL);\r
- \r
- $myCCString = stripslashes($myCCString);\r
- \r
- // Start a convertion Manager Instance\r
- $myCcManager = new ConversionManager($myCCString,$this->ccTypeTarget,$this->ccSourceFileName);\r
- \r
- // get the Caption Target URL\r
- $ccTargetUrl = $myCcManager->getCcTargetUrl();\r
- \r
- if($this->ccResult==0)\r
- {\r
- // get the target file as a String\r
- $ccTargetString = TxtFileTools::fileToString($ccTargetUrl); \r
- echo $ccTargetString;\r
- }\r
- else if ($this->ccResult==1)\r
- {\r
- echo $rosettaCCSettings['uploadDir'].'/'.$ccTargetUrl;\r
- }\r
- \r
-\r
- }\r
-}\r
-?>
\ No newline at end of file