本文整理汇总了PHP中TYPO3\CMS\Core\Resource\FileInterface::getUid方法的典型用法代码示例。如果您正苦于以下问题:PHP FileInterface::getUid方法的具体用法?PHP FileInterface::getUid怎么用?PHP FileInterface::getUid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Resource\FileInterface
的用法示例。
在下文中一共展示了FileInterface::getUid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Create a link to a file that forces a download
*
* @param \TYPO3\CMS\Core\Resource\FileInterface $file
* @param bool $uriOnly
* @return string
*/
public function render(\TYPO3\CMS\Core\Resource\FileInterface $file, $uriOnly = FALSE)
{
$queryParameterArray = array('eID' => 'dumpFile', 't' => '');
if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
$queryParameterArray['f'] = $file->getUid();
$queryParameterArray['t'] = 'f';
} elseif ($file instanceof \TYPO3\CMS\Core\Resource\ProcessedFile) {
$queryParameterArray['p'] = $file->getUid();
$queryParameterArray['t'] = 'p';
}
$queryParameterArray['token'] = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac(implode('|', $queryParameterArray), 'resourceStorageDumpFile');
$queryParameterArray['download'] = '';
$uri = 'index.php?' . str_replace('+', '%20', http_build_query($queryParameterArray));
// Add absRefPrefix
if (!empty($GLOBALS['TSFE'])) {
$uri = $GLOBALS['TSFE']->absRefPrefix . $uri;
}
if ($uriOnly) {
return $uri;
}
$this->tag->addAttribute('href', $uri);
$this->tag->setContent($this->renderChildren());
$this->tag->forceClosingTag(TRUE);
return $this->tag->render();
}
示例2: generatePublicUrl
/**
* Generate public url for file
*
* @param Resource\ResourceStorage $storage
* @param Resource\Driver\DriverInterface $driver
* @param Resource\FileInterface $file
* @param $relativeToCurrentScript
* @param array $urlData
* @return void
*/
public function generatePublicUrl(Resource\ResourceStorage $storage, Resource\Driver\DriverInterface $driver, Resource\FileInterface $file, $relativeToCurrentScript, array $urlData)
{
// We only render special links for non-public files
if ($this->enabled && !$storage->isPublic()) {
$queryParameterArray = array('eID' => 'dumpFile', 't' => '');
if ($file instanceof Resource\File) {
$queryParameterArray['f'] = $file->getUid();
$queryParameterArray['t'] = 'f';
} elseif ($file instanceof Resource\ProcessedFile) {
$queryParameterArray['p'] = $file->getUid();
$queryParameterArray['t'] = 'p';
}
$queryParameterArray['token'] = GeneralUtility::hmac(implode('|', $queryParameterArray), 'BeResourceStorageDumpFile');
// $urlData['publicUrl'] is passed by reference, so we can change that here and the value will be taken into account
$urlData['publicUrl'] = BackendUtility::getAjaxUrl('FalSecuredownload::publicUrl', $queryParameterArray);
}
}
示例3: populateMetadata
public function populateMetadata(\TYPO3\CMS\Core\Resource\FileInterface $file, \TYPO3\CMS\Core\Resource\Folder $folder)
{
$qualities = GeneralUtility::makeInstance(CalculateService::class)->quality($file->getUid());
$message = '';
foreach ($qualities as $key => $value) {
$message .= $key . ' => ' . $value . "\n";
}
$this->flash($message);
}
示例4: findOneByOriginalFileAndTaskTypeAndConfiguration
/**
* @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\FileInterface $file
* @param string $taskType The task that should be executed on the file
* @param array $configuration
*
* @return ProcessedFile
*/
public function findOneByOriginalFileAndTaskTypeAndConfiguration(FileInterface $file, $taskType, array $configuration)
{
$databaseRow = $this->databaseConnection->exec_SELECTgetSingleRow('*', $this->table, 'original=' . (int) $file->getUid() . ' AND task_type=' . $this->databaseConnection->fullQuoteStr($taskType, $this->table) . ' AND configurationsha1=' . $this->databaseConnection->fullQuoteStr(sha1(serialize($configuration)), $this->table));
if (is_array($databaseRow)) {
$processedFile = $this->createDomainObject($databaseRow);
} else {
$processedFile = $this->createNewProcessedFileObject($file, $taskType, $configuration);
}
return $processedFile;
}