本文整理汇总了PHP中File_Archive::toOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP File_Archive::toOutput方法的具体用法?PHP File_Archive::toOutput怎么用?PHP File_Archive::toOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File_Archive
的用法示例。
在下文中一共展示了File_Archive::toOutput方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportUploadedFiles
function exportUploadedFiles($gid)
{
require_once "File/Archive.php";
File_Archive::setOption('zipCompressionLevel', 0);
$baseDir = CUSTOMER_IMAGE_DIR . $gid;
$files = list_files_dir($baseDir);
File_Archive::extract($files, File_Archive::toArchive("campaign_" . $gid . "_uploadedfiles_" . date('dFY') . ".zip", File_Archive::toOutput()));
}
示例2: execute
/**
* ダウンロードメイン表示クラス
*
* @access public
*/
function execute()
{
$header = <<<EOD
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>NetCommons</title>
</head>
<body>
EOD;
$footer = <<<EOD
</body>
</html>
EOD;
require_once "File/Archive.php";
$dest = File_Archive::toArchive("document.zip", File_Archive::toOutput());
$dest->newFile("document.html");
$download_url = "?action=" . $this->download_action . "&upload_id=";
$count = substr_count($this->content, $download_url);
if (!$count) {
$dest->writeData($header . $this->content . $footer);
$dest->close();
exit;
}
$upload_id = array();
$files = array();
$trans = array();
$parts = explode($download_url, $this->content);
for ($i = 1; $i <= $count; $i++) {
$id = substr($parts[$i], 0, strpos($parts[$i], '"'));
if (!isset($upload_id[$id])) {
$upload_id[$id] = true;
list($pathname, $filename, $physical_file_name, $space_type) = $this->uploadsView->downloadCheck($id, null, 0, "common_download_main");
if ($pathname != null) {
$files[] = $pathname . $physical_file_name;
$trans[BASE_URL . '/' . $download_url . $id] = "./" . $physical_file_name;
$trans[$download_url . $id] = $physical_file_name;
}
}
}
clearstatcache();
$dest->writeData($header . strtr($this->content, $trans) . $footer);
File_Archive::extract($files, $dest);
}
示例3: handleExportGet
/**
* handle export
*/
private function handleExportGet()
{
$request = Request::getInstance();
if (!$request->exists('id')) {
throw new Exception('Thema ontbreekt.');
}
$id = intval($request->getValue('id'));
$key = array('id' => $id);
$themedetail = $this->getDetail($key);
$theme = $this->director->themeManager->getThemeFromId($key);
$tempPath = $this->director->getTempPath() . "/theme" . session_id();
$themePath = $themedetail['themePath'];
$configPath = $theme->getConfigFile();
mkdir($tempPath);
Utils::copyRecursive($themePath, $tempPath);
copy($configPath, $tempPath . "/" . basename($configPath));
copy($themePath . "/script/ThemeInstaller.php", $tempPath . "/ThemeInstaller.php");
$filename = sprintf("dif_%s_%s.tar.gz", strtolower($themedetail['classname']), $theme->getVersion());
File_Archive::extract($tempPath, File_Archive::toArchive($filename, File_Archive::toOutput()));
Utils::removeRecursive($tempPath);
exit;
/*
$view = ViewManager::getInstance();
$url = new Url(true);
$url_back = clone $url;
$url_back->setParameter($view->getUrlId(), ViewManager::ADMIN_OVERVIEW);
$template->setVariable('href_back', $url_back->getUrl(true), false);
$theme->addBreadcrumb(array('name' => $themedetail['name'], 'path' => $url_back->getUrl(true)));
$theme->addBreadcrumb(array('name' => $view->getName(), 'path' => $url->getUrl(true)));
$this->template[$this->director->theme->getExport()->main_tag] = $template;
*/
}
示例4: catch
<?php
/**
* FIXME ... just fixme, like 99% of it. Count this as a draft or something.
*
*
*
* @package test
*
* Trying out File_Archive
*/
require_once '../../autoload.php';
try {
Module::require('File_Archive');
} catch (Exception $e) {
die('Script requires PEAR File_Archive to work.');
}
// Set cache dir for Cache Lite
$options = array('cacheDir' => 'tmp');
if (Module::isLoaded('Cache_Lite')) {
File_Archive::setOption('cache', new Cache_Lite($options));
}
File_Archive::setOption('zipCompressionLevel', 0);
// $files is an array of path to the files that must be added to the archive
File_Archive::extract($files, File_Archive::toArchive('myFiles.zip', File_Archive::toOutput()));
示例5: run
/**
* Execute action when called for explicitly by the user
*
* This function also contains the actions available in the interface provided, including file
* uploading, compressed file extraction and the creation of folders.
* @return void
*/
function run()
{
global $Templates, $USER, $Controller, $ID, $CONFIG;
/**
* User input types
*/
$_REQUEST->setType('action', 'string');
$_REQUEST->setType('popup', 'string');
$_REQUEST->setType('filter', 'string');
if (!$this->may($USER, READ)) {
errorPage(401);
} else {
if (!in_array($CMPRExtension = $CONFIG->files->compression_format, array('tar', 'gz', 'tgz', 'tbz', 'zip', 'ar', 'deb'))) {
$CONFIG->files->compression_format = $CMPRExtension = 'zip';
}
$render = true;
switch ($_REQUEST['action']) {
// All users
case 'download':
global $PREVENT_CSIZE_HEADER;
$PREVENT_CSIZE_HEADER = true;
while (ob_get_level()) {
echo ob_get_clean();
}
require_once "File/Archive.php";
File_Archive::extract($this->path, File_Archive::toArchive($this->filename . '.' . $CMPRExtension, File_Archive::toOutput()));
die;
default:
$this->setContent("main", $this->genHTML());
break;
}
if ($render) {
$t = 'admin';
if ($_REQUEST['popup']) {
$t = 'popup';
}
$Templates->{$t}->render();
}
}
}
示例6: cmdDownloadDoc
/**
* cmdDownloadDoc()
*
* @return void
*/
function cmdDownloadDoc()
{
File_Archive::extract(File_Archive::read(BLOCKEN_DOC_DIR), File_Archive::toArchive('BlockenDoc.zip', File_Archive::toOutput()));
}