本文整理匯總了PHP中Themes::previewConversionResults方法的典型用法代碼示例。如果您正苦於以下問題:PHP Themes::previewConversionResults方法的具體用法?PHP Themes::previewConversionResults怎麽用?PHP Themes::previewConversionResults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Themes
的用法示例。
在下文中一共展示了Themes::previewConversionResults方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processConversion
function processConversion($files, $converter, $pipeline, $autoPipeline, $afterConversion, $setupOpenOfficeOrg, $outputZip, $justShowPreviewDirectory = null)
{
$forcedPipeline = getGlobalConfigItem('forcePipeline');
if ($forcedPipeline != null) {
$pipeline = 'fake:' . $forcedPipeline;
}
ensureClientType();
if (thereWasAFileGiven($files, $pipeline) || $justShowPreviewDirectory) {
$returnZipPath = null;
$previewDirectory = null;
if (!$justShowPreviewDirectory) {
$previewDirectory = getTemporaryDirectoryInsideDirectory(getWritableDirectory(), 'preview');
$temporaryDirectory = getTemporaryDirectory();
$pipelineToRunOnDocuments = substringAfter($pipeline, ':');
foreach ($files as $file) {
if ($file['size'] != 0) {
$documentPath = moveUploadToConversionDirectory($file, $temporaryDirectory);
$oasisOpenDocumentPath = '';
if (!isAnOasisOpenDocument($file)) {
$oasisOpenDocumentPath = makeOasisOpenDocument($documentPath, $converter);
silentlyUnlink($documentPath);
} else {
$oasisOpenDocumentPath = $documentPath;
}
if ($pipelineToRunOnDocuments != "none") {
extractUsefulOasisOpenDocumentFiles($oasisOpenDocumentPath);
silentlyUnlink($oasisOpenDocumentPath);
$oasisOpenDocumentContentPath = dirname($oasisOpenDocumentPath) . DIRECTORY_SEPARATOR . 'docvert-content.xml';
applyPipeline($oasisOpenDocumentContentPath, $pipelineToRunOnDocuments, $autoPipeline, $previewDirectory);
silentlyUnlink($oasisOpenDocumentContentPath);
}
}
}
$returnZipPath = zipAndDeleteTemporaryFiles($temporaryDirectory);
if ($afterConversion == 'preview') {
include_once dirname(__FILE__) . '/webpage.php';
$themes = new Themes();
//$returnZipPath = $themes->unzipConversionResults($returnZipPath, $previewDirectory); //WTF
}
} else {
$previewDirectory = getWritableDirectory() . $justShowPreviewDirectory;
$zipsInPreviewDirectory = glob($previewDirectory . DIRECTORY_SEPARATOR . '*.zip');
if (count($zipsInPreviewDirectory) != 1) {
$errorData = array('zipsInPreviewDirectory' => count($zipsInPreviewDirectory), 'previewDirectory' => $previewDirectory);
webServiceError('&docvert-internal-error-no-zip-file;', 500, $errorData);
}
$returnZipPath = $zipsInPreviewDirectory[0];
}
if ($afterConversion == 'preview') {
include_once dirname(__FILE__) . '/webpage.php';
$themes = new Themes();
$themes->previewConversionResults($returnZipPath, $previewDirectory);
} elseif ($afterConversion == 'saveZip') {
if (DOCVERT_CLIENT_TYPE == 'command line') {
moveFile($returnZipPath, $outputZip);
print 'Ok! File saved to ' . $outputZip . "\n";
deleteDirectoryRecursively($temporaryDirectory);
die;
} else {
webServiceError('&error-after-conversion-flag;');
}
} elseif ($afterConversion == 'downloadZip') {
//TODO: different versions of IE want different "content disposition" header syntaxes
//perhaps we could detect versions of IE and serve up what they need? Will need quite a bit of research.
header('Content-Type: application/x-zip-compressed');
header('Content-disposition: attachment; filename=' . basename($returnZipPath));
$zipContents = file_get_contents($returnZipPath);
print $zipContents;
flush();
silentlyUnlink($returnZipPath);
deleteDirectoryRecursively($temporaryDirectory);
die;
} else {
webServiceError('&error-unsupported-after-conversion;', 500, array('after-conversion' => revealXml($afterConversion)));
}
} elseif ($setupOpenOfficeOrg) {
setupOpenOfficeOrg();
} else {
/* TODO: so there's been no upload and what do we do?
* I suppose an http status code would be appropriate.
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
* The 4xx series are for user error, which seems appropriate.
* ...but none of them seem quite appropriate for a casual
* "you didn't give me files" response.
* They talk about malformed requests.
*
* So I'm doing a "400 Bad Request" in the meantime.
*/
webServiceError('&error-no-files-uploaded;', '400 Bad Request');
}
}