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


PHP File::getPublicUrl方法代码示例

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


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

示例1: 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>' : '');
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:35,代码来源:ElementInformationController.php

示例2: 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;
 }
开发者ID:,项目名称:,代码行数:35,代码来源:

示例3: getRelativePath

 /**
  * return relative to site root file path
  *
  * @return string Filepath (f.e. fileadmin/user_upload/)
  */
 public function getRelativePath()
 {
     if ($this->file !== NULL) {
         return dirname($this->file->getPublicUrl()) . '/';
     } else {
         return str_replace(PATH_site, '', $this->fileInfo['path']);
     }
 }
开发者ID:mneuhaus,项目名称:ke_search,代码行数:13,代码来源:class.tx_kesearch_lib_fileinfo.php

示例4: 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>' : '');
    }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:46,代码来源:ElementInformationController.php

示例5: export_addSysFile

 /**
  * Adds a files content from a sys file record to the export memory
  *
  * @param File $file
  * @return void
  */
 public function export_addSysFile(File $file)
 {
     if ($file->getProperty('size') >= $this->maxFileSize) {
         $this->error('File ' . $file->getPublicUrl() . ' was larger (' . GeneralUtility::formatSize($file->getProperty('size')) . ') than the maxFileSize (' . GeneralUtility::formatSize($this->maxFileSize) . ')! Skipping.');
         return;
     }
     $fileContent = '';
     try {
         if (!$this->saveFilesOutsideExportFile) {
             $fileContent = $file->getContents();
         } else {
             $file->checkActionPermission('read');
         }
     } catch (\Exception $e) {
         $this->error('Error when trying to add file ' . $file->getCombinedIdentifier() . ': ' . $e->getMessage());
         return;
     }
     $fileUid = $file->getUid();
     $fileInfo = $file->getStorage()->getFileInfo($file);
     // we sadly have to cast it to string here, because the size property is also returning a string
     $fileSize = (string) $fileInfo['size'];
     if ($fileSize !== $file->getProperty('size')) {
         $this->error('File size of ' . $file->getCombinedIdentifier() . ' is not up-to-date in index! File added with current size.');
         $this->dat['records']['sys_file:' . $fileUid]['data']['size'] = $fileSize;
     }
     $fileSha1 = $file->getStorage()->hashFile($file, 'sha1');
     if ($fileSha1 !== $file->getProperty('sha1')) {
         $this->error('File sha1 hash of ' . $file->getCombinedIdentifier() . ' is not up-to-date in index! File added on current sha1.');
         $this->dat['records']['sys_file:' . $fileUid]['data']['sha1'] = $fileSha1;
     }
     $fileRec = array();
     $fileRec['filesize'] = $fileSize;
     $fileRec['filename'] = $file->getProperty('name');
     $fileRec['filemtime'] = $file->getProperty('modification_date');
     // build unique id based on the storage and the file identifier
     $fileId = md5($file->getStorage()->getUid() . ':' . $file->getProperty('identifier_hash'));
     // Setting this data in the header
     $this->dat['header']['files_fal'][$fileId] = $fileRec;
     if (!$this->saveFilesOutsideExportFile) {
         // ... and finally add the heavy stuff:
         $fileRec['content'] = $fileContent;
     } else {
         GeneralUtility::upload_copy_move($file->getForLocalProcessing(false), $this->getTemporaryFilesPathForExport() . $file->getProperty('sha1'));
     }
     $fileRec['content_sha1'] = $fileSha1;
     $this->dat['files_fal'][$fileId] = $fileRec;
 }
开发者ID:franzholz,项目名称:TYPO3.CMS,代码行数:53,代码来源:ImportExport.php

示例6: makeEdit

 /**
  * Creates the edit control section
  *
  * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing.
  * @return string HTML-table
  */
 public function makeEdit($fileOrFolderObject)
 {
     $cells = array();
     $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
     // Edit file content (if editable)
     if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) {
         $url = BackendUtility::getModuleUrl('file_edit', array('target' => $fullIdentifier));
         $editOnClick = 'top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
         $cells['edit'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
     } else {
         $cells['edit'] = $this->spaceIcon;
     }
     if ($fileOrFolderObject instanceof File) {
         $fileUrl = $fileOrFolderObject->getPublicUrl(TRUE);
         if ($fileUrl) {
             $aOnClick = 'return top.openUrlInWindow(' . GeneralUtility::quoteJSvalue($fileUrl) . ', \'WebFile\');';
             $cells['view'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.view') . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
         } else {
             $cells['view'] = $this->spaceIcon;
         }
     } else {
         $cells['view'] = $this->spaceIcon;
     }
     // rename the file
     if ($fileOrFolderObject->checkActionPermission('rename')) {
         $url = BackendUtility::getModuleUrl('file_rename', array('target' => $fullIdentifier));
         $renameOnClick = 'top.content.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
         $cells['rename'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($renameOnClick) . '"  title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>';
     } else {
         $cells['rename'] = $this->spaceIcon;
     }
     if ($fileOrFolderObject->checkActionPermission('read')) {
         $infoOnClick = '';
         if ($fileOrFolderObject instanceof Folder) {
             $infoOnClick = 'top.launchView( \'_FOLDER\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
         } elseif ($fileOrFolderObject instanceof File) {
             $infoOnClick = 'top.launchView( \'_FILE\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
         }
         $cells['info'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($infoOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>';
     } else {
         $cells['info'] = $this->spaceIcon;
     }
     // delete the file
     if ($fileOrFolderObject->checkActionPermission('delete')) {
         $identifier = $fileOrFolderObject->getIdentifier();
         if ($fileOrFolderObject instanceof Folder) {
             $referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' (There are %s reference(s) to this folder!)');
         } else {
             $referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' (There are %s reference(s) to this file!)');
         }
         if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
             $confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')';
         } else {
             $confirmationCheck = '1 == 1';
         }
         $removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_file') . '&file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $this->getBackendUser()->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=') . '+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
         $cells['delete'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($removeOnClick) . '"  title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
     } else {
         $cells['delete'] = $this->spaceIcon;
     }
     // Hook for manipulating edit icons.
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
             $hookObject = GeneralUtility::getUserObj($classData);
             if (!$hookObject instanceof FileListEditIconHookInterface) {
                 throw new \UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface', 1235225797);
             }
             $hookObject->manipulateEditIcons($cells, $this);
         }
     }
     // Compile items into a DIV-element:
     return '<div class="btn-group">' . implode('', $cells) . '</div>';
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:79,代码来源:FileList.php

示例7: linkWrapFile

 /**
  * Wraps filenames in links which opens them in a window IF they are in web-path.
  *
  * @param string $code String to be wrapped in links
  * @param \TYPO3\CMS\Core\Resource\File $fileObject File to be linked
  * @return string HTML
  * @todo Define visibility
  */
 public function linkWrapFile($code, \TYPO3\CMS\Core\Resource\File $fileObject)
 {
     $fileUrl = $fileObject->getPublicUrl(TRUE);
     if ($fileUrl) {
         $aOnClick = 'return top.openUrlInWindow(\'' . $fileUrl . '\', \'WebFile\');';
         $code = '<a href="#" title="' . htmlspecialchars($code) . '" onclick="' . htmlspecialchars($aOnClick) . '">' . GeneralUtility::fixed_lgd_cs($code, $this->fixedL) . '</a>';
     }
     return $code;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:17,代码来源:FileList.php

示例8: getPublicUrl

 /**
  * Returns a publicly accessible URL for this file
  *
  * WARNING: Access to the file may be restricted by further means, e.g.
  * some web-based authentication. You have to take care of this yourself.
  *
  * @param bool  $relativeToCurrentScript   Determines whether the URL returned should be relative to the current script, in case it is relative at all (only for the LocalDriver)
  * @return string
  */
 public function getPublicUrl($relativeToCurrentScript = false)
 {
     return $this->originalFile->getPublicUrl($relativeToCurrentScript);
 }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例9: insertPlainImage

 /**
  * Insert a plain image
  *
  * @param \TYPO3\CMS\Core\Resource\File $fileObject: the image file
  * @param 	string		$altText: text for the alt attribute of the image
  * @param 	string		$titleText: text for the title attribute of the image
  * @param 	string		$additionalParams: text representing more HTML attributes to be added on the img tag
  * @return 	void
  */
 public function insertPlainImage(Resource\File $fileObject, $altText = '', $titleText = '', $additionalParams = '')
 {
     $width = $fileObject->getProperty('width');
     $height = $fileObject->getProperty('height');
     if (!$width || !$height) {
         $filePath = $fileObject->getForLocalProcessing(FALSE);
         $imageInfo = @getimagesize($filePath);
         $width = $imageInfo[0];
         $height = $imageInfo[1];
     }
     $imageUrl = $fileObject->getPublicUrl();
     // If file is local, make the url absolute
     if (substr($imageUrl, 0, 4) !== 'http') {
         $imageUrl = $this->siteURL . $imageUrl;
     }
     $this->imageInsertJS($imageUrl, $width, $height, $altText, $titleText, $additionalParams);
 }
开发者ID:rob-ot-dot-be,项目名称:ggallkeysecurity,代码行数:26,代码来源:SelectImage.php

示例10: export_addSysFile

 /**
  * Adds a files content from a sys file record to the export memory
  *
  * @param \TYPO3\CMS\Core\Resource\File $file
  * @return void
  */
 public function export_addSysFile(\TYPO3\CMS\Core\Resource\File $file)
 {
     if ($file->getProperty('size') >= $this->maxFileSize) {
         $this->error('File ' . $file->getPublicUrl() . ' was larger (' . GeneralUtility::formatSize($file->getProperty('size')) . ') than the maxFileSize (' . GeneralUtility::formatSize($this->maxFileSize) . ')! Skipping.');
         return;
     }
     try {
         $fileContent = $file->getContents();
     } catch (\TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException $e) {
         $this->error('File ' . $file->getPublicUrl() . ': ' . $e->getMessage());
         return;
     } catch (\TYPO3\CMS\Core\Resource\Exception\IllegalFileExtensionException $e) {
         $this->error('File ' . $file->getPublicUrl() . ': ' . $e->getMessage());
         return;
     }
     $fileUid = $file->getUid();
     $fileInfo = $file->getStorage()->getFileInfo($file);
     // we sadly have to cast it to string here, because the size property is also returning a string
     $fileSize = (string) $fileInfo['size'];
     if ($fileSize !== $file->getProperty('size')) {
         $this->error('File size of ' . $file->getCombinedIdentifier() . ' is not up-to-date in index! File added with current size.');
         $this->dat['records']['sys_file:' . $fileUid]['data']['size'] = $fileSize;
     }
     $fileSha1 = $file->getStorage()->hashFile($file, 'sha1');
     if ($fileSha1 !== $file->getProperty('sha1')) {
         $this->error('File sha1 hash of ' . $file->getCombinedIdentifier() . ' is not up-to-date in index! File added on current sha1.');
         $this->dat['records']['sys_file:' . $fileUid]['data']['sha1'] = $fileSha1;
     }
     $fileRec = array();
     $fileRec['filesize'] = $fileSize;
     $fileRec['filename'] = $file->getProperty('name');
     $fileRec['filemtime'] = $file->getProperty('modification_date');
     // build unique id based on the storage and the file identifier
     $fileId = md5($file->getStorage()->getUid() . ':' . $file->getProperty('identifier_hash'));
     // Setting this data in the header
     $this->dat['header']['files_fal'][$fileId] = $fileRec;
     // ... and finally add the heavy stuff:
     $fileRec['content'] = $fileContent;
     $fileRec['content_sha1'] = $fileSha1;
     $this->dat['files_fal'][$fileId] = $fileRec;
 }
开发者ID:samuweiss,项目名称:TYPO3-Site,代码行数:47,代码来源:ImportExport.php

示例11: makeEdit

 /**
  * Creates the edit control section
  *
  * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing.
  * @return string HTML-table
  */
 public function makeEdit($fileOrFolderObject)
 {
     $cells = [];
     $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
     // Edit file content (if editable)
     if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) {
         $url = BackendUtility::getModuleUrl('file_edit', ['target' => $fullIdentifier]);
         $editOnClick = 'top.list_frame.location.href=' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search);return false;';
         $cells['edit'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.editcontent') . '">' . $this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL)->render() . '</a>';
     } else {
         $cells['edit'] = $this->spaceIcon;
     }
     if ($fileOrFolderObject instanceof File) {
         $fileUrl = $fileOrFolderObject->getPublicUrl(true);
         if ($fileUrl) {
             $aOnClick = 'return top.openUrlInWindow(' . GeneralUtility::quoteJSvalue($fileUrl) . ', \'WebFile\');';
             $cells['view'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.view') . '">' . $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>';
         } else {
             $cells['view'] = $this->spaceIcon;
         }
     } else {
         $cells['view'] = $this->spaceIcon;
     }
     // replace file
     if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission('replace')) {
         $url = BackendUtility::getModuleUrl('file_replace', ['target' => $fullIdentifier, 'uid' => $fileOrFolderObject->getUid()]);
         $replaceOnClick = 'top.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search);return false;';
         $cells['replace'] = '<a href="#" class="btn btn-default" onclick="' . $replaceOnClick . '"  title="' . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.replace') . '">' . $this->iconFactory->getIcon('actions-edit-replace', Icon::SIZE_SMALL)->render() . '</a>';
     }
     // rename the file
     if ($fileOrFolderObject->checkActionPermission('rename')) {
         $url = BackendUtility::getModuleUrl('file_rename', ['target' => $fullIdentifier]);
         $renameOnClick = 'top.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search);return false;';
         $cells['rename'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($renameOnClick) . '"  title="' . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.rename') . '">' . $this->iconFactory->getIcon('actions-edit-rename', Icon::SIZE_SMALL)->render() . '</a>';
     } else {
         $cells['rename'] = $this->spaceIcon;
     }
     if ($fileOrFolderObject->checkActionPermission('read')) {
         $infoOnClick = '';
         if ($fileOrFolderObject instanceof Folder) {
             $infoOnClick = 'top.launchView( \'_FOLDER\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
         } elseif ($fileOrFolderObject instanceof File) {
             $infoOnClick = 'top.launchView( \'_FILE\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
         }
         $cells['info'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($infoOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.info') . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '</a>';
     } else {
         $cells['info'] = $this->spaceIcon;
     }
     // delete the file
     if ($fileOrFolderObject->checkActionPermission('delete')) {
         $identifier = $fileOrFolderObject->getIdentifier();
         if ($fileOrFolderObject instanceof Folder) {
             $referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.referencesToFolder'));
             $deleteType = 'delete_folder';
         } else {
             $referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.referencesToFile'));
             $deleteType = 'delete_file';
         }
         if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
             $confirmationCheck = '1';
         } else {
             $confirmationCheck = '0';
         }
         $deleteUrl = BackendUtility::getModuleUrl('tce_file');
         $confirmationMessage = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText;
         $title = $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.delete');
         $cells['delete'] = '<a href="#" class="btn btn-default t3js-filelist-delete" data-content="' . htmlspecialchars($confirmationMessage) . '" data-check="' . $confirmationCheck . '" data-delete-url="' . htmlspecialchars($deleteUrl) . '" data-title="' . htmlspecialchars($title) . '" data-identifier="' . htmlspecialchars($fileOrFolderObject->getCombinedIdentifier()) . '" data-veri-code="' . $this->getBackendUser()->veriCode() . '" data-delete-type="' . $deleteType . '" title="' . htmlspecialchars($title) . '">' . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
     } else {
         $cells['delete'] = $this->spaceIcon;
     }
     // Hook for manipulating edit icons.
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
         $cells['__fileOrFolderObject'] = $fileOrFolderObject;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
             $hookObject = GeneralUtility::getUserObj($classData);
             if (!$hookObject instanceof FileListEditIconHookInterface) {
                 throw new \UnexpectedValueException($classData . ' must implement interface ' . FileListEditIconHookInterface::class, 1235225797);
             }
             $hookObject->manipulateEditIcons($cells, $this);
         }
         unset($cells['__fileOrFolderObject']);
     }
     // Compile items into a DIV-element:
     return '<div class="btn-group">' . implode('', $cells) . '</div>';
 }
开发者ID:,项目名称:,代码行数:91,代码来源:


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