本文整理汇总了PHP中TYPO3\CMS\Core\Resource\File::isMissing方法的典型用法代码示例。如果您正苦于以下问题:PHP File::isMissing方法的具体用法?PHP File::isMissing怎么用?PHP File::isMissing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Resource\File
的用法示例。
在下文中一共展示了File::isMissing方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: needsReprocessing
/**
* Checks if the ProcessedFile needs reprocessing
*
* @return bool
*/
public function needsReprocessing()
{
$fileMustBeRecreated = false;
// if original is missing we can not reprocess the file
if ($this->originalFile->isMissing()) {
return false;
}
// processedFile does not exist
if (!$this->usesOriginalFile() && !$this->exists()) {
$fileMustBeRecreated = true;
}
// hash does not match
if (array_key_exists('checksum', $this->properties) && $this->calculateChecksum() !== $this->properties['checksum']) {
$fileMustBeRecreated = true;
}
// original file changed
if ($this->originalFile->getSha1() !== $this->originalFileSha1) {
$fileMustBeRecreated = true;
}
if (!array_key_exists('uid', $this->properties)) {
$fileMustBeRecreated = true;
}
// remove outdated file
if ($fileMustBeRecreated && $this->exists()) {
$this->delete();
}
return $fileMustBeRecreated;
}
示例2: renderPreview
/**
* Render preview for current record
*
* @return string
*/
protected function renderPreview()
{
// Perhaps @TODO in future: Also display preview for records - without fileObject
if (!$this->fileObject) {
return;
}
$imageTag = '';
$downloadLink = '';
// check if file is marked as missing
if ($this->fileObject->isMissing()) {
$flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($this->fileObject);
$imageTag .= $flashMessage->render();
} else {
$fileExtension = $this->fileObject->getExtension();
$thumbUrl = '';
if (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
$thumbUrl = $this->fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => '400m', 'height' => '400m'))->getPublicUrl(TRUE);
}
// Create thumbnail image?
if ($thumbUrl) {
$imageTag .= '<img src="' . $thumbUrl . '" ' . 'alt="' . htmlspecialchars(trim($this->fileObject->getName())) . '" ' . 'title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" />';
}
// Display download link?
$url = $this->fileObject->getPublicUrl(TRUE);
if ($url) {
$downloadLink .= '<a href="' . htmlspecialchars($url) . '" target="_blank" class="t3-button">' . IconUtility::getSpriteIcon('actions-edit-download') . ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:download', TRUE) . '</a>';
}
}
return ($imageTag ? '<p>' . $imageTag . '</p>' : '') . ($downloadLink ? '<p>' . $downloadLink . '</p>' : '');
}
示例3: renderFileInformationContent
/**
* Renders a HTML Block with file information
*
* @param File $file
* @return string
*/
protected function renderFileInformationContent(File $file = null)
{
/** @var LanguageService $lang */
$lang = $GLOBALS['LANG'];
if ($file !== null) {
$processedFile = $file->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 150, 'height' => 150));
$previewImage = $processedFile->getPublicUrl(true);
$content = '';
if ($file->isMissing()) {
$flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($file);
$content .= $flashMessage->render();
}
if ($previewImage) {
$content .= '<img src="' . htmlspecialchars($previewImage) . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'alt="" class="t3-tceforms-sysfile-imagepreview" />';
}
$content .= '<strong>' . htmlspecialchars($file->getName()) . '</strong>';
$content .= ' (' . htmlspecialchars(GeneralUtility::formatSize($file->getSize())) . 'bytes)<br />';
$content .= BackendUtility::getProcessedValue('sys_file', 'type', $file->getType()) . ' (' . $file->getMimeType() . ')<br />';
$content .= $lang->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaDataLocation', true) . ': ';
$content .= htmlspecialchars($file->getStorage()->getName()) . ' - ' . htmlspecialchars($file->getIdentifier()) . '<br />';
$content .= '<br />';
} else {
$content = '<h2>' . $lang->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaErrorInvalidRecord', true) . '</h2>';
}
return $content;
}
示例4: getPreview
/**
* Get preview for current record
*
* @return array
*/
protected function getPreview() : array
{
$preview = [];
// Perhaps @todo in future: Also display preview for records - without fileObject
if (!$this->fileObject) {
return $preview;
}
// check if file is marked as missing
if ($this->fileObject->isMissing()) {
$preview['missingFile'] = $this->fileObject->getName();
} else {
/** @var \TYPO3\CMS\Core\Resource\Rendering\RendererRegistry $rendererRegistry */
$rendererRegistry = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Rendering\RendererRegistry::class);
$fileRenderer = $rendererRegistry->getRenderer($this->fileObject);
$fileExtension = $this->fileObject->getExtension();
$preview['url'] = $this->fileObject->getPublicUrl(true);
$width = '590m';
$heigth = '400m';
// Check if there is a FileRenderer
if ($fileRenderer !== null) {
$preview['fileRenderer'] = $fileRenderer->render($this->fileObject, $width, $heigth, [], true);
// else check if we can create an Image preview
} elseif (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
$preview['fileObject'] = $this->fileObject;
$preview['width'] = $width;
$preview['heigth'] = $heigth;
}
}
return $preview;
}
示例5: renderPreview
/**
* Render preview for current record
*
* @return string
*/
protected function renderPreview()
{
// Perhaps @todo in future: Also display preview for records - without fileObject
if (!$this->fileObject) {
return '';
}
$previewTag = '';
$showLink = '';
// check if file is marked as missing
if ($this->fileObject->isMissing()) {
$flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($this->fileObject);
$previewTag .= $flashMessage->render();
} else {
/** @var \TYPO3\CMS\Core\Resource\Rendering\RendererRegistry $rendererRegistry */
$rendererRegistry = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Rendering\RendererRegistry::class);
$fileRenderer = $rendererRegistry->getRenderer($this->fileObject);
$fileExtension = $this->fileObject->getExtension();
$url = $this->fileObject->getPublicUrl(true);
// Check if there is a FileRenderer
if ($fileRenderer !== null) {
$previewTag = $fileRenderer->render($this->fileObject, '590m', '400m', array(), true);
// else check if we can create an Image preview
} elseif (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
$processedFile = $this->fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => '590m', 'height' => '400m'));
// Create thumbnail image?
if ($processedFile) {
$thumbUrl = $processedFile->getPublicUrl(true);
$previewTag .= '<img class="img-responsive img-thumbnail" src="' . $thumbUrl . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'alt="' . htmlspecialchars(trim($this->fileObject->getName())) . '" ' . 'title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" />';
}
}
// Show
if ($url) {
$showLink .= '
<a class="btn btn-primary" href="' . htmlspecialchars($url) . '" target="_blank">
' . $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '
' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.show', true) . '
</a>';
}
}
return ($previewTag ? '<p>' . $previewTag . '</p>' : '') . ($showLink ? '<p>' . $showLink . '</p>' : '');
}