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


PHP Folder::getStorage方法代码示例

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


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

示例1: init

 /**
  * Constructor for initializing the class
  *
  * @return 	void
  * @todo Define visibility
  */
 public function init()
 {
     // Initialize GPvars:
     $this->target = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target');
     $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl'));
     if (!$this->returnUrl) {
         $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('file_list') . '&id=' . rawurlencode($this->target);
     }
     // Create the folder object
     if ($this->target) {
         $this->folderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target);
     }
     // Cleaning and checking target directory
     if (!$this->folderObject) {
         $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE);
         $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE);
         throw new \RuntimeException($title . ': ' . $message, 1294586843);
     }
     // Setting the title and the icon
     $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root');
     $this->title = $icon . htmlspecialchars($this->folderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->folderObject->getIdentifier());
     // Setting template object
     $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
     $this->doc->setModuleTemplate('templates/file_upload.html');
     $this->doc->backPath = $GLOBALS['BACK_PATH'];
     $this->doc->form = '<form action="tce_file.php" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:33,代码来源:FileUploadController.php

示例2: init

 /**
  * Initialize
  *
  * @return void
  */
 protected function init()
 {
     // Initialize GPvars:
     $this->target = GeneralUtility::_GP('target');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     if (!$this->returnUrl) {
         $this->returnUrl = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . BackendUtility::getModuleUrl('file_list') . '&id=' . rawurlencode($this->target);
     }
     // Create the folder object
     if ($this->target) {
         $this->folderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target);
     }
     if ($this->folderObject->getStorage()->getUid() === 0) {
         throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException('You are not allowed to access folders outside your storages', 1375889834);
     }
     // Cleaning and checking target directory
     if (!$this->folderObject) {
         $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', true);
         $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', true);
         throw new \RuntimeException($title . ': ' . $message, 1294586843);
     }
     // Setting the title and the icon
     $icon = $this->iconFactory->getIcon('apps-filetree-root', Icon::SIZE_SMALL)->render();
     $this->title = $icon . htmlspecialchars($this->folderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->folderObject->getIdentifier());
     // Setting template object
     $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
     $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_upload.html');
     $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform" enctype="multipart/form-data">';
 }
开发者ID:hlop,项目名称:TYPO3.CMS,代码行数:34,代码来源:FileUploadController.php

示例3: init

 /**
  * Initialize
  *
  * @throws InsufficientFolderAccessPermissionsException
  */
 protected function init()
 {
     // Initialize GPvars:
     $this->target = GeneralUtility::_GP('target');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     if (!$this->returnUrl) {
         $this->returnUrl = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . BackendUtility::getModuleUrl('file_list') . '&id=' . rawurlencode($this->target);
     }
     // Create the folder object
     if ($this->target) {
         $this->folderObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target);
     }
     if ($this->folderObject->getStorage()->getUid() === 0) {
         throw new InsufficientFolderAccessPermissionsException('You are not allowed to access folders outside your storages', 1375889834);
     }
     // Cleaning and checking target directory
     if (!$this->folderObject) {
         $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', true);
         $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', true);
         throw new \RuntimeException($title . ': ' . $message, 1294586843);
     }
     // Setting up the context sensitive menu
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     // building pathInfo for metaInformation
     $pathInfo = ['combined_identifier' => $this->folderObject->getCombinedIdentifier()];
     $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pathInfo);
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:32,代码来源:FileUploadController.php

示例4: getFolderRecord

    /**
     * Get folder configuration record
     *
     * @param Folder $folder
     * @return array
     */
    public function getFolderRecord(Folder $folder)
    {
        if (!isset(self::$folderRecordCache[$folder->getCombinedIdentifier()]) || !array_key_exists($folder->getCombinedIdentifier(), self::$folderRecordCache)) {
            $record = $this->getDatabase()->exec_SELECTgetSingleRow('*', 'tx_falsecuredownload_folder', 'storage = ' . (int) $folder->getStorage()->getUid() . '
				AND folder_hash = ' . $this->getDatabase()->fullQuoteStr($folder->getHashedIdentifier(), 'tx_falsecuredownload_folder'));
            // cache results
            self::$folderRecordCache[$folder->getCombinedIdentifier()] = $record;
        }
        return self::$folderRecordCache[$folder->getCombinedIdentifier()];
    }
开发者ID:s-nunez,项目名称:fal_securedownload,代码行数:16,代码来源:Utility.php

示例5: getFolderName

 /**
  * Get main headline based on active folder or storage for backend module
  *
  * Folder names are resolved to their special names like done in the tree view.
  *
  * @param Folder $folder
  * @return string
  */
 protected function getFolderName(Folder $folder)
 {
     $name = $folder->getName();
     if ($name === '') {
         // Show storage name on storage root
         if ($folder->getIdentifier() === '/') {
             $name = $folder->getStorage()->getName();
         }
     } else {
         $name = key(ListUtility::resolveSpecialFolderNames(array($name => $folder)));
     }
     return $name;
 }
开发者ID:visol,项目名称:media,代码行数:21,代码来源:SelectedFolderInfo.php

示例6: init

    /**
     * Constructor function for class
     *
     * @return void
     * @todo Define visibility
     */
    public function init()
    {
        // Initialize GPvars:
        $this->number = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('number');
        $this->target = $combinedIdentifier = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target');
        $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl'));
        // create the folder object
        if ($combinedIdentifier) {
            $this->folderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier);
        }
        // Cleaning and checking target directory
        if (!$this->folderObject) {
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE);
            $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE);
            throw new \RuntimeException($title . ': ' . $message, 1294586843);
        }
        // Setting the title and the icon
        $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root');
        $this->title = $icon . htmlspecialchars($this->folderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->folderObject->getIdentifier());
        // Setting template object
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->setModuleTemplate('templates/file_newfolder.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->JScode = $this->doc->wrapScriptTags('
			var path = "' . $this->target . '";

			function reload(a) {	//
				if (!changed || (changed && confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')) . '))) {
					var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . rawurlencode($this->returnUrl) . '";
					window.location.href = "file_newfolder.php?"+params;
				}
			}
			function backToList() {	//
				top.goToModule("file_list");
			}

			var changed = 0;
		');
    }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:45,代码来源:CreateFolderController.php

示例7: findExistingFileByOnlineMediaId

 /**
  * Search for files with same onlineMediaId by content hash in indexed storage
  *
  * @param string $onlineMediaId
  * @param Folder $targetFolder
  * @param string $fileExtension
  * @return File|NULL
  */
 protected function findExistingFileByOnlineMediaId($onlineMediaId, Folder $targetFolder, $fileExtension)
 {
     $file = null;
     $fileHash = sha1($onlineMediaId);
     $files = $this->getFileIndexRepository()->findByContentHash($fileHash);
     if (!empty($files)) {
         foreach ($files as $fileIndexEntry) {
             if ($fileIndexEntry['folder_hash'] === $targetFolder->getHashedIdentifier() && (int) $fileIndexEntry['storage'] === $targetFolder->getStorage()->getUid() && $fileIndexEntry['extension'] === $fileExtension) {
                 $file = $this->getResourceFactory()->getFileObject($fileIndexEntry['uid'], $fileIndexEntry);
                 break;
             }
         }
     }
     return $file;
 }
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:23,代码来源:AbstractOnlineMediaHelper.php

示例8: getButtons

 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return array All available buttons as an assoc. array
  * @todo Define visibility
  */
 public function getButtons()
 {
     $buttons = array('csh' => '', 'shortcut' => '', 'upload' => '', 'new' => '');
     // Add shortcut
     if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
         $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
     }
     // FileList Module CSH:
     $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH'], '', TRUE);
     // Upload button (only if upload to this directory is allowed)
     if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) {
         $buttons['upload'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_upload.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) . '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" id="button-upload" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.upload', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-upload') . '</a>';
     }
     // New folder button
     if ($this->folderObject && $this->folderObject->checkActionPermission('write') && ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') || $this->folderObject->checkActionPermission('add'))) {
         $buttons['new'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_newfolder.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) . '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.new', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new') . '</a>';
     }
     return $buttons;
 }
开发者ID:samuweiss,项目名称:TYPO3-Site,代码行数:25,代码来源:FileListController.php

示例9: getButtons

 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return array All available buttons as an assoc. array
  */
 public function getButtons()
 {
     $buttons = array('csh' => '', 'shortcut' => '', 'upload' => '', 'new' => '');
     // Add shortcut
     if ($this->getBackendUser()->mayMakeShortcut()) {
         $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->moduleName);
     }
     // FileList Module CSH:
     $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'filelist_module');
     // Upload button (only if upload to this directory is allowed)
     if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) {
         $buttons['upload'] = '<a href="' . htmlspecialchars($GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('file_upload', array('target' => $this->folderObject->getCombinedIdentifier(), 'returnUrl' => $this->filelist->listURL()))) . '" id="button-upload" title="' . $this->getLanguageService()->makeEntities($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.upload', TRUE)) . '">' . IconUtility::getSpriteIcon('actions-edit-upload') . '</a>';
     }
     // New folder button
     if ($this->folderObject && $this->folderObject->checkActionPermission('write') && ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') || $this->folderObject->checkActionPermission('add'))) {
         $buttons['new'] = '<a href="' . htmlspecialchars($GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('file_newfolder', array('target' => $this->folderObject->getCombinedIdentifier(), 'returnUrl' => $this->filelist->listURL()))) . '" title="' . $this->getLanguageService()->makeEntities($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.new', TRUE)) . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a>';
     }
     return $buttons;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:24,代码来源:FileListController.php

示例10: init

    /**
     * Initialize
     *
     * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException
     */
    protected function init()
    {
        // Initialize GPvars:
        $this->target = GeneralUtility::_GP('target');
        $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
        // Cleaning and checking target
        if ($this->target) {
            $this->fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target);
        }
        if (!$this->fileOrFolderObject) {
            $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE);
            $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', TRUE);
            throw new \RuntimeException($title . ': ' . $message, 1294586844);
        }
        if ($this->fileOrFolderObject->getStorage()->getUid() === 0) {
            throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1375889840);
        }
        // If a folder should be renamed, AND the returnURL should go to the old directory name, the redirect is forced
        // so the redirect will NOT end in a error message
        // this case only happens if you select the folder itself in the foldertree and then use the clickmenu to
        // rename the folder
        if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
            $parsedUrl = parse_url($this->returnUrl);
            $queryParts = GeneralUtility::explodeUrl2Array(urldecode($parsedUrl['query']));
            if ($queryParts['id'] === $this->fileOrFolderObject->getCombinedIdentifier()) {
                $this->returnUrl = str_replace(urlencode($queryParts['id']), urlencode($this->fileOrFolderObject->getStorage()->getRootLevelFolder()->getCombinedIdentifier()), $this->returnUrl);
            }
        }
        // Setting icon and title
        $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root');
        $this->title = $icon . htmlspecialchars($this->fileOrFolderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileOrFolderObject->getIdentifier());
        // Setting template object
        $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_rename.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList() {	//
				top.goToModule("file_list");
			}
		');
    }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:46,代码来源:RenameFileController.php

示例11: init

 /**
  * Initialize
  *
  * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException
  */
 protected function init()
 {
     // Initialize GPvars:
     $this->target = GeneralUtility::_GP('target');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     // Cleaning and checking target
     if ($this->target) {
         $this->fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target);
     }
     if (!$this->fileOrFolderObject) {
         $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', true);
         $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', true);
         throw new \RuntimeException($title . ': ' . $message, 1294586844);
     }
     if ($this->fileOrFolderObject->getStorage()->getUid() === 0) {
         throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1375889840);
     }
     // If a folder should be renamed, AND the returnURL should go to the old directory name, the redirect is forced
     // so the redirect will NOT end in an error message
     // this case only happens if you select the folder itself in the foldertree and then use the clickmenu to
     // rename the folder
     if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
         $parsedUrl = parse_url($this->returnUrl);
         $queryParts = GeneralUtility::explodeUrl2Array(urldecode($parsedUrl['query']));
         if ($queryParts['id'] === $this->fileOrFolderObject->getCombinedIdentifier()) {
             $this->returnUrl = str_replace(urlencode($queryParts['id']), urlencode($this->fileOrFolderObject->getStorage()->getRootLevelFolder()->getCombinedIdentifier()), $this->returnUrl);
         }
     }
     // building pathInfo for metaInformation
     $pathInfo = ['combined_identifier' => $this->fileOrFolderObject->getCombinedIdentifier()];
     $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pathInfo);
     // Setting up the context sensitive menu
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     // Add javaScript
     $this->moduleTemplate->addJavaScriptCode('RenameFileInlineJavaScript', 'function backToList() {top.goToModule("file_FilelistList");}');
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:41,代码来源:RenameFileController.php

示例12: isWithinFolder

 /**
  * Checks if a resource (file or folder) is within the given folder
  *
  * @param Folder $folder
  * @param ResourceInterface $resource
  * @return bool
  * @throws \InvalidArgumentException
  */
 public function isWithinFolder(Folder $folder, ResourceInterface $resource)
 {
     if ($folder->getStorage() !== $this) {
         throw new \InvalidArgumentException('Given folder "' . $folder->getIdentifier() . '" is not part of this storage!', 1422709241);
     }
     if ($folder->getStorage() !== $resource->getStorage()) {
         return false;
     }
     return $this->driver->isWithin($folder->getIdentifier(), $resource->getIdentifier());
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:18,代码来源:ResourceStorage.php

示例13: TBE_dragNDrop

    /**
     * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
     * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
     *
     * @param Folder $folder The folder path to expand
     * @param string $extensionList List of file extensions to show
     * @return string HTML output
     */
    public function TBE_dragNDrop(Folder $folder, $extensionList = '')
    {
        if (!$folder) {
            return '';
        }
        $lang = $this->getLanguageService();
        if (!$folder->getStorage()->isPublic()) {
            // Print this warning if the folder is NOT a web folder
            return GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('noWebFolder'), $lang->getLL('files'), FlashMessage::WARNING)->render();
        }
        $out = '';
        // Read files from directory:
        $extensionList = $extensionList == '*' ? '' : $extensionList;
        $files = $this->getFilesInFolder($folder, $extensionList);
        $out .= $this->barheader(sprintf($lang->getLL('files') . ' (%s):', count($files)));
        $titleLen = (int) $this->getBackendUser()->uc['titleLen'];
        $picon = $this->iconFactory->getIcon('apps-filetree-folder-default', Icon::SIZE_SMALL)->render();
        $picon .= htmlspecialchars(GeneralUtility::fixed_lgd_cs(basename($folder->getName()), $titleLen));
        $out .= $picon . '<br />';
        // Init row-array:
        $lines = array();
        // Add "drag-n-drop" message:
        $infoText = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('findDragDrop'), '', FlashMessage::INFO)->render();
        $lines[] = '
			<tr>
				<td colspan="2">' . $infoText . '</td>
			</tr>';
        // Traverse files:
        foreach ($files as $fileObject) {
            // URL of image:
            $iUrl = GeneralUtility::rawurlencodeFP($fileObject->getPublicUrl(true));
            // Show only web-images
            $fileExtension = strtolower($fileObject->getExtension());
            if (GeneralUtility::inList('gif,jpeg,jpg,png', $fileExtension)) {
                $imgInfo = array($fileObject->getProperty('width'), $fileObject->getProperty('height'));
                $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
                $size = ' (' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
                $filenameAndIcon = '<span title="' . htmlspecialchars($fileObject->getName() . $size) . '">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() . '</span>';
                if (GeneralUtility::_GP('noLimit')) {
                    $maxW = 10000;
                    $maxH = 10000;
                } else {
                    $maxW = 380;
                    $maxH = 500;
                }
                $IW = $imgInfo[0];
                $IH = $imgInfo[1];
                if ($IW > $maxW) {
                    $IH = ceil($IH / $IW * $maxW);
                    $IW = $maxW;
                }
                if ($IH > $maxH) {
                    $IW = ceil($IW / $IH * $maxH);
                    $IH = $maxH;
                }
                // Make row:
                $lines[] = '
					<tr class="bgColor4">
						<td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
						<td nowrap="nowrap">' . ($imgInfo[0] != $IW ? '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('noLimit' => '1'))) . '" title="' . $lang->getLL('clickToRedrawFullSize', true) . '">' . $this->iconFactory->getIcon('status-dialog-warning', Icon::SIZE_SMALL)->render() . '</a>' : '') . $pDim . '&nbsp;</td>
					</tr>';
                $lines[] = '
					<tr>
						<td colspan="2"><img src="' . htmlspecialchars($iUrl) . '" data-htmlarea-file-uid="' . $fileObject->getUid() . '" width="' . htmlspecialchars($IW) . '" height="' . htmlspecialchars($IH) . '" border="1" alt="" /></td>
					</tr>';
                $lines[] = '
					<tr>
						<td colspan="2"><span style="width: 1px; height: 3px; display: inline-block;"></span></td>
					</tr>';
            }
        }
        // Finally, wrap all rows in a table tag:
        $out .= '


<!--
	Filelisting / Drag-n-drop
-->
			<table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
				' . implode('', $lines) . '
			</table>';
        return $out;
    }
开发者ID:hlop,项目名称:TYPO3.CMS,代码行数:91,代码来源:ElementBrowser.php

示例14: isWithin

 /**
  * Checks if a given object or identifier is within a container, e.g. if
  * a file or folder is within another folder.
  * This can e.g. be used to check for webmounts.
  *
  * @param \TYPO3\CMS\Core\Resource\Folder $container
  * @param mixed $content An object or an identifier to check
  * @return bool TRUE if $content is within $container, always FALSE if $container is not within this storage
  */
 public function isWithin(\TYPO3\CMS\Core\Resource\Folder $container, $content)
 {
     if ($container->getStorage() != $this->storage) {
         return FALSE;
     }
     if ($content instanceof \TYPO3\CMS\Core\Resource\FileInterface || $content instanceof \TYPO3\CMS\Core\Resource\Folder) {
         $content = $container->getIdentifier();
     }
     $folderPath = $container->getIdentifier();
     $content = '/' . ltrim($content, '/');
     return \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($content, $folderPath);
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:21,代码来源:LocalDriver.php

示例15: getLinkToParentFolder

 /**
  * If there is a parent folder and user has access to it, return an icon
  * which is linked to the filelist of the parent folder.
  *
  * @param Folder $currentFolder
  * @return string
  */
 protected function getLinkToParentFolder(Folder $currentFolder)
 {
     $levelUp = '';
     try {
         $currentStorage = $currentFolder->getStorage();
         $parentFolder = $currentFolder->getParentFolder();
         if ($parentFolder->getIdentifier() !== $currentFolder->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) {
             $levelUp = $this->linkWrapDir('<span title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', true) . '">' . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render() . '</span>', $parentFolder);
         }
     } catch (\Exception $e) {
     }
     return $levelUp;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:20,代码来源:FileList.php


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