Пример #1
0
 /**
  * convert via openOffice hosted on the same server
  * @param string $input
  * @param string $targetFilter
  * @param string $targetExtension
  * @return string
  */
 protected static function convertLocal($input, $targetFilter, $targetExtension)
 {
     $infile = \OC::$server->getTempManager()->getTemporaryFile();
     $outdir = \OC::$server->getTempManager()->getTemporaryFolder();
     $cmd = Helper::findOpenOffice();
     $params = ' --headless --convert-to ' . $targetFilter . ' --outdir ' . escapeshellarg($outdir) . ' --writer ' . escapeshellarg($infile) . ' -env:UserInstallation=file://' . escapeshellarg(\OC::$server->getTempManager()->getTempBaseDir() . '/owncloud-' . \OC_Util::getInstanceId() . '/');
     file_put_contents($infile, $input);
     shell_exec($cmd . $params);
     $output = file_get_contents($outdir . '/' . basename($infile) . '.' . $targetExtension);
     return $output;
 }