本文整理汇总了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;
}
示例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;
}
示例3: getParentFolder
/**
* Returns the parent folder.
*
* @return FolderInterface
*/
public function getParentFolder()
{
return $this->originalFile->getParentFolder();
}
示例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']);
}
示例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);
}