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


PHP PublicFileManager::readFile方法代码示例

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


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

示例1: foreach


//.........这里部分代码省略.........
             $chronologicalNode =& XMLCustomWriter::createChildWithText($doc, $coverageNode, 'chronological', $chronological, false);
             if ($chronologicalNode) {
                 XMLCustomWriter::setAttribute($chronologicalNode, 'locale', $locale);
                 $isCoverageNecessary = true;
             }
             unset($chronologicalNode);
         }
     }
     if (is_array($article->getCoverageSample(null))) {
         foreach ($article->getCoverageSample(null) as $locale => $sample) {
             $sampleNode =& XMLCustomWriter::createChildWithText($doc, $coverageNode, 'sample', $sample, false);
             if ($sampleNode) {
                 XMLCustomWriter::setAttribute($sampleNode, 'locale', $locale);
                 $isCoverageNecessary = true;
             }
             unset($sampleNode);
         }
     }
     if ($isCoverageNecessary) {
         XMLCustomWriter::appendChild($indexingNode, $coverageNode);
         $isIndexingNecessary = true;
     }
     if ($isIndexingNecessary) {
         XMLCustomWriter::appendChild($root, $indexingNode);
     }
     /* --- */
     /* --- Authors --- */
     foreach ($article->getAuthors() as $author) {
         $authorNode =& NativeExportDom::generateAuthorDom($doc, $journal, $issue, $article, $author);
         XMLCustomWriter::appendChild($root, $authorNode);
         unset($authorNode);
     }
     /* --- */
     if (is_array($article->getShowCoverPage(null))) {
         foreach (array_keys($article->getShowCoverPage(null)) as $locale) {
             if ($article->getShowCoverPage($locale)) {
                 $coverNode =& XMLCustomWriter::createElement($doc, 'cover');
                 XMLCustomWriter::appendChild($root, $coverNode);
                 XMLCustomWriter::setAttribute($coverNode, 'locale', $locale);
                 XMLCustomWriter::createChildWithText($doc, $coverNode, 'altText', $issue->getCoverPageDescription($locale), false);
                 $coverFile = $article->getFileName($locale);
                 if ($coverFile != '') {
                     $imageNode =& XMLCustomWriter::createElement($doc, 'image');
                     XMLCustomWriter::appendChild($coverNode, $imageNode);
                     import('classes.file.PublicFileManager');
                     $publicFileManager = new PublicFileManager();
                     $coverPagePath = $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
                     $coverPagePath .= $coverFile;
                     $embedNode =& XMLCustomWriter::createChildWithText($doc, $imageNode, 'embed', base64_encode($publicFileManager->readFile($coverPagePath)));
                     XMLCustomWriter::setAttribute($embedNode, 'filename', $article->getOriginalFileName($locale));
                     XMLCustomWriter::setAttribute($embedNode, 'encoding', 'base64');
                     XMLCustomWriter::setAttribute($embedNode, 'mime_type', String::mime_content_type($coverPagePath));
                 }
                 unset($coverNode);
             }
         }
     }
     XMLCustomWriter::createChildWithText($doc, $root, 'pages', $article->getPages(), false);
     // NOTE that this is a required field for import, but it's
     // possible here to generate nonconforming XML via export b/c
     // of the potentially missing date_published node. This is due
     // to legacy data issues WRT an earlier lack of ability to
     // define article pub dates. Some legacy data will be missing
     // this date.
     XMLCustomWriter::createChildWithText($doc, $root, 'date_published', NativeExportDom::formatDate($article->getDatePublished()), false);
     if ($article->getAccessStatus() == ARTICLE_ACCESS_OPEN) {
         $accessNode =& XMLCustomWriter::createElement($doc, 'open_access');
         XMLCustomWriter::appendChild($root, $accessNode);
     }
     /* --- Permissions --- */
     $permissionsNode =& XMLCustomWriter::createElement($doc, 'permissions');
     XMLCustomWriter::appendChild($root, $permissionsNode);
     XMLCustomWriter::createChildWithText($doc, $permissionsNode, 'license_url', $article->getLicenseURL(), false);
     foreach ($article->getCopyrightHolder(null) as $locale => $copyrightHolder) {
         $copyrightHolderNode =& XMLCustomWriter::createChildWithText($doc, $permissionsNode, 'copyright_holder', $copyrightHolder, false);
         if ($copyrightHolderNode) {
             XMLCustomWriter::setAttribute($copyrightHolderNode, 'locale', $locale);
         }
         unset($copyrightHolderNode);
     }
     XMLCustomWriter::createChildWithText($doc, $permissionsNode, 'copyright_year', $article->getCopyrightYear(), false);
     /* --- */
     /* --- Galleys --- */
     foreach ($article->getGalleys() as $galley) {
         $galleyNode =& NativeExportDom::generateGalleyDom($doc, $journal, $issue, $article, $galley);
         if ($galleyNode !== null) {
             XMLCustomWriter::appendChild($root, $galleyNode);
         }
         unset($galleyNode);
     }
     /* --- Supplementary Files --- */
     foreach ($article->getSuppFiles() as $suppFile) {
         $suppNode =& NativeExportDom::generateSuppFileDom($doc, $journal, $issue, $article, $suppFile);
         if ($suppNode !== null) {
             XMLCustomWriter::appendChild($root, $suppNode);
         }
         unset($suppNode);
     }
     return $root;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:101,代码来源:NativeExportDom.inc.php

示例2: foreach


//.........这里部分代码省略.........
             }
             unset($subjectClassNode);
         }
     }
     $coverageNode =& XMLCustomWriter::createElement($doc, 'coverage');
     $isCoverageNecessary = false;
     if (is_array($article->getCoverageGeo(null))) {
         foreach ($article->getCoverageGeo(null) as $locale => $geographical) {
             $geographicalNode =& XMLCustomWriter::createChildWithText($doc, $coverageNode, 'geographical', $geographical, false);
             if ($geographicalNode) {
                 XMLCustomWriter::setAttribute($geographicalNode, 'locale', $locale);
                 $isCoverageNecessary = true;
             }
             unset($geographicalNode);
         }
     }
     if (is_array($article->getCoverageChron(null))) {
         foreach ($article->getCoverageChron(null) as $locale => $chronological) {
             $chronologicalNode =& XMLCustomWriter::createChildWithText($doc, $coverageNode, 'chronological', $chronological, false);
             if ($chronologicalNode) {
                 XMLCustomWriter::setAttribute($chronologicalNode, 'locale', $locale);
                 $isCoverageNecessary = true;
             }
             unset($chronologicalNode);
         }
     }
     if (is_array($article->getCoverageSample(null))) {
         foreach ($article->getCoverageSample(null) as $locale => $sample) {
             $sampleNode =& XMLCustomWriter::createChildWithText($doc, $coverageNode, 'sample', $sample, false);
             if ($sampleNode) {
                 XMLCustomWriter::setAttribute($sampleNode, 'locale', $locale);
                 $isCoverageNecessary = true;
             }
             unset($sampleNode);
         }
     }
     if ($isCoverageNecessary) {
         XMLCustomWriter::appendChild($indexingNode, $coverageNode);
         $isIndexingNecessary = true;
     }
     if ($isIndexingNecessary) {
         XMLCustomWriter::appendChild($root, $indexingNode);
     }
     /* --- */
     /* --- Authors --- */
     foreach ($article->getAuthors() as $author) {
         $authorNode =& NativeExportDom::generateAuthorDom($doc, $journal, $issue, $article, $author);
         XMLCustomWriter::appendChild($root, $authorNode);
         unset($authorNode);
     }
     /* --- */
     if (is_array($article->getShowCoverPage(null))) {
         foreach (array_keys($article->getShowCoverPage(null)) as $locale) {
             if ($article->getShowCoverPage($locale)) {
                 $coverNode =& XMLCustomWriter::createElement($doc, 'cover');
                 XMLCustomWriter::appendChild($root, $coverNode);
                 XMLCustomWriter::setAttribute($coverNode, 'locale', $locale);
                 XMLCustomWriter::createChildWithText($doc, $coverNode, 'altText', $issue->getCoverPageDescription($locale), false);
                 $coverFile = $article->getFileName($locale);
                 if ($coverFile != '') {
                     $imageNode =& XMLCustomWriter::createElement($doc, 'image');
                     XMLCustomWriter::appendChild($coverNode, $imageNode);
                     import('classes.file.PublicFileManager');
                     $publicFileManager = new PublicFileManager();
                     $coverPagePath = $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
                     $coverPagePath .= $coverFile;
                     $embedNode =& XMLCustomWriter::createChildWithText($doc, $imageNode, 'embed', base64_encode($publicFileManager->readFile($coverPagePath)));
                     XMLCustomWriter::setAttribute($embedNode, 'filename', $article->getOriginalFileName($locale));
                     XMLCustomWriter::setAttribute($embedNode, 'encoding', 'base64');
                     XMLCustomWriter::setAttribute($embedNode, 'mime_type', String::mime_content_type($coverPagePath));
                 }
                 unset($coverNode);
             }
         }
     }
     XMLCustomWriter::createChildWithText($doc, $root, 'pages', $article->getPages(), false);
     XMLCustomWriter::createChildWithText($doc, $root, 'date_published', NativeExportDom::formatDate($article->getDatePublished()), false);
     if ($article->getAccessStatus() == ARTICLE_ACCESS_OPEN) {
         $accessNode =& XMLCustomWriter::createElement($doc, 'open_access');
         XMLCustomWriter::appendChild($root, $accessNode);
     }
     /* --- */
     /* --- Galleys --- */
     foreach ($article->getGalleys() as $galley) {
         $galleyNode =& NativeExportDom::generateGalleyDom($doc, $journal, $issue, $article, $galley);
         if ($galleyNode !== null) {
             XMLCustomWriter::appendChild($root, $galleyNode);
         }
         unset($galleyNode);
     }
     /* --- Supplementary Files --- */
     foreach ($article->getSuppFiles() as $suppFile) {
         $suppNode =& NativeExportDom::generateSuppFileDom($doc, $journal, $issue, $article, $suppFile);
         if ($suppNode !== null) {
             XMLCustomWriter::appendChild($root, $suppNode);
         }
         unset($suppNode);
     }
     return $root;
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:101,代码来源:NativeExportDom.inc.php


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