5 private $ccResult; // $ccResult = 0 returns a caption string, $ccResult = 1 returns the caption URL
\r
6 private $ccSourceURL; // The URL where the caption source file is located
\r
8 // variables to be passed to ConversionManager Class
\r
9 private $ccStringTarget; // Caption Target file as String
\r
10 private $ccSourceFileName; // File Name of the Source caption
\r
11 private $ccTypeTarget; // Class name of the target caption format (e.g. 'Sami', or 'QTtext')
\r
14 public function __construct($theCcResult,$theCcSourceURL,$theCcTypeTarget,$theFileName)
\r
16 // assign parameters to class members
\r
18 $this->ccResult = $theCcResult;
\r
19 $this->ccSourceURL = $theCcSourceURL;
\r
21 $this->ccStringTarget = '';
\r
22 $this->ccTypeTarget = $theCcTypeTarget;
\r
23 $this->ccSourceFileName = $theFileName;
\r
25 $this->_startService();
\r
28 private function _startService()
\r
30 global $rosettaCCSettings;
\r
32 // download remote caption file
\r
33 $myCCString = file_get_contents($this->ccSourceURL);
\r
35 $myCCString = stripslashes($myCCString);
\r
37 // Start a convertion Manager Instance
\r
38 $myCcManager = new ConversionManager($myCCString,$this->ccTypeTarget,$this->ccSourceFileName);
\r
40 // get the Caption Target URL
\r
41 $ccTargetUrl = $myCcManager->getCcTargetUrl();
\r
43 if($this->ccResult==0)
\r
45 // get the target file as a String
\r
46 $ccTargetString = TxtFileTools::fileToString($ccTargetUrl);
\r
47 echo $ccTargetString;
\r
49 else if ($this->ccResult==1)
\r
51 echo $rosettaCCSettings['uploadDir'].'/'.$ccTargetUrl;
\r