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


PHP File::getParentFolder方法代码示例

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


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

示例1: downloadAction

 /**
  * Force download of the file.
  *
  * @param File $file
  * @param bool $forceDownload
  * @return bool|string
  */
 public function downloadAction(File $file, $forceDownload = FALSE)
 {
     if ($file->exists() && $file->getStorage()->isWithinFileMountBoundaries($file->getParentFolder())) {
         // Emit signal before downloading the file.
         $this->emitBeforeDownloadSignal($file);
         // Read the file and dump it with the flag "forceDownload" set to TRUE or FALSE.
         $file->getStorage()->dumpFileContents($file, $forceDownload);
         $result = TRUE;
     } else {
         $result = 'Access denied!';
     }
     return $result;
 }
开发者ID:visol,项目名称:media,代码行数:20,代码来源:AssetController.php

示例2: checkFileAccess

 /**
  * Check file access for given FeGroups combination
  *
  * @param \TYPO3\CMS\Core\Resource\File $file
  * @param bool|array $userFeGroups FALSE = no login, array() fe groups of user
  * @return bool
  */
 public function checkFileAccess($file, $userFeGroups)
 {
     // all files in public storage are accessible
     if ($file->getStorage()->isPublic()) {
         return true;
         // check folder access
     } elseif ($this->checkFolderRootLineAccess($file->getParentFolder(), $userFeGroups)) {
         // access to folder then check file privileges if present
         $feGroups = $file->getProperty('fe_groups');
         if ($feGroups !== '') {
             return $this->matchFeGroupsWithFeUser($feGroups, $userFeGroups);
         }
         return true;
     }
     return false;
 }
开发者ID:s-nunez,项目名称:fal_securedownload,代码行数:23,代码来源:CheckPermissions.php

示例3: getParentFolder

 /**
  * Returns the parent folder.
  *
  * @return FolderInterface
  */
 public function getParentFolder()
 {
     return $this->originalFile->getParentFolder();
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例4: listAction

 /**
  * @param File $image
  * @param File $listFolder
  * @param File $categoryFolder
  * @param int $listPage
  * @param int $categoryPage
  * @return string
  */
 public function listAction(File $image = null, File $listFolder = null, File $categoryFolder = null, $listPage = 1, $categoryPage = 1)
 {
     if ($this->configurationInvalid) {
         return $this->getErrorMessageForActionName('List');
     }
     $this->view->assign('currentImage', $image);
     $this->view->assign('currentCategoryPage', $categoryPage);
     $this->view->assign('currentCategoryFolder', $categoryFolder);
     // overwrite $selectedFolder when a image from category is clicked
     $selectedFolder = $this->selectedFolder;
     if ($listFolder !== null) {
         /** @var Folder $parentFolder */
         $parentFolder = $listFolder->getParentFolder();
         if ($this->folderIsInsideSelectedStorage($parentFolder)) {
             $selectedFolder = $parentFolder;
         }
     }
     // get all items to display
     $itemsToPaginate = $this->selectedStorage->getFilesInFolder($selectedFolder);
     $this->view->assign('currentListFolder', $this->getFolderImage($selectedFolder));
     $this->assignPaginationParams($itemsToPaginate, $listPage);
     if ($this->settings['list']['useLightBox']) {
         /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer */
         $contentObjectRenderer = $this->configurationManager->getContentObject();
         // lightbox rel attribute is taken from global constants, see typoscript setup
         $this->view->assign('lightboxRelAttribute', $contentObjectRenderer->cObjGetSingle($this->settings['lightboxRelAttribute']['_typoScriptNodeValue'], $this->settings['lightboxRelAttribute']));
     }
     // maxImageWidth is taken from tt_content, see typoscript setup
     $this->view->assign('maxImageWidth', $this->settings['maxImageWidth']['_typoScriptNodeValue']);
 }
开发者ID:vertexvaar,项目名称:fal_gallery,代码行数:38,代码来源:GalleryController.php

示例5: postFileReplace

 /**
  * A file is about to be added as a *replacement* of an existing
  * one.
  *
  * @param File $file
  * @param string $uploadedFileName
  * @return void
  */
 public function postFileReplace(File $file, $uploadedFileName)
 {
     $folder = $file->getParentFolder();
     $storageConfiguration = $folder->getStorage()->getConfiguration();
     $storageRecord = $folder->getStorage()->getStorageRecord();
     if ($storageRecord['driver'] !== 'Local') {
         // Unfortunately unsupported yet
         return;
     }
     $targetDirectory = $storageConfiguration['pathType'] === 'relative' ? PATH_site : '';
     $targetDirectory .= rtrim(rtrim($storageConfiguration['basePath'], '/') . $folder->getIdentifier(), '/');
     $targetFileName = $targetDirectory . '/' . $file->getName();
     $this->processFile($targetFileName, PathUtility::basename($targetFileName), $targetDirectory, $file);
     $this->populateMetadata($file, $folder);
 }
开发者ID:girardiv,项目名称:image_autoresize,代码行数:23,代码来源:FileUpload.php


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