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


PHP File::getProperty方法代码示例

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


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

示例1: createAction

 /**
  * Create a processed file according to some configuration.
  *
  * @param File $file
  * @param array $processingConfiguration
  * @return string
  */
 public function createAction(File $file, array $processingConfiguration = array())
 {
     $processedFile = $file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $processingConfiguration);
     $response = array('success' => TRUE, 'original' => $file->getUid(), 'title' => $file->getProperty('title') ? $file->getProperty('title') : $file->getName(), 'publicUrl' => $processedFile->getPublicUrl(), 'width' => $processedFile->getProperty('width'), 'height' => $processedFile->getProperty('height'));
     header("Content-Type: text/json");
     return htmlspecialchars(json_encode($response), ENT_NOQUOTES);
 }
开发者ID:visol,项目名称:media,代码行数:14,代码来源:ProcessedFileController.php

示例2: createProcessedThumbnail

 /**
  * Resize image and garantees a minimum size for each dimension
  * @param File $file
  * @return File|ProcessedFile
  */
 public function createProcessedThumbnail(File $file)
 {
     $minSize = 84;
     $width = (int) $file->getProperty('width');
     $height = (int) $file->getProperty('height');
     $ratio = $width / $height;
     if ($width > $height) {
         $configuration = ['maxWidth' => ceil($minSize * $ratio), 'height' => $minSize];
     } else {
         $configuration = ['width' => $minSize, 'maxHeight' => ceil($minSize / $ratio)];
     }
     $file = $file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $configuration);
     return $file;
 }
开发者ID:Ecodev,项目名称:natural-carousel-typo3,代码行数:19,代码来源:SlideStackViewHelper.php

示例3: render

 /**
  * renders <f:then> child if the current logged in FE user has access to the given asset
  * otherwise renders <f:else> child.
  *
  * @param Folder $folder
  * @param File $file
  * @return bool|string
  */
 public function render(Folder $folder, File $file = NULL)
 {
     /** @var $checkPermissionsService \BeechIt\FalSecuredownload\Security\CheckPermissions */
     $checkPermissionsService = GeneralUtility::makeInstance('BeechIt\\FalSecuredownload\\Security\\CheckPermissions');
     $userFeGroups = $this->getFeUserGroups();
     $access = FALSE;
     // check folder access
     if ($checkPermissionsService->checkFolderRootLineAccess($folder, $userFeGroups)) {
         if ($file === NULL) {
             $access = TRUE;
         } else {
             $feGroups = $file->getProperty('fe_groups');
             if ($feGroups !== '') {
                 $access = $checkPermissionsService->matchFeGroupsWithFeUser($feGroups, $userFeGroups);
             } else {
                 $access = TRUE;
             }
         }
     }
     if ($access) {
         return $this->renderThenChild();
     } else {
         return $this->renderElseChild();
     }
 }
开发者ID:camrun91,项目名称:fal_securedownload,代码行数:33,代码来源:AssetAccessViewHelper.php

示例4: canProcess

 /**
  * Checks if the given file can be processed by this Extractor
  *
  * @param Resource\File $file
  * @return boolean
  */
 public function canProcess(Resource\File $file)
 {
     // TODO use MIME type instead of extension
     // tika.jar --list-supported-types -> cache supported types
     // compare to file's MIME type
     return in_array($file->getProperty('extension'), $this->supportedFileTypes);
 }
开发者ID:neufeind,项目名称:ext-tika,代码行数:13,代码来源:MetaDataExtractor.php

示例5: main

 /**
  * Main function which creates the image if needed and outputs the HTML code for the page displaying the image.
  * Accumulates the content in $this->content
  *
  * @return void
  */
 public function main()
 {
     $processedImage = $this->processImage();
     $imageTagMarkers = array('###publicUrl###' => htmlspecialchars($processedImage->getPublicUrl()), '###alt###' => htmlspecialchars($this->file->getProperty('alternative') ?: $this->title), '###title###' => htmlspecialchars($this->file->getProperty('title') ?: $this->title), '###width###' => $processedImage->getProperty('width'), '###height###' => $processedImage->getProperty('height'));
     $this->imageTag = str_replace(array_keys($imageTagMarkers), array_values($imageTagMarkers), $this->imageTag);
     $markerArray = array('###TITLE###' => $this->file->getProperty('title') ?: $this->title, '###IMAGE###' => $this->imageTag, '###BODY###' => $this->bodyTag);
     $this->content = str_replace(array_keys($markerArray), array_values($markerArray), $this->content);
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:14,代码来源:ShowImageController.php

示例6: getProperty

 /**
  * Getter for file-properties
  *
  * @param string $key
  *
  * @return mixed
  */
 public function getProperty($key)
 {
     // The uid always (!) has to come from this file and never the original file (see getOriginalFile() to get this)
     if ($this->isUnchanged() && $key !== 'uid') {
         return $this->originalFile->getProperty($key);
     } else {
         return $this->properties[$key];
     }
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:16,代码来源:ProcessedFile.php

示例7: getProperties

 /**
  * Gets all properties, falling back to values of the parent.
  *
  * @return array
  */
 public function getProperties()
 {
     $properties = $this->getReferenceProperties();
     $keys = array_keys($properties);
     foreach ($this->parentFallbackProperties as $localKey => $parentKey) {
         if (array_key_exists($localKey, $keys) && $properties[$localKey] === NULL) {
             $properties[$localKey] = $this->originalFile->getProperty($parentKey);
         }
     }
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:15,代码来源:FileReference.php

示例8: main

 /**
  * Main function which creates the image if needed and outputs the HTML code for the page displaying the image.
  * Accumulates the content in $this->content
  *
  * @return void
  */
 public function main()
 {
     $processedImage = $this->processImage();
     $imageTagMarkers = array('###publicUrl###' => htmlspecialchars($processedImage->getPublicUrl()), '###alt###' => htmlspecialchars($this->file->getProperty('alternative') ?: $this->title), '###title###' => htmlspecialchars($this->file->getProperty('title') ?: $this->title));
     $this->imageTag = str_replace(array_keys($imageTagMarkers), array_values($imageTagMarkers), $this->imageTag);
     if ($this->wrap !== '|') {
         $wrapParts = explode('|', $this->wrap, 2);
         $this->imageTag = $wrapParts[0] . $this->imageTag . $wrapParts[1];
     }
     $markerArray = array('###TITLE###' => $this->file->getProperty('title') ?: $this->title, '###IMAGE###' => $this->imageTag, '###BODY###' => $this->bodyTag);
     $this->content = str_replace(array_keys($markerArray), array_values($markerArray), $this->content);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:18,代码来源:ShowImageController.php

示例9: checkFileAccess

 /**
  * Check file access for given FeGroups combination
  *
  * @param \TYPO3\CMS\Core\Resource\File $file
  * @param bool|array $userFeGroups FALSE = no login, array() fe groups of user
  * @return bool
  */
 public function checkFileAccess($file, $userFeGroups)
 {
     // all files in public storage are accessible
     if ($file->getStorage()->isPublic()) {
         return true;
         // check folder access
     } elseif ($this->checkFolderRootLineAccess($file->getParentFolder(), $userFeGroups)) {
         // access to folder then check file privileges if present
         $feGroups = $file->getProperty('fe_groups');
         if ($feGroups !== '') {
             return $this->matchFeGroupsWithFeUser($feGroups, $userFeGroups);
         }
         return true;
     }
     return false;
 }
开发者ID:s-nunez,项目名称:fal_securedownload,代码行数:23,代码来源:CheckPermissions.php

示例10: update

 /**
  * Updates the index record in the database
  *
  * @param File $file
  * @return void
  */
 public function update(File $file)
 {
     $updatedProperties = array_intersect($this->fields, $file->getUpdatedProperties());
     $updateRow = array();
     foreach ($updatedProperties as $key) {
         $updateRow[$key] = $file->getProperty($key);
     }
     if (count($updateRow) > 0) {
         $updateRow['tstamp'] = time();
         $this->getDatabaseConnection()->exec_UPDATEquery($this->table, $this->getWhereClauseForFile($file), $updateRow);
         $this->updateRefIndex($file->getUid());
         $this->emitRecordUpdatedSignal(array_intersect_key($file->getProperties(), array_flip($this->fields)));
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:20,代码来源:FileIndexRepository.php

示例11: canProcess

 /**
  * Checks if the given file can be processed by this Extractor
  *
  * @param File $file
  * @return boolean
  */
 public function canProcess(File $file)
 {
     return in_array($file->getProperty('extension'), $this->supportedFileTypes);
 }
开发者ID:visol,项目名称:ext-tika,代码行数:10,代码来源:LanguageDetector.php

示例12: extractMetaData

 /**
  * The actual processing TASK
  * Should return an array with database properties for sys_file_metadata to write
  *
  * @param File $file
  * @param array $previousExtractedData optional, contains the array of already extracted data
  * @return array
  */
 public function extractMetaData(File $file, array $previousExtractedData = array())
 {
     $metadata = array();
     $title = $file->getProperty('title');
     if (empty($title)) {
         $metadata = array('title' => $this->guessTitle($file->getName()));
     }
     return $metadata;
 }
开发者ID:visol,项目名称:media,代码行数:17,代码来源:TitleMetadataExtractor.php

示例13: 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

示例14: 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

示例15: generateFilename

 /**
  * Generates a new file name based on an existing file and the format of the new name
  *
  * @param  \TYPO3\CMS\Core\Resource\File $file            original file
  * @param  string                        $filenameFormat  filename format with markers
  * @return string                                         new file name
  */
 protected function generateFilename(\TYPO3\CMS\Core\Resource\File $file, $filenameFormat)
 {
     return $this->cObj->substituteMarkerArray($filenameFormat, array('###NAME###' => basename($file->getProperty('name'), $file->getProperty('extension') ? '.' . $file->getProperty('extension') : ''), '###EXTENSION###' => $file->getProperty('extension'), '###UID###' => $file->getUid(), '###SHA1###' => $file->getProperty('sha1'), '###HASH###' => $file->getProperty('identifier_hash'), '###UNIQUE###' => md5(uniqid($file->getProperty('name'), true))));
 }
开发者ID:lokamaya,项目名称:html5mediaelements,代码行数:11,代码来源:OptimizeMediaCommandController.php


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