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


PHP ContentObjectRenderer::getCurrentFile方法代码示例

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


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

示例1: getDataExtension

 /**
  * Extends the getData()-Method of ContentObjectRenderer to process more/other commands
  *
  * @param string                $getDataString Full content of getData-request e.g. "TSFE:id // field:title // field:uid
  * @param array                 $fields        Current field-array
  * @param string                $sectionValue  Currently examined section value of the getData request e.g. "field:title
  * @param string                $returnValue   Current returnValue that was processed so far by getData
  * @param ContentObjectRenderer $parentObject  Parent content object
  *
  * @return string Get data result
  */
 public function getDataExtension($getDataString, array $fields, $sectionValue, $returnValue, ContentObjectRenderer &$parentObject)
 {
     $parts = explode(':', $getDataString);
     if (isset($parts[0]) && isset($parts[1]) && $parts[0] === 'fp') {
         $fileObject = $parentObject->getCurrentFile();
         if (!$fileObject instanceof FileReference) {
             return $returnValue;
         }
         $originalFile = $fileObject->getOriginalFile();
         switch ($parts[1]) {
             case 'x':
             case 'y':
                 $metaData = $originalFile->_getMetaData();
                 return $metaData['focus_point_' . $parts[1]] / 100;
             case 'xp':
             case 'yp':
                 $metaData = $originalFile->_getMetaData();
                 return (double) $metaData['focus_point_' . substr($parts[1], 0, 1)];
             case 'xp_positive':
             case 'yp_positive':
                 $metaData = $originalFile->_getMetaData();
                 return ((double) $metaData['focus_point_' . substr($parts[1], 0, 1)] + 100) / 2;
             case 'w':
             case 'h':
                 $fileName = GeneralUtility::getFileAbsFileName($fileObject->getPublicUrl(true));
                 if (file_exists($fileName)) {
                     $sizes = getimagesize($fileName);
                     return $sizes[$parts[1] == 'w' ? 0 : 1];
                 }
                 break;
         }
     }
     return $returnValue;
 }
开发者ID:mcmz,项目名称:focuspoint,代码行数:45,代码来源:GetData.php

示例2: addFileData

 public function addFileData($content, array $configuration = NULL)
 {
     $currentFile = $this->cObj->getCurrentFile();
     if ($currentFile instanceof \TYPO3\CMS\Core\Resource\File) {
         $tableName = 'sys_file';
     } elseif ($currentFile instanceof \TYPO3\CMS\Core\Resource\FileReference) {
         $tableName = 'sys_file_reference';
     } else {
         return;
     }
     $recordData = $this->filterFields($tableName, $currentFile->getProperties());
     $recordIdentifier = $tableName . ':' . $currentFile->getUid();
     $this->records[$recordIdentifier] = $recordData;
     $currentWatcherValue = $this->getCurrentWatcherValue();
     $levelIdentifier = rtrim($currentWatcherValue, '/');
     $this->addToStructure($levelIdentifier, $recordIdentifier, $recordData);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:17,代码来源:Collector.php


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