当前位置: 首页>>代码示例>>PHP>>正文


PHP MOXMAN::getFile方法代码示例

本文整理汇总了PHP中MOXMAN::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP MOXMAN::getFile方法的具体用法?PHP MOXMAN::getFile怎么用?PHP MOXMAN::getFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MOXMAN的用法示例。


在下文中一共展示了MOXMAN::getFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 public function add($params)
 {
     if (MOXMAN::getConfig()->get('general.demo')) {
         throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
     }
     if (isset($params->paths) && is_array($params->paths)) {
         $paths = $params->paths;
         $files = MOXMAN_Util_Json::decode(MOXMAN::getUserStorage()->get("favorites.files", "[]"));
         // If files is larger then max size then crop it
         $max = intval(MOXMAN::getConfig()->get("favorites.max"));
         if (count($files) >= $max) {
             $files = array_slice($files, count($files) - $max);
         }
         for ($i = count($files) - 1; $i >= 0; $i--) {
             foreach ($files as $file) {
                 if ($file->path == $paths[$i]) {
                     array_splice($paths, $i, 1);
                     $i--;
                 }
             }
         }
         // Add new files
         foreach ($paths as $path) {
             $file = MOXMAN::getFile($path);
             $files[] = array("path" => $file->getPublicPath(), "size" => $file->getSize(), "isdir" => $file->isDirectory(), "mdate" => $file->getLastModified());
         }
         MOXMAN::getUserStorage()->put("favorites.files", MOXMAN_Util_Json::encode($files));
     }
     return true;
 }
开发者ID:shainmcalindon,项目名称:boothsgardenstudios,代码行数:30,代码来源:Plugin.php

示例2: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     $paths = $params->paths;
     $result = array();
     foreach ($paths as $path) {
         $file = MOXMAN::getFile($path);
         $config = $file->getConfig();
         if ($config->get('general.demo')) {
             throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
         }
         if (!$file->exists()) {
             throw new MOXMAN_Exception("Path doesn't exist: " . $file->getPublicPath(), MOXMAN_Exception::FILE_DOESNT_EXIST);
         }
         if (!$file->canWrite()) {
             throw new MOXMAN_Exception("No write access to file: " . $file->getPublicPath(), MOXMAN_Exception::NO_WRITE_ACCESS);
         }
         $filter = MOXMAN_Vfs_BasicFileFilter::createFromConfig($config);
         if ($filter->accept($file, $file->isFile()) !== MOXMAN_Vfs_BasicFileFilter::ACCEPTED) {
             throw new MOXMAN_Exception("Invalid file name for: " . $file->getPublicPath(), MOXMAN_Exception::INVALID_FILE_NAME);
         }
         $result[] = $this->fileToJson($file);
         if ($file->exists()) {
             $file->delete(true);
             $this->fireFileAction(MOXMAN_Core_FileActionEventArgs::DELETE, $file);
         }
     }
     return $result;
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:34,代码来源:DeleteCommand.php

示例3: addVideoMeta

 private function addVideoMeta(MOXMAN_Vfs_IFile $file, $metaData)
 {
     $fileName = $file->getName();
     $ext = strtolower(MOXMAN_Util_PathUtils::getExtension($fileName));
     if (preg_match('/^(mp4|ogv|webm)$/', $ext)) {
         $metaData->url_type = MOXMAN_Util_Mime::get($fileName);
         $name = substr($fileName, 0, strlen($fileName) - strlen($ext));
         // Alternative video formats
         $altExt = array("mp4", "ogv", "webm");
         foreach ($altExt as $altExt) {
             if ($ext != $altExt) {
                 $altFile = MOXMAN::getFile($file->getParent(), $name . $altExt);
                 if ($altFile->exists()) {
                     $metaData->alt_url = $altFile->getUrl();
                     break;
                 }
             }
         }
         // Alternative image format
         $altFile = MOXMAN::getFile($file->getParent(), $name . "jpg");
         if ($altFile->exists()) {
             $metaData->alt_img = $altFile->getUrl();
         }
     }
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:25,代码来源:FileInfoCommand.php

示例4: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     if (isset($params->path) && $params->path) {
         return $this->getPublicConfig(MOXMAN::getFile($params->path));
     }
     return $this->getPublicConfig();
 }
开发者ID:tremor-od,项目名称:pizza.loc,代码行数:13,代码来源:GetConfigCommand.php

示例5: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     $file = MOXMAN::getFile($params->path);
     $config = $file->getConfig();
     if ($config->get('general.demo')) {
         throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
     }
     if (!$file->canWrite()) {
         throw new MOXMAN_Exception("No write access to file: " . $file->getPublicPath(), MOXMAN_Exception::NO_WRITE_ACCESS);
     }
     if ($file->exists()) {
         throw new MOXMAN_Exception("File already exist: " . $file->getPublicPath(), MOXMAN_Exception::FILE_EXISTS);
     }
     $filter = MOXMAN_Vfs_CombinedFileFilter::createFromConfig($config, "createdir");
     if (!$filter->accept($file, false)) {
         throw new MOXMAN_Exception("Invalid file name for: " . $file->getPublicPath(), MOXMAN_Exception::INVALID_FILE_NAME);
     }
     if (isset($params->template)) {
         // TODO: Security audit this
         $templateFile = MOXMAN::getFile($params->template);
         if (!$templateFile->exists()) {
             throw new MOXMAN_Exception("Template file doesn't exists: " . $file->getPublicPath(), MOXMAN_Exception::FILE_DOESNT_EXIST);
         }
         $args = $this->fireBeforeTargetFileAction(MOXMAN_Vfs_FileActionEventArgs::COPY, $templateFile, $file);
         $file = $args->getTargetFile();
         $templateFile->copyTo($file);
         $this->fireTargetFileAction(MOXMAN_Vfs_FileActionEventArgs::COPY, $templateFile, $file);
     } else {
         $args = $this->fireBeforeFileAction(MOXMAN_Vfs_FileActionEventArgs::ADD, $file);
         $file = $args->getFile();
         $file->mkdir();
         $this->fireFileAction(MOXMAN_Vfs_FileActionEventArgs::ADD, $file);
     }
     return $this->fileToJson($file, true);
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:41,代码来源:CreateDirectoryCommand.php

示例6: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     $file = MOXMAN::getFile($params->path);
     $config = $file->getConfig();
     $resolution = $params->resolution;
     if ($config->get('general.demo')) {
         throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
     }
     $content = $this->getUrlContent($params->url, $config);
     // Fire before file action add event
     $args = $this->fireBeforeFileAction("add", $file, strlen($content));
     $file = $args->getFile();
     if (!$file->canWrite()) {
         throw new MOXMAN_Exception("No write access to file: " . $file->getPublicPath(), MOXMAN_Exception::NO_WRITE_ACCESS);
     }
     $filter = MOXMAN_Vfs_CombinedFileFilter::createFromConfig($config, "upload");
     if (!$filter->accept($file, true)) {
         throw new MOXMAN_Exception("Invalid file name for: " . $file->getPublicPath(), MOXMAN_Exception::INVALID_FILE_NAME);
     }
     if ($resolution == "rename") {
         $file = MOXMAN_Util_FileUtils::uniqueFile($file);
     } else {
         if ($resolution == "overwrite") {
             MOXMAN::getPluginManager()->get("core")->deleteFile($file);
         } else {
             throw new MOXMAN_Exception("To file already exist: " . $file->getPublicPath(), MOXMAN_Exception::FILE_EXISTS);
         }
     }
     $stream = $file->open(MOXMAN_Vfs_IFileStream::WRITE);
     $stream->write($content);
     $stream->close();
     $args = new MOXMAN_Vfs_FileActionEventArgs("add", $file);
     MOXMAN::getPluginManager()->get("core")->fire("FileAction", $args);
     return parent::fileToJson($file, true);
 }
开发者ID:robbie778,项目名称:dolphin.pro,代码行数:41,代码来源:ImportFromUrlCommand.php

示例7: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     $file = MOXMAN::getFile($params->path);
     $config = $file->getConfig();
     if ($config->get('general.demo')) {
         throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
     }
     if (!$file->canWrite()) {
         throw new MOXMAN_Exception("No write access to file: " . $file->getPublicPath(), MOXMAN_Exception::NO_WRITE_ACCESS);
     }
     $filter = MOXMAN_Vfs_CombinedFileFilter::createFromConfig($config, "edit");
     if ($filter->accept($file) !== MOXMAN_Vfs_CombinedFileFilter::ACCEPTED) {
         throw new MOXMAN_Exception("Invalid file name for: " . $file->getPublicPath(), MOXMAN_Exception::INVALID_FILE_NAME);
     }
     if ($file->exists()) {
         $file->delete(true);
     }
     // Write contents to file
     $stream = $file->open(MOXMAN_Vfs_IFileStream::WRITE);
     if ($stream) {
         $stream->write($params->content);
         $stream->close();
     }
     $this->fireFileAction(MOXMAN_Core_FileActionEventArgs::ADD, $file);
     return $this->fileToJson($file);
 }
开发者ID:vidalweb,项目名称:MoxieManager,代码行数:32,代码来源:PutFileContentsCommand.php

示例8: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     if (isset($params->paths)) {
         $result = array();
         foreach ($params->paths as $path) {
             $file = MOXMAN::getFile($path);
             $fileInfo = $this->fileToJson($file, true);
             $args = $this->fireCustomInfo(MOXMAN_Core_CustomInfoEventArgs::INSERT_TYPE, $file);
             $fileInfo->info = (object) $args->getInfo();
             if (isset($params->insert) && $params->insert) {
                 $this->fireFileAction(MOXMAN_Core_FileActionEventArgs::INSERT, $file);
             }
             $result[] = $fileInfo;
         }
     } else {
         $file = MOXMAN::getFile($params->path);
         $fileInfo = $this->fileToJson($file, true);
         $args = $this->fireCustomInfo(MOXMAN_Core_CustomInfoEventArgs::INSERT_TYPE, $file);
         $fileInfo->info = (object) $args->getInfo();
         if (isset($params->insert) && $params->insert) {
             $this->fireFileAction(MOXMAN_Core_FileActionEventArgs::INSERT, $file);
         }
         $result = $fileInfo;
     }
     return $result;
 }
开发者ID:GHarutyunyan,项目名称:cms,代码行数:32,代码来源:FileInfoCommand.php

示例9: processRequest

 /**
  * Process a request using the specified context.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $request = $httpContext->getRequest();
     $response = $httpContext->getResponse();
     $path = $request->get("path");
     $names = explode('/', $request->get("names", ""));
     $zipName = $request->get("zipname", "files.zip");
     if (count($names) === 1) {
         $file = MOXMAN::getFile(MOXMAN_Util_PathUtils::combine($path, $names[0]));
         $filter = MOXMAN_Vfs_CombinedFileFilter::createFromConfig(MOXMAN::getFile($path)->getConfig(), "download");
         if (!$filter->accept($file)) {
             throw new MOXMAN_Exception("Invalid file name for: " . $file->getPublicPath(), MOXMAN_Exception::INVALID_FILE_NAME);
         }
         if ($file->isFile()) {
             $response->sendFile($file, true);
             return;
         }
     }
     // Download multiple files as zip
     $zipWriter = new MOXMAN_Zip_ZipWriter(array("compressionLevel" => 0));
     // Setup download headers
     $response->disableCache();
     $response->setHeader("Content-type", "application/octet-stream");
     $response->setHeader("Content-Disposition", 'attachment; filename="' . $zipName . '"');
     $filter = MOXMAN_Vfs_CombinedFileFilter::createFromConfig(MOXMAN::getFile($path)->getConfig(), "download");
     // Combine files to zip
     foreach ($names as $name) {
         $fromFile = MOXMAN::getFile(MOXMAN_Util_PathUtils::combine($path, $name));
         $this->addZipFiles($fromFile, $fromFile->getParent(), $filter, $zipWriter);
     }
     $response->sendContent($zipWriter->toString());
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:37,代码来源:DownloadHandler.php

示例10: save

 /**
  * Executes the save command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 private function save($params)
 {
     $file = MOXMAN::getFile($params->path);
     $config = $file->getConfig();
     $size = 0;
     if ($config->get("general.demo")) {
         throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
     }
     if (!$file->canWrite()) {
         throw new MOXMAN_Exception("No write access to file: " . $file->getPublicPath(), MOXMAN_Exception::NO_WRITE_ACCESS);
     }
     $filter = MOXMAN_Vfs_CombinedFileFilter::createFromConfig($config, "edit");
     if (!$filter->accept($file)) {
         throw new MOXMAN_Exception("Invalid file name for: " . $file->getPublicPath(), MOXMAN_Exception::INVALID_FILE_NAME);
     }
     // Import temp file as target file
     if (isset($params->tempname)) {
         $tempFilePath = MOXMAN_Util_PathUtils::combine(MOXMAN_Util_PathUtils::getTempDir(), MOXMAN_Util_Sanitize::fileName($params->tempname));
         $size = filesize($tempFilePath);
         $file->importFrom($tempFilePath);
     }
     $args = $this->fireBeforeFileAction("add", $file, $size);
     $file = $args->getFile();
     MOXMAN::getFileSystemManager()->removeLocalTempFile($file);
     $this->fireFileAction(MOXMAN_Vfs_FileActionEventArgs::ADD, $file);
     return parent::fileToJson($file, true);
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:33,代码来源:AlterImageCommand.php

示例11: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     $paths = $params->paths;
     $result = array();
     foreach ($paths as $path) {
         if ($this->hasPath($result, $path)) {
             continue;
         }
         $file = MOXMAN::getFile($path);
         $config = $file->getConfig();
         if ($config->get('general.demo')) {
             throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
         }
         if (!$file->exists()) {
             throw new MOXMAN_Exception("Path doesn't exist: " . $file->getPublicPath(), MOXMAN_Exception::FILE_DOESNT_EXIST);
         }
         $parentFile = $file->getParentFile();
         if (!$parentFile || !$parentFile->canWrite()) {
             throw new MOXMAN_Exception("No write access to file: " . $file->getPublicPath(), MOXMAN_Exception::NO_WRITE_ACCESS);
         }
         $filter = MOXMAN_Vfs_CombinedFileFilter::createFromConfig($config, "delete");
         if (!$filter->accept($file)) {
             throw new MOXMAN_Exception("Invalid file name for: " . $file->getPublicPath(), MOXMAN_Exception::INVALID_FILE_NAME);
         }
         $result[] = $this->fileToJson($file);
         if ($file->exists()) {
             $args = $this->fireBeforeFileAction(MOXMAN_Vfs_FileActionEventArgs::DELETE, $file);
             $result = array_merge($result, $this->filesToJson($args->getFileList()));
             $file->delete(true);
             $args = $this->fireFileAction(MOXMAN_Vfs_FileActionEventArgs::DELETE, $file);
             $result = array_merge($result, $this->filesToJson($args->getFileList()));
         }
     }
     return $result;
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:41,代码来源:DeleteCommand.php

示例12: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     $toPath = $params->to;
     $ext = MOXMAN_Util_PathUtils::getExtension($toPath);
     if ($ext !== 'zip') {
         $toPath .= '.zip';
     }
     $toFile = MOXMAN::getFile($toPath);
     $config = $toFile->getConfig();
     if ($config->get('general.demo')) {
         throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
     }
     if (!$toFile->canWrite()) {
         throw new MOXMAN_Exception("No write access to file: " . $toFile->getPublicPath(), MOXMAN_Exception::NO_WRITE_ACCESS);
     }
     $zipWriter = new MOXMAN_Zip_ZipWriter(array("compressionLevel" => 5));
     $filter = MOXMAN_Vfs_BasicFileFilter::createFromConfig($config);
     $path = $params->path;
     foreach ($params->names as $name) {
         $fromFile = MOXMAN::getFile(MOXMAN_Util_PathUtils::combine($path, $name));
         $this->addZipFiles($fromFile, $fromFile->getParent(), $filter, $zipWriter);
     }
     $stream = $toFile->open(MOXMAN_Vfs_IFileStream::WRITE);
     if ($stream) {
         $stream->write($zipWriter->toString());
         $stream->close();
     }
     $this->fireFileAction(MOXMAN_Core_FileActionEventArgs::ADD, $toFile);
     return $this->fileToJson($toFile);
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:36,代码来源:ZipCommand.php

示例13: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     $file = MOXMAN::getFile($params->path);
     $url = parse_url($params->url);
     $config = $file->getConfig();
     if ($config->get('general.demo')) {
         throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
     }
     if ($file->exists()) {
         throw new MOXMAN_Exception("To file already exist: " . $file->getPublicPath(), MOXMAN_Exception::FILE_EXISTS);
     }
     if (!$file->canWrite()) {
         throw new MOXMAN_Exception("No write access to file: " . $file->getPublicPath(), MOXMAN_Exception::NO_WRITE_ACCESS);
     }
     $filter = MOXMAN_Vfs_CombinedFileFilter::createFromConfig($config, "upload");
     if (!$filter->accept($file, true)) {
         throw new MOXMAN_Exception("Invalid file name for: " . $file->getPublicPath(), MOXMAN_Exception::INVALID_FILE_NAME);
     }
     $port = "";
     if (isset($url["port"])) {
         $port = ":" . $url["port"];
     }
     $query = "";
     if (isset($url["query"])) {
         $query = "?" . $url["query"];
     }
     $path = $url["path"] . $query;
     $host = $url["scheme"] . "://" . $url["host"] . $port;
     $httpClient = new MOXMAN_Http_HttpClient($host);
     $request = $httpClient->createRequest($path);
     $response = $request->send();
     // Handle redirects
     $location = $response->getHeader("location");
     if ($location) {
         $httpClient->close();
         $httpClient = new MOXMAN_Http_HttpClient($location);
         $request = $httpClient->createRequest($location);
         $response = $request->send();
     }
     // Read file into ram
     // TODO: This should not happen if we know the file size
     $content = "";
     while (($chunk = $response->read()) != "") {
         $content .= $chunk;
     }
     $httpClient->close();
     // Fire before file action add event
     $args = $this->fireBeforeFileAction("add", $file, strlen($content));
     $file = $args->getFile();
     $stream = $file->open(MOXMAN_Vfs_IFileStream::WRITE);
     $stream->write($content);
     $stream->close();
     $args = new MOXMAN_Vfs_FileActionEventArgs("add", $file);
     MOXMAN::getPluginManager()->get("core")->fire("FileAction", $args);
     return parent::fileToJson($file, true);
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:62,代码来源:ImportFromUrlCommand.php

示例14: uniqueFile

 /**
  * Get an unique file
  *
  * @param MOXMAN_Vfs_IFile $file File object to check against
  * @return MOXMAN_Vfs_IFile Unique file object.
  */
 public static function uniqueFile(MOXMAN_Vfs_IFile $file)
 {
     $fileName = $file->getName();
     $ext = MOXMAN_Util_PathUtils::getExtension($fileName);
     for ($i = 2; $file->exists(); $i++) {
         if ($file->isFile() && $ext) {
             $file = MOXMAN::getFile($file->getParent(), basename($fileName, '.' . $ext) . '_' . $i . '.' . $ext);
         } else {
             $file = MOXMAN::getFile($file->getParent(), $fileName . '_' . $i);
         }
     }
     return $file;
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:19,代码来源:FileUtils.php

示例15: processRequest

 /**
  * Sends the specified file with the correct mime type back to the browser.
  * This method gets called from the client side using the stream file.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $request = $httpContext->getRequest();
     $response = $httpContext->getResponse();
     try {
         $file = MOXMAN::getFile($request->get("path"));
     } catch (Exception $e) {
         $response->setStatus("500", "Could not resolve path: " . $request->get("path"));
         if (MOXMAN::getLogger()) {
             MOXMAN::getLogger()->debug("Could not resolve path: " . $request->get("path"));
         }
         return;
     }
     // Create thumbnail
     if ($request->get("thumb")) {
         try {
             $file = $this->plugin->createThumbnail($file);
         } catch (Exception $e) {
             $response->setStatus("500", "Could not generate thumbnail.");
             $response->sendContent("Could not generate thumbnail.");
             return;
         }
     }
     // Fire before stream event
     $args = new MOXMAN_Vfs_StreamEventArgs($httpContext, $file);
     $this->plugin->fire("BeforeStream", $args);
     $file = $args->getFile();
     // Stream temp file if it exists
     if ($tempName = $request->get("tempname")) {
         $ext = MOXMAN_Util_PathUtils::getExtension($file->getName());
         $tempName = "mcic_" . md5(session_id() . $file->getName()) . "." . $ext;
         $tempFilePath = MOXMAN_Util_PathUtils::combine(MOXMAN_Util_PathUtils::getTempDir(), $tempName);
         if (file_exists($tempFilePath)) {
             $response->sendLocalFile($tempFilePath);
             return;
         }
     }
     $url = $file->getUrl();
     if ($url && !$request->get("stream", false)) {
         $response->redirect($url);
     } else {
         // Force 48h cache time
         $offset = 48 * 60 * 60;
         $response->setHeader("Cache-Control", "max-age=" . $offset);
         $response->setHeader("Date", gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
         $response->setHeader("Expires", gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
         $response->setHeader("Pragma", "public");
         $response->sendFile($file);
     }
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:56,代码来源:StreamFileHandler.php


注:本文中的MOXMAN::getFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。