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


PHP GeneralUtility::formatSize方法代码示例

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


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

示例1: check

 public function check()
 {
     $checkFailed = '';
     $maxSize = intval($this->utilityFuncs->getSingle($this->settings['params'], 'maxSize'));
     $phpIniUploadMaxFileSize = $this->utilityFuncs->convertBytes(ini_get('upload_max_filesize'));
     if ($maxSize > $phpIniUploadMaxFileSize) {
         $this->utilityFuncs->throwException('error_check_filemaxsize', \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($maxSize, ' Bytes| KB| MB| GB'), $this->formFieldName, \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($phpIniUploadMaxFileSize, ' Bytes| KB| MB| GB'));
     }
     foreach ($_FILES as $sthg => &$files) {
         if (!is_array($files['name'][$this->formFieldName])) {
             $files['name'][$this->formFieldName] = array($files['name'][$this->formFieldName]);
         }
         if (strlen($files['name'][$this->formFieldName][0]) > 0 && $maxSize) {
             if (!is_array($files['size'][$this->formFieldName])) {
                 $files['size'][$this->formFieldName] = array($files['size'][$this->formFieldName]);
             }
             foreach ($files['size'][$this->formFieldName] as $size) {
                 if ($size > $maxSize) {
                     unset($files);
                     $checkFailed = $this->getCheckFailed();
                 }
             }
         }
     }
     return $checkFailed;
 }
开发者ID:mhuebe,项目名称:formhandler,代码行数:26,代码来源:Tx_Formhandler_ErrorCheck_FileMaxSize.php

示例2: maintenanceOverviewAction

 /**
  * Show the maintenance overview
  */
 public function maintenanceOverviewAction()
 {
     /**
      * Check if an update is available
      */
     if ($this->dbUpgradeUtility->getAvailableUpdateMethod() != '') {
         $this->forward('dbUpdateNeeded');
     }
     $itemRepository = $this->objectManager->get('Tx_Yag_Domain_Repository_ItemRepository');
     /* @var $itemRepository Tx_Yag_Domain_Repository_ItemRepository */
     $galleryCount = $this->objectManager->get('Tx_Yag_Domain_Repository_GalleryRepository')->countAll();
     $albumCount = $this->objectManager->get('Tx_Yag_Domain_Repository_AlbumRepository')->countAll();
     $itemCount = $itemRepository->countAll();
     $itemSizeSum = \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($itemRepository->getItemSizeSum());
     $includedCount = $this->objectManager->get('Tx_Yag_Domain_Repository_Extern_TTContentRepository')->countAllYagInstances();
     $firstItem = $itemRepository->getItemsAfterThisItem();
     if ($firstItem) {
         $firstItemUid = $firstItem->getUid();
     }
     $resolutionFileCache = Tx_Yag_Domain_FileSystem_ResolutionFileCacheFactory::getInstance();
     $this->view->assign('folderStatistics', array('galleryCount' => $galleryCount, 'albumCount' => $albumCount, 'itemCount' => $itemCount));
     $this->view->assign('globalStatistics', array('show' => $GLOBALS['BE_USER']->isAdmin(), 'itemSizeSum' => $itemSizeSum));
     $this->view->assign('firstItemUid', $firstItemUid);
     $this->view->assign('includedCount', $includedCount);
     $this->view->assign('resolutionFileCache', $resolutionFileCache);
 }
开发者ID:rabe69,项目名称:yag,代码行数:29,代码来源:BackendController.php

示例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;
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:32,代码来源:FileInfoHook.php

示例4: checkPostSize

 /**
  * Checks whether post_max_size
  *
  * @return void
  */
 protected function checkPostSize()
 {
     if ($this->returnBytes(ini_get('post_max_size')) < $this->returnBytes(ini_get('upload_max_filesize'))) {
         $this->reports[] = GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', 'Environment Variables', GeneralUtility::formatSize($this->returnBytes(ini_get('post_max_size'))), 'Your post_max_size value (' . ini_get('post_max_size') . ')  is smaller than upload_max_filesize (' . ini_get('upload_max_filesize') . '). This might lead to problems when uploading ZIP files or big images!', Status::WARNING);
     } else {
         $this->reports[] = GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', 'Environment Variables', GeneralUtility::formatSize($this->returnBytes(ini_get('post_max_size'))), 'Your post_max_size value (' . ini_get('post_max_size') . ') is equal or bigger than upload_max_filesize (' . ini_get('upload_max_filesize') . ')', Status::OK);
     }
 }
开发者ID:rabe69,项目名称:yag,代码行数:13,代码来源:EnvironmentVariables.php

示例5: processLogRecord

 /**
  * Processes a log record and adds memory usage information.
  *
  * @param \TYPO3\CMS\Core\Log\LogRecord $logRecord The log record to process
  * @return \TYPO3\CMS\Core\Log\LogRecord The processed log record with additional data
  * @see memory_get_usage()
  */
 public function processLogRecord(\TYPO3\CMS\Core\Log\LogRecord $logRecord)
 {
     $bytes = memory_get_usage($this->getRealMemoryUsage());
     if ($this->formatSize) {
         $size = \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($bytes);
     } else {
         $size = $bytes;
     }
     $logRecord->addData(array('memoryUsage' => $size));
     return $logRecord;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:18,代码来源:MemoryUsageProcessor.php

示例6: contentPostProc

 public function contentPostProc($_funcRef, $_params)
 {
     $nbQueries = $GLOBALS['TYPO3_DB']->profiling();
     $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['typo3profiler']);
     $logTS = $GLOBALS['TT']->printTSlog();
     $logTS = preg_replace('/src="typo3/', 'src="/typo3', $logTS);
     $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_typo3profiler_page', 'page=' . intval($GLOBALS['TSFE']->id));
     $GLOBALS['TYPO3_DB']->exec_INSERTQuery('tx_typo3profiler_page', array('pid' => 0, 'parsetime' => $GLOBALS['TSFE']->scriptParseTime, 'page' => $GLOBALS['TSFE']->id, 'logts' => $logTS, 'size' => \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(strlen($GLOBALS['TSFE']->content)), 'nocache' => $GLOBALS['TSFE']->no_cache ? 1 : 0, 'userint' => count($GLOBALS['TSFE']->config['INTincScript']), 'nbqueries' => $nbQueries));
     if ($conf['debugbarenabled'] == 1) {
         Typo3profiler_Utility_Debugbar::render();
     }
 }
开发者ID:Apen,项目名称:typo3profiler,代码行数:12,代码来源:class.user_typo3profiler_hooks.php

示例7: render

 /**
  * Get size from file
  *
  * @param boolean $format If true, file size will be formatted
  * @throws \TYPO3\CMS\Install\ViewHelpers\Exception
  * @return integer File size
  */
 public function render($format = TRUE)
 {
     $absolutePathToFile = $this->renderChildren();
     if (!is_file($absolutePathToFile)) {
         throw new \TYPO3\CMS\Install\ViewHelpers\Exception('File not found', 1369563246);
     }
     $size = filesize($absolutePathToFile);
     if ($format) {
         $size = GeneralUtility::formatSize($size);
     }
     return $size;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:19,代码来源:SizeViewHelper.php

示例8: renderStatic

 /**
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $format = $arguments['format'];
     $absolutePathToFile = $renderChildrenClosure();
     if (!is_file($absolutePathToFile)) {
         throw new \TYPO3\CMS\Install\ViewHelpers\Exception('File not found', 1369563246);
     }
     $size = filesize($absolutePathToFile);
     if ($format) {
         $size = GeneralUtility::formatSize($size);
     }
     return $size;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:20,代码来源:SizeViewHelper.php

示例9: render

 /**
  * Renders the size of a file using \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize
  *
  * @param string $file Path to the file
  * @param string $format Labels for bytes, kilo, mega and giga separated by vertical bar (|) and possibly encapsulated in "". Eg: " | K| M| G" (which is the default value)
  * @param boolean $hideError Define if an error should be displayed if file not found
  * @param integer $fileSize File size
  * @return string
  * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
  */
 public function render($file = NULL, $format = '', $hideError = FALSE, $fileSize = NULL)
 {
     if (!is_file($file)) {
         $errorMessage = sprintf('Given file "%s" for %s is not valid', htmlspecialchars($file), get_class());
         \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($errorMessage, 'news', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING);
         if (!$hideError) {
             throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException('Given file is not a valid file: ' . htmlspecialchars($file));
         }
     }
     if ($fileSize === NULL) {
         $result = \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(filesize($file), $format);
     } else {
         $result = \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($fileSize, $format);
     }
     return $result;
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:26,代码来源:FileSizeViewHelper.php

示例10: renderFileInfo

 /**
  * User function for sys_file (element)
  *
  * @param array $PA the array with additional configuration options.
  * @param \TYPO3\CMS\Backend\Form\FormEngine $tceformsObj the TCEforms parent object
  * @return string The HTML code for the TCEform field
  */
 public function renderFileInfo(array $PA, \TYPO3\CMS\Backend\Form\FormEngine $tceformsObj)
 {
     $fileRecord = $PA['row'];
     if ($fileRecord['uid'] > 0) {
         $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObject($fileRecord['uid']);
         $processedFile = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 150, 'height' => 150));
         $previewImage = $processedFile->getPublicUrl(TRUE);
         $content = '';
         if ($previewImage) {
             $content .= '<img src="' . htmlspecialchars($previewImage) . '" alt="" class="t3-tceforms-sysfile-imagepreview" />';
         }
         $content .= '<strong>' . htmlspecialchars($fileObject->getName()) . '</strong> (' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($fileObject->getSize())) . ')<br />';
         $content .= \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue($PA['table'], 'type', $fileObject->getType()) . ' (' . $fileObject->getMimeType() . ')<br />';
         $content .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaDataLocation', TRUE) . ': ' . htmlspecialchars($fileObject->getStorage()->getName()) . ' - ' . htmlspecialchars($fileObject->getIdentifier()) . '<br />';
         $content .= '<br />';
     } else {
         $content = '<h2>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaErrorInvalidRecord', TRUE) . '</h2>';
     }
     return $content;
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:27,代码来源:FileInfoHook.php

示例11: getPhpPeakMemoryStatus

 /**
  * Checks if there was a request in the past which approached the memory limit
  *
  * @return \TYPO3\CMS\Reports\Status A status of whether the memory limit was approached by one of the requests
  */
 protected function getPhpPeakMemoryStatus()
 {
     /** @var $registry \TYPO3\CMS\Core\Registry */
     $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
     $peakMemoryUsage = $registry->get('core', 'reports-peakMemoryUsage');
     $memoryLimit = \TYPO3\CMS\Core\Utility\GeneralUtility::getBytesFromSizeMeasurement(ini_get('memory_limit'));
     $value = $GLOBALS['LANG']->getLL('status_ok');
     $message = '';
     $severity = \TYPO3\CMS\Reports\Status::OK;
     $bytesUsed = $peakMemoryUsage['used'];
     $percentageUsed = $memoryLimit ? number_format($bytesUsed / $memoryLimit * 100, 1) . '%' : '?';
     $dateOfPeak = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $peakMemoryUsage['tstamp']);
     $urlOfPeak = '<a href="' . htmlspecialchars($peakMemoryUsage['url']) . '">' . htmlspecialchars($peakMemoryUsage['url']) . '</a>';
     $clearFlagUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '&amp;adminCmd=clear_peak_memory_usage_flag';
     if ($peakMemoryUsage['used']) {
         $message = sprintf($GLOBALS['LANG']->getLL('status_phpPeakMemoryTooHigh'), \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($peakMemoryUsage['used']), $percentageUsed, \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($memoryLimit), $dateOfPeak, $urlOfPeak);
         $message .= ' <a href="' . $clearFlagUrl . '">' . $GLOBALS['LANG']->getLL('status_phpPeakMemoryClearFlag') . '</a>.';
         $severity = \TYPO3\CMS\Reports\Status::WARNING;
         $value = $percentageUsed;
     }
     return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_phpPeakMemory'), $value, $message, $severity);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:27,代码来源:SystemStatus.php

示例12: stdWrap_bytes

 /**
  * bytes
  * Will return the size of a given number in Bytes	 *
  *
  * @param string $content Input value undergoing processing in this function.
  * @param array $conf stdWrap properties for bytes.
  * @return string The processed input value
  */
 public function stdWrap_bytes($content = '', $conf = array())
 {
     return GeneralUtility::formatSize($content, $conf['bytes.']['labels'], $conf['bytes.']['base']);
 }
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:12,代码来源:ContentObjectRenderer.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
     * @todo Define visibility
     */
    public function TBE_dragNDrop(Folder $folder, $extensionList = '')
    {
        if (!$folder) {
            return '';
        }
        if (!$folder->getStorage()->isPublic()) {
            // Print this warning if the folder is NOT a web folder
            return $this->barheader($GLOBALS['LANG']->getLL('files')) . $this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'), 'icon_warning2');
        }
        $out = '';
        // Read files from directory:
        $extensionList = $extensionList == '*' ? '' : $extensionList;
        $files = $this->getFilesInFolder($folder, $extensionList);
        $out .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('files') . ' (%s):', count($files)));
        $titleLen = (int) $GLOBALS['BE_USER']->uc['titleLen'];
        $picon = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
        $picon .= htmlspecialchars(GeneralUtility::fixed_lgd_cs(basename($folder->getName()), $titleLen));
        $out .= $picon . '<br />';
        // Init row-array:
        $lines = array();
        // Add "drag-n-drop" message:
        $lines[] = '
			<tr>
				<td colspan="2">' . $this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')) . '</td>
			</tr>';
        // Traverse files:
        foreach ($files as $fileObject) {
            $fileInfo = $fileObject->getStorage()->getFileInfo($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 = IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileObject->getName() . $size));
                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'))) . '">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/icon_warning2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('clickToRedrawFullSize', TRUE) . '" alt="" />' . '</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"><img src="clear.gif" width="1" height="3" alt="" /></td>
					</tr>';
            }
        }
        // Finally, wrap all rows in a table tag:
        $out .= '


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

示例14: substituteValues

 /**
  * Substitute makers in the message text
  * Overrides the abstract
  *
  * @param string $message Message text with markers
  * @return string Message text with substituted markers
  */
 protected function substituteValues($message)
 {
     $message = str_replace('%maximum', \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($this->maximum), $message);
     return $message;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:12,代码来源:FileMaximumSizeValidator.php

示例15: export_addFile

 /**
  * Adds a files content to the export memory
  *
  * @param array $fI File information with three keys: "filename" = filename without path, "ID_absFile" = absolute filepath to the file (including the filename), "ID" = md5 hash of "ID_absFile". "relFileName" is optional for files attached to records, but mandatory for soft referenced files (since the relFileName determines where such a file should be stored!)
  * @param string $recordRef If the file is related to a record, this is the id on the form [table]:[id]. Information purposes only.
  * @param string $fieldname If the file is related to a record, this is the field name it was related to. Information purposes only.
  * @return void
  */
 public function export_addFile($fI, $recordRef = '', $fieldname = '')
 {
     if (!@is_file($fI['ID_absFile'])) {
         $this->error($fI['ID_absFile'] . ' was not a file! Skipping.');
         return;
     }
     if (filesize($fI['ID_absFile']) >= $this->maxFileSize) {
         $this->error($fI['ID_absFile'] . ' was larger (' . GeneralUtility::formatSize(filesize($fI['ID_absFile'])) . ') than the maxFileSize (' . GeneralUtility::formatSize($this->maxFileSize) . ')! Skipping.');
         return;
     }
     $fileInfo = stat($fI['ID_absFile']);
     $fileRec = array();
     $fileRec['filesize'] = $fileInfo['size'];
     $fileRec['filename'] = PathUtility::basename($fI['ID_absFile']);
     $fileRec['filemtime'] = $fileInfo['mtime'];
     //for internal type file_reference
     $fileRec['relFileRef'] = PathUtility::stripPathSitePrefix($fI['ID_absFile']);
     if ($recordRef) {
         $fileRec['record_ref'] = $recordRef . '/' . $fieldname;
     }
     if ($fI['relFileName']) {
         $fileRec['relFileName'] = $fI['relFileName'];
     }
     // Setting this data in the header
     $this->dat['header']['files'][$fI['ID']] = $fileRec;
     // ... and for the recordlisting, why not let us know WHICH relations there was...
     if ($recordRef && $recordRef !== '_SOFTREF_') {
         $refParts = explode(':', $recordRef, 2);
         if (!is_array($this->dat['header']['records'][$refParts[0]][$refParts[1]]['filerefs'])) {
             $this->dat['header']['records'][$refParts[0]][$refParts[1]]['filerefs'] = array();
         }
         $this->dat['header']['records'][$refParts[0]][$refParts[1]]['filerefs'][] = $fI['ID'];
     }
     $fileMd5 = md5_file($fI['ID_absFile']);
     if (!$this->saveFilesOutsideExportFile) {
         // ... and finally add the heavy stuff:
         $fileRec['content'] = GeneralUtility::getUrl($fI['ID_absFile']);
     } else {
         GeneralUtility::upload_copy_move($fI['ID_absFile'], $this->getTemporaryFilesPathForExport() . $fileMd5);
     }
     $fileRec['content_md5'] = $fileMd5;
     $this->dat['files'][$fI['ID']] = $fileRec;
     // For soft references, do further processing:
     if ($recordRef === '_SOFTREF_') {
         // RTE files?
         if ($RTEoriginal = $this->getRTEoriginalFilename(PathUtility::basename($fI['ID_absFile']))) {
             $RTEoriginal_absPath = PathUtility::dirname($fI['ID_absFile']) . '/' . $RTEoriginal;
             if (@is_file($RTEoriginal_absPath)) {
                 $RTEoriginal_ID = md5($RTEoriginal_absPath);
                 $fileInfo = stat($RTEoriginal_absPath);
                 $fileRec = array();
                 $fileRec['filesize'] = $fileInfo['size'];
                 $fileRec['filename'] = PathUtility::basename($RTEoriginal_absPath);
                 $fileRec['filemtime'] = $fileInfo['mtime'];
                 $fileRec['record_ref'] = '_RTE_COPY_ID:' . $fI['ID'];
                 $this->dat['header']['files'][$fI['ID']]['RTE_ORIG_ID'] = $RTEoriginal_ID;
                 // Setting this data in the header
                 $this->dat['header']['files'][$RTEoriginal_ID] = $fileRec;
                 $fileMd5 = md5_file($RTEoriginal_absPath);
                 if (!$this->saveFilesOutsideExportFile) {
                     // ... and finally add the heavy stuff:
                     $fileRec['content'] = GeneralUtility::getUrl($RTEoriginal_absPath);
                 } else {
                     GeneralUtility::upload_copy_move($RTEoriginal_absPath, $this->getTemporaryFilesPathForExport() . $fileMd5);
                 }
                 $fileRec['content_md5'] = $fileMd5;
                 $this->dat['files'][$RTEoriginal_ID] = $fileRec;
             } else {
                 $this->error('RTE original file "' . PathUtility::stripPathSitePrefix($RTEoriginal_absPath) . '" was not found!');
             }
         }
         // Files with external media?
         // This is only done with files grabbed by a softreference parser since it is deemed improbable that hard-referenced files should undergo this treatment.
         $html_fI = pathinfo(PathUtility::basename($fI['ID_absFile']));
         if ($this->includeExtFileResources && GeneralUtility::inList($this->extFileResourceExtensions, strtolower($html_fI['extension']))) {
             $uniquePrefix = '###' . md5($GLOBALS['EXEC_TIME']) . '###';
             if (strtolower($html_fI['extension']) === 'css') {
                 $prefixedMedias = explode($uniquePrefix, preg_replace('/(url[[:space:]]*\\([[:space:]]*["\']?)([^"\')]*)(["\']?[[:space:]]*\\))/i', '\\1' . $uniquePrefix . '\\2' . $uniquePrefix . '\\3', $fileRec['content']));
             } else {
                 // html, htm:
                 $htmlParser = GeneralUtility::makeInstance(HtmlParser::class);
                 $prefixedMedias = explode($uniquePrefix, $htmlParser->prefixResourcePath($uniquePrefix, $fileRec['content'], array(), $uniquePrefix));
             }
             $htmlResourceCaptured = false;
             foreach ($prefixedMedias as $k => $v) {
                 if ($k % 2) {
                     $EXTres_absPath = GeneralUtility::resolveBackPath(PathUtility::dirname($fI['ID_absFile']) . '/' . $v);
                     $EXTres_absPath = GeneralUtility::getFileAbsFileName($EXTres_absPath);
                     if ($EXTres_absPath && GeneralUtility::isFirstPartOfStr($EXTres_absPath, PATH_site . $this->fileadminFolderName . '/') && @is_file($EXTres_absPath)) {
                         $htmlResourceCaptured = true;
                         $EXTres_ID = md5($EXTres_absPath);
                         $this->dat['header']['files'][$fI['ID']]['EXT_RES_ID'][] = $EXTres_ID;
//.........这里部分代码省略.........
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:101,代码来源:Export.php


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