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


PHP Resource\ResourceFactory类代码示例

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


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

示例1: initializeAction

 /**
  * action initialize
  *
  * @return void
  */
 protected function initializeAction()
 {
     //print_r($this->settings);
     $this->folderPath = str_replace('1:', '', $this->settings['flex_startingpoint']);
     $this->folderCombinedId = $this->settings['flex_startingpoint'];
     //$fac = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory'); // create instance to storage repository
     $this->storageObj = $this->resourceFactory->getStorageObjectFromCombinedIdentifier($this->folderCombinedId);
     $this->folderObj = $this->storageObj->getFolder($this->folderPath);
     $files = $this->folderObj->getFiles();
     foreach ($files as $file) {
         $this->filesList[$file->getUid()]['name'] = $file->getName();
         $this->filesList[$file->getUid()]['identifier'] = $file->getIdentifier();
     }
 }
开发者ID:spabhat,项目名称:pdflister,代码行数:19,代码来源:ListPdfController.php

示例2: unserialize

 /**
  * @param $status
  * @param $table
  * @param $id
  * @param $fieldArray
  * @param $self
  */
 function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, &$self)
 {
     if ($table == 'tx_html5videoplayer_domain_model_video') {
         $data = $fieldArray;
         if ($status == 'update') {
             $data = array_merge($GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'tx_html5videoplayer_domain_model_video', 'uid=' . (int) $id), $data);
         }
         $vimeoUrl = $data['vimeo'];
         if (($status == 'update' || $status == 'new') && $vimeoUrl != '' && GeneralUtility::isValidUrl($vimeoUrl)) {
             if (preg_match('/https?:\\/\\/(?:www\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|album\\/(\\d+)\\/video\\/|)(\\d+)(?:$|\\/|\\?)/i', $vimeoUrl, $matches)) {
                 $videoId = $matches[3];
                 $videoData = unserialize(GeneralUtility::getUrl('http://vimeo.com/api/v2/video/' . $videoId . '.php'));
                 if (is_array($videoData)) {
                     // We're only interested in index zero.
                     $videoData = $videoData[0];
                     if (!isset($data['title']) || trim($data['title']) == '') {
                         $fieldArray['title'] = $videoData['title'];
                     }
                     if (!isset($data['description']) || trim($data['description']) == '') {
                         $fieldArray['description'] = $videoData['description'];
                     }
                     if (!isset($data['posterimage']) || trim($data['posterimage']) == '') {
                         $resourceFactory = ResourceFactory::getInstance();
                         $folder = $resourceFactory->retrieveFileOrFolderObject($this->getUploadFolder());
                         $thumbnailData = GeneralUtility::getUrl($videoData['thumbnail_large']);
                         $file = $folder->createFile(basename($videoData['thumbnail_large']) . '.jpg');
                         $file->setContents($thumbnailData);
                         $fieldArray['posterimage'] = 'file:' . $file->getUid();
                     }
                 }
             }
         }
     }
 }
开发者ID:visol,项目名称:html5videoplayer,代码行数:41,代码来源:VimeoProcessDatamap.php

示例3: renderImageAttributes

 /**
  * Returns a processed image to be displayed on the Frontend.
  *
  * @param string $content Content input (not used).
  * @param array $conf TypoScript configuration
  * @return string HTML output
  */
 public function renderImageAttributes($content = '', $conf)
 {
     $imageAttributes = $this->getImageAttributes();
     // It is pretty rare to be in presence of an external image as the default behaviour
     // of the RTE is to download the external image and create a local image.
     // However, it may happen if the RTE has the flag "disable"
     if (!$this->isExternalImage()) {
         $fileUid = (int) $imageAttributes['data-htmlarea-file-uid'];
         if ($fileUid) {
             try {
                 $file = Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
                 if ($imageAttributes['src'] !== $file->getPublicUrl()) {
                     // Source file is a processed image
                     $imageConfiguration = array('width' => (int) $imageAttributes['width'], 'height' => (int) $imageAttributes['height']);
                     $processedFile = $this->getMagicImageService()->createMagicImage($file, $imageConfiguration);
                     $additionalAttributes = array('src' => $processedFile->getPublicUrl(), 'title' => $imageAttributes['title'] ?: $file->getProperty('title'), 'alt' => $imageAttributes['alt'] ?: $file->getProperty('alternative'), 'width' => $processedFile->getProperty('width'), 'height' => $processedFile->getProperty('height'));
                     $imageAttributes = array_merge($imageAttributes, $additionalAttributes);
                 }
             } catch (Resource\Exception\FileDoesNotExistException $fileDoesNotExistException) {
                 // Log the fact the file could not be retrieved.
                 $message = sprintf('I could not find file with uid "%s"', $fileUid);
                 $this->getLogger()->error($message);
             }
         }
     }
     return '<img ' . GeneralUtility::implodeAttributes($imageAttributes, TRUE, TRUE) . ' />';
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:34,代码来源:ImageRenderingController.php

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

示例5: generateButtons

 /**
  * Generate album add/edit buttons for click menu or toolbar
  *
  * @param string $combinedIdentifier
  * @return array
  */
 protected function generateButtons($combinedIdentifier)
 {
     $buttons = array();
     // In some folder copy/move actions in file list a invalid id is passed
     try {
         /** @var $file \TYPO3\CMS\Core\Resource\Folder */
         $folder = ResourceFactory::getInstance()->retrieveFileOrFolderObject($combinedIdentifier);
     } catch (ResourceDoesNotExistException $exception) {
         $folder = NULL;
     } catch (InsufficientFolderAccessPermissionsException $exception) {
         $folder = NULL;
     }
     if ($folder && $folder instanceof Folder && !$folder->getStorage()->isPublic() && in_array($folder->getRole(), array(Folder::ROLE_DEFAULT, Folder::ROLE_USERUPLOAD))) {
         /** @var \BeechIt\FalSecuredownload\Service\Utility $utility */
         $utility = GeneralUtility::makeInstance('BeechIt\\FalSecuredownload\\Service\\Utility');
         $folderRecord = $utility->getFolderRecord($folder);
         $menuItems[] = 'spacer';
         if ($folderRecord) {
             $buttons[] = $this->createLink($this->sL('clickmenu.folderpermissions'), $this->sL('clickmenu.folderpermissions'), IconUtility::getSpriteIcon('extensions-fal_securedownload-folder', array(), array('status-overlay-access-restricted' => '')), "alt_doc.php?edit[tx_falsecuredownload_folder][" . $folderRecord['uid'] . "]=edit");
         } else {
             $buttons[] = $this->createLink($this->sL('clickmenu.folderpermissions'), $this->sL('clickmenu.folderpermissions'), IconUtility::getSpriteIcon('extensions-fal_securedownload-folder', array(), array('extensions-fal_securedownload-overlay-permissions' => '')), "alt_doc.php?edit[tx_falsecuredownload_folder][0]=new&defVals[tx_falsecuredownload_folder][folder_hash]=" . $folder->getHashedIdentifier() . "&defVals[tx_falsecuredownload_folder][storage]=" . $folder->getStorage()->getUid() . "&defVals[tx_falsecuredownload_folder][folder]=" . $folder->getIdentifier());
         }
     }
     return $buttons;
 }
开发者ID:camrun91,项目名称:fal_securedownload,代码行数:31,代码来源:AbstractBeButtons.php

示例6: process

 /**
  * Processing the focus point crop (fallback to LocalCropScaleMaskHelper)
  *
  * @param TaskInterface $task
  *
  * @return array|NULL
  */
 public function process(TaskInterface $task)
 {
     $configuration = $task->getConfiguration();
     $crop = $configuration['crop'] ? json_decode($configuration['crop']) : null;
     if ($crop instanceof \stdClass && isset($crop->x)) {
         // if crop is enable release the process
         return parent::process($task);
     }
     $sourceFile = $task->getSourceFile();
     try {
         if (self::$deepCheck === false) {
             self::$deepCheck = true;
             $ratio = $this->getCurrentRatioConfiguration();
             $this->dimensionService->getRatio($ratio);
             $newFile = $this->focusCropService->getCroppedImageSrcByFile($sourceFile, $ratio);
             $file = ResourceFactory::getInstance()->retrieveFileOrFolderObject($newFile);
             $targetFile = $task->getTargetFile();
             ObjectAccess::setProperty($targetFile, 'originalFile', $file, true);
             ObjectAccess::setProperty($targetFile, 'originalFileSha1', $file->getSha1(), true);
             ObjectAccess::setProperty($targetFile, 'storage', $file->getStorage(), true);
             ObjectAccess::setProperty($task, 'sourceFile', $file, true);
             ObjectAccess::setProperty($task, 'targetFile', $targetFile, true);
         }
     } catch (\Exception $ex) {
     }
     self::$deepCheck = false;
     return parent::process($task);
 }
开发者ID:mcmz,项目名称:focuspoint,代码行数:35,代码来源:LocalCropScaleMaskHelper.php

示例7: init

 /**
  * Initialize the storage repository.
  */
 public function init()
 {
     $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
     $this->storages = $this->storageRepository->findAll();
     // Add default storage for core files
     $this->storages[] = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getStorageObject(0);
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:10,代码来源:FileIdentifierHashUpdate.php

示例8: filterInlineChildren

 /**
  * Entry method for use as TCEMain "inline" field filter
  *
  * @param array $parameters
  * @param \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain
  * @return array
  */
 public function filterInlineChildren(array $parameters, \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain)
 {
     $values = $parameters['values'];
     if ($parameters['allowedFileExtensions']) {
         $this->setAllowedFileExtensions($parameters['allowedFileExtensions']);
     }
     if ($parameters['disallowedFileExtensions']) {
         $this->setDisallowedFileExtensions($parameters['disallowedFileExtensions']);
     }
     $cleanValues = array();
     if (is_array($values)) {
         foreach ($values as $value) {
             if (empty($value)) {
                 continue;
             }
             $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $value, 2);
             $fileReferenceUid = $parts[count($parts) - 1];
             $fileReference = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($fileReferenceUid);
             $file = $fileReference->getOriginalFile();
             if ($this->isAllowed($file->getName())) {
                 $cleanValues[] = $value;
             } else {
                 // Remove the erroneously created reference record again
                 $tceMain->deleteAction('sys_file_reference', $fileReferenceUid);
             }
         }
     }
     return $cleanValues;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:36,代码来源:FileExtensionFilter.php

示例9: getOriginalResource

 /**
  * @return \TYPO3\CMS\Core\Resource\FileReference
  */
 public function getOriginalResource()
 {
     if ($this->originalResource === NULL) {
         $this->originalResource = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($this->getUid());
     }
     return $this->originalResource;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:10,代码来源:FileReference.php

示例10: getOriginalResource

 /**
  * @return \TYPO3\CMS\Core\Resource\FileReference
  */
 public function getOriginalResource()
 {
     if ($this->originalResource === null) {
         $this->originalResource = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($this->_localizedUid);
     }
     return $this->originalResource;
 }
开发者ID:dachcom-digital,项目名称:typo3-faltranslations,代码行数:10,代码来源:FileReference.php

示例11: init

    /**
     * Initialize script class
     *
     * @return 	void
     * @todo Define visibility
     */
    public function init()
    {
        // Setting target, which must be a file reference to a file within the mounts.
        $this->target = $this->origTarget = $fileIdentifier = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target');
        $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl'));
        // create the file object
        if ($fileIdentifier) {
            $this->fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($fileIdentifier);
        }
        // Cleaning and checking target directory
        if (!$this->fileObject) {
            $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, 1294586841);
        }
        // Setting the title and the icon
        $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root');
        $this->title = $icon . htmlspecialchars($this->fileObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileObject->getIdentifier());
        // ***************************
        // Setting template object
        // ***************************
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->setModuleTemplate('templates/file_edit.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList() {	//
				top.goToModule("file_list");
			}
		');
        $this->doc->form = '<form action="tce_file.php" method="post" name="editform">';
    }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:37,代码来源:EditFileController.php

示例12: __construct

 /**
  * Override default constructor to make it possible to instantiate this
  * class for rendering an offset table not in content object context
  *
  * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj
  */
 public function __construct(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj = NULL)
 {
     if (!is_null($cObj)) {
         $this->cObj = $cObj;
         $this->fileFactory = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:13,代码来源:OffsetTableContentObject.php

示例13: areInlineChildrenFilteredWithInvalidParameters

 /**
  * @param array|string $allowed
  * @param array|string $disallowed
  * @param array|string $values
  * @test
  * @dataProvider invalidInlineChildrenFilterParametersDataProvider
  */
 public function areInlineChildrenFilteredWithInvalidParameters($allowed, $disallowed, $values)
 {
     $this->parameters = array('allowedFileExtensions' => $allowed, 'disallowedFileExtensions' => $disallowed, 'values' => $values);
     $this->tceMainMock->expects($this->never())->method('deleteAction');
     $this->fileFactoryMock->expects($this->never())->method('getFileReferenceObject');
     $this->filter->filterInlineChildren($this->parameters, $this->tceMainMock);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:14,代码来源:FileExtensionFilterTest.php

示例14: createDomainObject

 /**
  * @param array $databaseRow
  * @return ProcessedFile
  */
 protected function createDomainObject(array $databaseRow)
 {
     $originalFile = $this->resourceFactory->getFileObject((int) $databaseRow['original']);
     $originalFile->setStorage($this->resourceFactory->getStorageObject($originalFile->getProperty('storage')));
     $taskType = $databaseRow['task_type'];
     $configuration = unserialize($databaseRow['configuration']);
     return GeneralUtility::makeInstance($this->objectType, $originalFile, $taskType, $configuration, $databaseRow);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:12,代码来源:ProcessedFileRepository.php

示例15: previewAction

 /**
  *
  * @param string                               $identifier
  * @param \HDNET\Importr\Domain\Model\Strategy $strategy
  *
  * @return void
  */
 public function previewAction($identifier, Strategy $strategy)
 {
     $file = $this->resourceFactory->getObjectFromCombinedIdentifier($identifier);
     $this->view->assign('filepath', $file->getPublicUrl());
     $this->view->assign('strategy', $strategy);
     $previewData = $this->importManager->getPreview($strategy, $file->getPublicUrl());
     $this->view->assign('preview', $previewData);
 }
开发者ID:sirdiego,项目名称:importr,代码行数:15,代码来源:ImportrController.php


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