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


PHP FileManager::readFile方法代码示例

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


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

示例1: readFile

 /**
  * Read a file's contents.
  * @param $fileId integer
  * @param $revision integer
  * @param $output boolean output the file's contents instead of returning a string
  * @return boolean
  */
 function readFile($fileId, $revision = null, $output = false)
 {
     $monographFile =& MonographFileManager::_getFile($fileId, $revision);
     if (isset($monographFile)) {
         return parent::readFile($monographFile->getFilePath(), $output);
     } else {
         return false;
     }
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:16,代码来源:MonographFileManager.inc.php

示例2: readFile

 /**
  * Read a file's contents.
  * @param $output boolean output the file's contents instead of returning a string
  * @return boolean
  */
 function readFile($fileId, $userId, $output = false)
 {
     $temporaryFile =& $this->getFile($fileId, $userId);
     if (isset($temporaryFile)) {
         $filePath = $this->filesDir . $temporaryFile->getFileName();
         return parent::readFile($filePath, $output);
     } else {
         return false;
     }
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:15,代码来源:PKPTemporaryFileManager.inc.php

示例3: readFile

 /**
  * Read a file's contents.
  * @param $output boolean output the file's contents instead of returning a string
  * @return boolean
  */
 function readFile($fileId, $output = false)
 {
     $minutesFile =& $this->getFile($fileId);
     if (isset($minutesFile)) {
         $filePath = $this->filesDir . $minutesFile->getType() . '/' . $minutesFile->getFileName();
         return parent::readFile($filePath, $output);
     } else {
         return false;
     }
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:15,代码来源:MinutesFileManager.inc.php

示例4:

 function &createChildFromFile(&$doc, &$node, $name, $filename)
 {
     $contents =& FileManager::readFile($filename);
     if ($contents === false) {
         return null;
     }
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:7,代码来源:XMLCustomWriter.inc.php

示例5: downloadFile

 /**
  * Download a file.
  * Outputs HTTP headers and file content for download
  * @param $filePath string the location of the file to be sent
  * @param $mediaType string the MIME type of the file, optional
  * @param $inline print file as inline instead of attachment, optional
  * @return boolean
  */
 function downloadFile($filePath, $mediaType = null, $inline = false, $fileName = null)
 {
     $result = null;
     if (HookRegistry::call('FileManager::downloadFile', array(&$filePath, &$mediaType, &$inline, &$result, &$fileName))) {
         return $result;
     }
     if (is_readable($filePath)) {
         if ($mediaType === null) {
             // If the media type wasn't specified, try to detect.
             $mediaType = String::mime_content_type($filePath);
             if (empty($mediaType)) {
                 $mediaType = 'application/octet-stream';
             }
         }
         if ($fileName === null) {
             // If the filename wasn't specified, use the server-side.
             $fileName = basename($filePath);
         }
         Registry::clear();
         // Free some memory
         header("Content-Type: {$mediaType}");
         header('Content-Length: ' . filesize($filePath));
         header('Content-Disposition: ' . ($inline ? 'inline' : 'attachment') . "; filename=\"{$fileName}\"");
         header('Cache-Control: private');
         // Workarounds for IE weirdness
         header('Pragma: public');
         // Beware of converting to instance call
         // https://github.com/pkp/pkp-lib/commit/82f4a36db406ecac3eb88875541a74123e455713#commitcomment-1459396
         FileManager::readFile($filePath, true);
         return true;
     } else {
         return false;
     }
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:42,代码来源:FileManager.inc.php

示例6: generateArticleSuppFileDom

 /**
  *  Creates a METS:file for the Supplementary File
  *  checks if METS:FContent or METS:FLocat should be used
  */
 function generateArticleSuppFileDom(&$doc, &$root, &$article, &$suppFile, &$journal)
 {
     import('classes.file.PublicFileManager');
     import('lib.pkp.classes.file.FileManager');
     $fileManager = new FileManager();
     $contentWrapper = Request::getUserVar('contentWrapper');
     $mfile =& XMLCustomWriter::createElement($doc, 'METS:file');
     $filePath = MetsExportDom::getPublicFilePath($suppFile, '/supp/', $journal);
     $chkmd5return = md5_file($filePath);
     XMLCustomWriter::setAttribute($mfile, 'ID', 'SF' . $suppFile->getFileId() . '-A' . $suppFile->getArticleId());
     XMLCustomWriter::setAttribute($mfile, 'SIZE', $suppFile->getFileSize());
     XMLCustomWriter::setAttribute($mfile, 'MIMETYPE', $suppFile->getFileType());
     XMLCustomWriter::setAttribute($mfile, 'OWNERID', $suppFile->getFileName());
     XMLCustomWriter::setAttribute($mfile, 'CHECKSUM', $chkmd5return);
     XMLCustomWriter::setAttribute($mfile, 'CHECKSUMTYPE', 'MD5');
     if ($contentWrapper == 'FContent') {
         $fileContent =& $fileManager->readFile($filePath);
         $fContent =& XMLCustomWriter::createElement($doc, 'METS:FContent');
         $fNameNode =& XMLCustomWriter::createChildWithText($doc, $fContent, 'METS:binData', base64_encode($fileContent));
         XMLCustomWriter::appendChild($mfile, $fContent);
     } else {
         $fLocat =& XMLCustomWriter::createElement($doc, 'METS:FLocat');
         XMLCustomWriter::setAttribute($fLocat, 'xlink:href', Request::url($journal->getPath(), 'article', 'downloadSuppFile', array($suppFile->getArticleId(), $suppFile->getId())));
         XMLCustomWriter::setAttribute($fLocat, 'LOCTYPE', 'URL');
         XMLCustomWriter::appendChild($mfile, $fLocat);
     }
     XMLCustomWriter::appendChild($root, $mfile);
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:32,代码来源:MetsExportDom.inc.php

示例7: generateArticleSuppFileDom

 /**
  * Creates a METS:file for the Supplementary File
  * checks if METS:FContent or METS:FLocat should be used
  */
 function generateArticleSuppFileDom(&$doc, &$root, $article, &$suppFile)
 {
     import('classes.file.PublicFileManager');
     import('classes.file.FileManager');
     $contentWrapper = $this->getSetting($this->journalId, 'contentWrapper');
     $mfile =& XMLCustomWriter::createElement($doc, 'METS:file');
     $filePath = MetsExportDom::getPublicFilePath($suppFile, '/supp/');
     $chkmd5return = md5_file($filePath);
     XMLCustomWriter::setAttribute($mfile, 'ID', 'SF' . $suppFile->getFileId() . '-A' . $suppFile->getArticleId());
     XMLCustomWriter::setAttribute($mfile, 'SIZE', $suppFile->getFileSize());
     XMLCustomWriter::setAttribute($mfile, 'MIMETYPE', $suppFile->getFileType());
     XMLCustomWriter::setAttribute($mfile, 'OWNERID', $suppFile->getFileName());
     XMLCustomWriter::setAttribute($mfile, 'CHECKSUM', $chkmd5return);
     XMLCustomWriter::setAttribute($mfile, 'CHECKSUMTYPE', 'MD5');
     if ($contentWrapper == 'FContent') {
         $fileContent =& FileManager::readFile($filePath);
         $fContent =& XMLCustomWriter::createElement($doc, 'METS:FContent');
         $fNameNode =& XMLCustomWriter::createChildWithText($doc, $fContent, 'METS:binData', base64_encode($fileContent));
         XMLCustomWriter::appendChild($mfile, $fContent);
     } else {
         $fLocat =& XMLCustomWriter::createElement($doc, 'METS:FLocat');
         $fileUrl = MetsExportDom::getPublicSuppFileUrl($suppFile);
         XMLCustomWriter::setAttribute($fLocat, 'xlink:href', $fileUrl);
         XMLCustomWriter::setAttribute($fLocat, 'LOCTYPE', 'URL');
         XMLCustomWriter::appendChild($mfile, $fLocat);
     }
     XMLCustomWriter::appendChild($root, $mfile);
 }
开发者ID:philschatz,项目名称:ojs,代码行数:32,代码来源:MetsExportDom.inc.php

示例8: FileManager

 function &createChildFromFile(&$doc, &$node, $name, $filename)
 {
     $fileManager = new FileManager();
     $contents =& $fileManager->readFile($filename);
     if ($contents === false) {
         $nullVar = null;
         return $nullVar;
     }
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:9,代码来源:XMLCustomWriter.inc.php

示例9: downloadFile

 /**
  * Download a file.
  * Outputs HTTP headers and file content for download
  * @param $filePath string the location of the file to be sent
  * @param $mediaType string the MIME type of the file, optional
  * @param $inline print file as inline instead of attachment, optional
  * @return boolean
  */
 function downloadFile($filePath, $mediaType = null, $inline = false, $fileName = null)
 {
     $result = null;
     if (HookRegistry::call('FileManager::downloadFile', array(&$filePath, &$mediaType, &$inline, &$result, &$fileName))) {
         return $result;
     }
     $postDownloadHookList = array('FileManager::downloadFileFinished', 'UsageEventPlugin::getUsageEvent');
     if (is_readable($filePath)) {
         if ($mediaType === null) {
             // If the media type wasn't specified, try to detect.
             $mediaType = String::mime_content_type($filePath);
             if (empty($mediaType)) {
                 $mediaType = 'application/octet-stream';
             }
         }
         if ($fileName === null) {
             // If the filename wasn't specified, use the server-side.
             $fileName = basename($filePath);
         }
         $postDownloadHooks = null;
         $hooks = HookRegistry::getHooks();
         foreach ($postDownloadHookList as $hookName) {
             if (isset($hooks[$hookName])) {
                 $postDownloadHooks[$hookName] = $hooks[$hookName];
             }
         }
         unset($hooks);
         Registry::clear();
         // Stream the file to the end user.
         header("Content-Type: {$mediaType}");
         header('Content-Length: ' . filesize($filePath));
         header('Content-Disposition: ' . ($inline ? 'inline' : 'attachment') . "; filename=\"{$fileName}\"");
         header('Cache-Control: private');
         // Workarounds for IE weirdness
         header('Pragma: public');
         // Beware of converting to instance call
         // https://github.com/pkp/pkp-lib/commit/82f4a36db406ecac3eb88875541a74123e455713#commitcomment-1459396
         FileManager::readFile($filePath, true);
         if ($postDownloadHooks) {
             foreach ($postDownloadHooks as $hookName => $hooks) {
                 HookRegistry::setHooks($hookName, $hooks);
             }
         }
         $returner = true;
     } else {
         $returner = false;
     }
     HookRegistry::call('FileManager::downloadFileFinished', array(&$returner));
     return $returner;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:58,代码来源:FileManager.inc.php

示例10: readFile

 /**
  * Read a file's contents.
  * @param $output boolean output the file's contents instead of returning a string
  * @return boolean
  */
 function readFile($fileId, $revision = null, $output = false)
 {
     $paperFile =& $this->getFile($fileId, $revision);
     if (isset($paperFile)) {
         $fileType = $paperFile->getFileType();
         $filePath = $this->filesDir . $paperFile->getType() . '/' . $paperFile->getFileName();
         return parent::readFile($filePath, $output);
     } else {
         return false;
     }
 }
开发者ID:sedici,项目名称:ocs,代码行数:16,代码来源:PaperFileManager.inc.php

示例11: downloadFile

 /**
  * Download a file.
  * Outputs HTTP headers and file content for download
  * @param $filePath string the location of the file to be sent
  * @param $mediaType string the MIME type of the file, optional
  * @param $inline print file as inline instead of attachment, optional
  * @return boolean
  */
 function downloadFile($filePath, $mediaType = null, $inline = false)
 {
     $result = null;
     if (HookRegistry::call('FileManager::downloadFile', array(&$filePath, &$mediaType, &$inline, &$result))) {
         return $result;
     }
     if (is_readable($filePath)) {
         if ($mediaType == null) {
             $mediaType = String::mime_content_type($filePath);
             if (empty($mediaType)) {
                 $mediaType = 'application/octet-stream';
             }
         }
         Registry::clear();
         // Free some memory
         header("Content-Type: {$mediaType}");
         header("Content-Length: " . filesize($filePath));
         header("Content-Disposition: " . ($inline ? 'inline' : 'attachment') . "; filename=\"" . basename($filePath) . "\"");
         header("Cache-Control: private");
         // Workarounds for IE weirdness
         header("Pragma: public");
         import('lib.pkp.classes.file.FileManager');
         FileManager::readFile($filePath, true);
         return true;
     } else {
         return false;
     }
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:36,代码来源:FileManager.inc.php

示例12: readFile

 /**
  * Read a file's contents.
  * @param $output boolean output the file's contents instead of returning a string
  * @return boolean
  */
 function readFile($fileId, $revision = null, $output = false)
 {
     $articleFile =& $this->getFile($fileId, $revision);
     if (isset($articleFile)) {
         $filePath = $this->filesDir . $this->fileStageToPath($articleFile->getFileStage()) . '/' . $articleFile->getFileName();
         return parent::readFile($filePath, $output);
     } else {
         return false;
     }
 }
开发者ID:ramonsodoma,项目名称:ojs,代码行数:15,代码来源:ArticleFileManager.inc.php

示例13: downloadFile

 /**
  * Download a file.
  * Outputs HTTP headers and file content for download
  * @param $filePath string the location of the file to be sent
  * @param $type string the MIME type of the file, optional
  * @param $inline print file as inline instead of attachment, optional
  * @return boolean
  */
 function downloadFile($filePath, $type = null, $inline = false)
 {
     if (is_readable($filePath)) {
         if ($type == null) {
             $type = String::mime_content_type($filePath);
             if (empty($type)) {
                 $type = 'application/octet-stream';
             }
         }
         header("Content-Type: {$type}");
         header("Content-Length: " . filesize($filePath));
         header("Content-Disposition: " . ($inline ? 'inline' : 'attachment') . "; filename=\"" . basename($filePath) . "\"");
         header("Cache-Control: private");
         // Workarounds for IE weirdness
         header("Pragma: public");
         import('file.FileManager');
         FileManager::readFile($filePath, true);
         return true;
     } else {
         return false;
     }
 }
开发者ID:alenoosh,项目名称:ojs,代码行数:30,代码来源:FileManager.inc.php

示例14: downloadFile

 /**
  * Download a file.
  * Outputs HTTP headers and file content for download
  * @param $filePath string the location of the file to be sent
  * @param $type string the MIME type of the file, optional
  * @param $inline print file as inline instead of attachment, optional
  * @return boolean
  */
 function downloadFile($filePath, $type = null, $inline = false, $filename = null)
 {
     if (is_null($filename)) {
         $filename = basename($filePath);
     }
     $u_agent = $_SERVER['HTTP_USER_AGENT'];
     if (preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent) || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false) {
         $filename = iconv('utf8', 'big5', $filename);
     }
     //$filename = basename($filePath);
     $result = null;
     if (HookRegistry::call('FileManager::downloadFile', array(&$filePath, &$type, &$inline, &$result))) {
         return $result;
     }
     if (is_readable($filePath)) {
         if ($type == null) {
             $type = String::mime_content_type($filePath);
             if (empty($type)) {
                 $type = 'application/octet-stream';
             }
         }
         Registry::clear();
         // Free some memory
         header("Content-Type: {$type}");
         header("Content-Length: " . filesize($filePath));
         header("Content-Disposition: " . ($inline ? 'inline' : 'attachment') . "; filename=\"" . $filename . "\"");
         header("Cache-Control: private");
         // Workarounds for IE weirdness
         header("Pragma: public");
         import('file.FileManager');
         FileManager::readFile($filePath, true);
         return true;
     } else {
         return false;
     }
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:44,代码来源:FileManager.inc.php

示例15: save

 function save()
 {
     global $settings, $rules;
     $hasLeaguePref = mysql_fetch_object(mysql_query("SELECT f_lid from league_prefs where f_lid={$this->lid}"));
     if ($hasLeaguePref) {
         $query = "UPDATE league_prefs SET prime_tid={$this->p_tour}, league_name='" . mysql_real_escape_string($this->league_name) . "', forum_url='" . mysql_real_escape_string($this->forum_url) . "' , welcome='" . mysql_real_escape_string($this->welcome) . "' , rules='" . mysql_real_escape_string($this->rules) . "'  WHERE f_lid={$this->lid}";
     } else {
         $query = "INSERT INTO league_prefs (f_lid, prime_tid, second_tid, league_name, forum_url, welcome, rules) VALUE ({$this->lid}, {$this->p_tour}, {$this->s_tour}, '" . mysql_real_escape_string($this->league_name) . "', '" . mysql_real_escape_string($this->forum_url) . "', '" . mysql_real_escape_string($this->welcome) . "', '" . mysql_real_escape_string($this->rules) . "')";
     }
     FileManager::writeFile(FileManager::getCssDirectoryName() . "/league_override_{$this->lid}.css", $this->theme_css);
     $settingsFileContents = FileManager::readFile(FileManager::getSettingsDirectoryName() . "/settings_{$this->lid}.php");
     $settingsFileContents = preg_replace("/settings\\['stylesheet'\\]\\s*=\\s['A-Za-z0-9_]+/", "settings['stylesheet'] = {$this->core_theme_id}", $settingsFileContents);
     $settingsFileContents = preg_replace("/settings\\['lang'\\]\\s*=\\s['A-Za-z0-9_\\-]+/", "settings['lang'] = '{$this->language}'", $settingsFileContents);
     $settingsFileContents = preg_replace("/rules\\['initial_treasury'\\]\\s*=\\s['A-Za-z0-9_]+/", "rules['initial_treasury'] = {$this->tv}", $settingsFileContents);
     $settingsFileContents = preg_replace("/settings\\['core_rules_file'\\]\\s*=\\s[\\.\\/'A-Za-z0-9_]+/", "settings['core_rules_file'] = '{$this->core_rules_file}'", $settingsFileContents);
     FileManager::writeFile(FileManager::getSettingsDirectoryName() . "/settings_{$this->lid}.php", $settingsFileContents);
     $settings['stylesheet'] = $this->core_theme_id;
     $settings['lang'] = $this->language;
     $rules['initial_treasury'] = $this->tv;
     $settings['core_rules_file'] = $this->core_rules_file;
     return mysql_query($query);
 }
开发者ID:TheNAF,项目名称:naflm,代码行数:22,代码来源:class_league_pref.php


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