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


PHP ResourceManager::getPublicPackageResourceUri方法代码示例

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


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

示例1: getAssetThumbnailImage

 /**
  * @param AssetInterface $asset
  * @param integer $maximumWidth
  * @param integer $maximumHeight
  * @return array
  */
 protected function getAssetThumbnailImage(AssetInterface $asset, $maximumWidth, $maximumHeight)
 {
     // TODO: Could be configurable at some point
     $iconPackage = 'TYPO3.Media';
     $iconSize = $this->getDocumentIconSize($maximumWidth, $maximumHeight);
     if (is_file('resource://' . $iconPackage . '/Public/Icons/16px/' . $asset->getResource()->getFileExtension() . '.png')) {
         $icon = sprintf('Icons/%spx/' . $asset->getResource()->getFileExtension() . '.png', $iconSize);
     } else {
         $icon = sprintf('Icons/%spx/_blank.png', $iconSize);
     }
     return array('width' => $iconSize, 'height' => $iconSize, 'src' => $this->resourceManager->getPublicPackageResourceUri($iconPackage, $icon));
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:18,代码来源:AssetService.php

示例2: render

 /**
  * Render the URI to the resource. The filename is used from child content.
  *
  * @param string $path The location of the resource, can be either a path relative to the Public resource directory of the package or a resource://... URI
  * @param string $package Target package key. If not set, the current package key will be used
  * @param Resource $resource If specified, this resource object is used instead of the path and package information
  * @param boolean $localize Whether resource localization should be attempted or not
  * @return string The absolute URI to the resource
  * @throws InvalidVariableException
  * @api
  */
 public function render($path = null, $package = null, Resource $resource = null, $localize = true)
 {
     if ($resource !== null) {
         $uri = $this->resourceManager->getPublicPersistentResourceUri($resource);
         if ($uri === false) {
             $uri = '404-Resource-Not-Found';
         }
     } else {
         if ($path === null) {
             throw new InvalidVariableException('The ResourceViewHelper did neither contain a valuable "resource" nor "path" argument.', 1353512742);
         }
         if ($package === null) {
             $package = $this->controllerContext->getRequest()->getControllerPackageKey();
         }
         if (strpos($path, 'resource://') === 0) {
             try {
                 list($package, $path) = $this->resourceManager->getPackageAndPathByPublicPath($path);
             } catch (Exception $exception) {
                 throw new InvalidVariableException(sprintf('The specified path "%s" does not point to a public resource.', $path), 1386458851);
             }
         }
         if ($localize === true) {
             $resourcePath = 'resource://' . $package . '/Public/' . $path;
             $localizedResourcePathData = $this->i18nService->getLocalizedFilename($resourcePath);
             $matches = array();
             if (preg_match('#resource://([^/]+)/Public/(.*)#', current($localizedResourcePathData), $matches) === 1) {
                 $package = $matches[1];
                 $path = $matches[2];
             }
         }
         $uri = $this->resourceManager->getPublicPackageResourceUri($package, $path);
     }
     return $uri;
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:45,代码来源:ResourceViewHelper.php

示例3: render

 /**
  * @param boolean $minified
  * @param string $include
  * @return string
  * @throws \Exception
  */
 public function render($minified = true, $include = 'remaining')
 {
     if (!in_array($include, array('all', 'css', 'js', 'remaining'))) {
         throw new \Exception('invalid include parameter. valid values are "remaining", "all", "css" and "js".');
     }
     if ($include == 'remaining') {
         if (self::$cssIncluded && self::$jsIncluded) {
             return '';
         } else {
             if (!self::$cssIncluded && !self::$jsIncluded) {
                 $include = 'all';
             } else {
                 if (!self::$cssIncluded) {
                     $include = 'css';
                 } else {
                     $include = 'js';
                 }
             }
         }
     } else {
         if ($include == 'all' && (self::$cssIncluded || self::$jsIncluded)) {
             throw new \Exception("Some Owlcarousel's dependencies are already included.");
         } else {
             if ($include == 'css' && self::$cssIncluded) {
                 throw new \Exception("Owlcarousel's CSS is already included.");
             } else {
                 if ($include == 'js' && self::$jsIncluded) {
                     throw new \Exception("Owlcarousel's JavaScript is already included.");
                 }
             }
         }
     }
     $return = '';
     if ($include == 'css' || $include == 'all') {
         $css = $this->resourceManager->getPublicPackageResourceUri('Axovis.Flow.Owlcarousel', 'Styles/owl.carousel.css');
         $return .= '<link rel="stylesheet" type="text/css" href="' . $css . '" />';
         self::$cssIncluded = true;
     }
     if ($include == 'js' || $include == 'all') {
         $js = $this->resourceManager->getPublicPackageResourceUri('Axovis.Flow.Owlcarousel', 'JavaScript/owl.carousel' . ($minified ? '.min' : '') . '.js');
         $return .= '<script type="text/javascript" src="' . $js . '"></script>';
         self::$jsIncluded = true;
     }
     return $return;
 }
开发者ID:axovis,项目名称:Axovis.Flow.Owlcarousel,代码行数:51,代码来源:IncludeViewHelper.php

示例4: getStaticThumbnailForAsset

 /**
  * @param AssetInterface $asset
  * @param integer $maximumWidth
  * @param integer $maximumHeight
  * @return array
  */
 public function getStaticThumbnailForAsset(AssetInterface $asset, $maximumWidth, $maximumHeight)
 {
     $iconSize = $this->getDocumentIconSize($maximumWidth, $maximumHeight);
     if (is_file('resource://TYPO3.Media/Public/Icons/16px/' . $asset->getResource()->getFileExtension() . '.png')) {
         $icon = sprintf('Icons/%spx/' . $asset->getResource()->getFileExtension() . '.png', $iconSize);
     } else {
         $icon = sprintf('Icons/%spx/_blank.png', $iconSize);
     }
     $icon = $this->resourceManager->getPublicPackageResourceUri('TYPO3.Media', $icon);
     return array('width' => $iconSize, 'height' => $iconSize, 'src' => $icon);
 }
开发者ID:netlogix,项目名称:media,代码行数:17,代码来源:ThumbnailService.php

示例5: getStaticResourceWebBaseUri

 /**
  * @param string $resourcePath
  * @return string
  */
 protected function getStaticResourceWebBaseUri($resourcePath)
 {
     $localizedResourcePathData = $this->i18nService->getLocalizedFilename($resourcePath);
     $matches = array();
     try {
         if (preg_match('#resource://([^/]+)/Public/(.*)#', current($localizedResourcePathData), $matches) === 1) {
             $packageKey = $matches[1];
             $path = $matches[2];
             return $this->resourceManager->getPublicPackageResourceUri($packageKey, $path);
         }
     } catch (\Exception $exception) {
         $this->systemLogger->logException($exception);
     }
     return '';
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:19,代码来源:JavascriptConfigurationViewHelper.php

示例6: getUriForThumbnail

 /**
  * @param Thumbnail $thumbnail
  * @return string
  * @throws ThumbnailServiceException
  */
 public function getUriForThumbnail(Thumbnail $thumbnail)
 {
     $resource = $thumbnail->getResource();
     if ($resource) {
         return $this->resourceManager->getPublicPersistentResourceUri($resource);
     }
     $staticResource = $thumbnail->getStaticResource();
     if ($staticResource === null) {
         throw new ThumbnailServiceException(sprintf('Could not generate URI for static thumbnail "%s".', $this->persistenceManager->getIdentifierByObject($thumbnail)), 1450178437);
     }
     try {
         list($package, $path) = $this->resourceManager->getPackageAndPathByPublicPath($staticResource);
         return $this->resourceManager->getPublicPackageResourceUri($package, $path);
     } catch (Exception $exception) {
         return $staticResource;
     }
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:22,代码来源:ThumbnailService.php

示例7: transformLegacyModuleMapping

 /**
  * Creates a key-value list of JS modules and their sources files
  * out of the given configuration
  *
  * @return array
  */
 protected function transformLegacyModuleMapping()
 {
     $finalMapping = [];
     foreach ($this->legacyModuleMapping as $path => $modules) {
         if (preg_match('#resource://([^/]+)/Public/(.*)#', $path, $matches) === 1) {
             $packageKey = $matches[1];
             $path = $matches[2];
             $realPath = $this->resourceManager->getPublicPackageResourceUri($packageKey, $path);
             foreach ($modules as $module => $migratesTo) {
                 $finalMapping[$module] = ['target' => $realPath, 'migratesTo' => $migratesTo];
             }
             continue;
         }
         throw new \Exception(sprintf('"%s" is not a valid path to a public JavaScript. ' . 'Please provide a resource path ("resource://...")', $path), 1463923183);
     }
     return $finalMapping;
 }
开发者ID:neos,项目名称:neos-ui,代码行数:23,代码来源:BackendController.php

示例8: evaluate

 /**
  * Returns the absolute URL of a resource
  *
  * @return string
  * @throws TypoScriptException
  */
 public function evaluate()
 {
     $resource = $this->getResource();
     if ($resource !== null) {
         $uri = false;
         if ($resource instanceof Resource) {
             $uri = $this->resourceManager->getPublicPersistentResourceUri($resource);
         }
         if ($uri === false) {
             throw new TypoScriptException('The specified resource is invalid', 1386458728);
         }
         return $uri;
     }
     $path = $this->getPath();
     if ($path === null) {
         throw new TypoScriptException('Neither "resource" nor "path" were specified', 1386458763);
     }
     if (strpos($path, 'resource://') === 0) {
         $matches = array();
         if (preg_match('#^resource://([^/]+)/Public/(.*)#', $path, $matches) !== 1) {
             throw new TypoScriptException(sprintf('The specified path "%s" does not point to a public resource.', $path), 1386458851);
         }
         $package = $matches[1];
         $path = $matches[2];
     } else {
         $package = $this->getPackage();
         if ($package === null) {
             $controllerContext = $this->tsRuntime->getControllerContext();
             /** @var $actionRequest ActionRequest */
             $actionRequest = $controllerContext->getRequest();
             $package = $actionRequest->getControllerPackageKey();
         }
     }
     $localize = $this->isLocalize();
     if ($localize === true) {
         $resourcePath = 'resource://' . $package . '/Public/' . $path;
         $localizedResourcePathData = $this->i18nService->getLocalizedFilename($resourcePath);
         $matches = array();
         if (preg_match('#resource://([^/]+)/Public/(.*)#', current($localizedResourcePathData), $matches) === 1) {
             $package = $matches[1];
             $path = $matches[2];
         }
     }
     return $this->resourceManager->getPublicPackageResourceUri($package, $path);
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:51,代码来源:ResourceUriImplementation.php

示例9: translateAndConvertHelpMessage

 /**
  * If ui.help.message is set in $configuration, translate it if requested and then convert it from markdown to HTML.
  *
  * @param array $configuration
  * @param string $idPrefix
  * @param string $nodeTypeName
  * @return void
  */
 protected function translateAndConvertHelpMessage(array &$configuration, $idPrefix, $nodeTypeName = null)
 {
     $helpMessage = '';
     if (isset($configuration['ui']['help'])) {
         // message handling
         if (isset($configuration['ui']['help']['message'])) {
             if ($this->shouldFetchTranslation($configuration['ui']['help'], 'message')) {
                 $translationIdentifier = $this->splitIdentifier($idPrefix . 'ui.help.message');
                 $helpMessage = $this->translator->translateById($translationIdentifier['id'], [], null, null, $translationIdentifier['source'], $translationIdentifier['packageKey']);
             } else {
                 $helpMessage = $configuration['ui']['help']['message'];
             }
         }
         // prepare thumbnail
         if ($nodeTypeName !== null) {
             $thumbnailUrl = '';
             if (isset($configuration['ui']['help']['thumbnail'])) {
                 $thumbnailUrl = $configuration['ui']['help']['thumbnail'];
                 $matches = [];
                 if (preg_match('/resource:\\/\\/(?P<packageKey>[^\\/]+)\\/(?P<relativePathAndFilename>.+)/', $thumbnailUrl, $matches) === 1) {
                     $thumbnailUrl = $this->resourceManager->getPublicPackageResourceUri($matches['packageKey'], $matches['relativePathAndFilename']);
                 }
             } else {
                 # look in well know location
                 $splitPrefix = $this->splitIdentifier($nodeTypeName);
                 $relativePathAndFilename = 'NodeTypes/Thumbnails/' . $splitPrefix['id'] . '.png';
                 if (file_exists('resource://' . $splitPrefix['packageKey'] . '/Public/' . $relativePathAndFilename)) {
                     $thumbnailUrl = $this->resourceManager->getPublicPackageResourceUri($splitPrefix['packageKey'], $relativePathAndFilename);
                 }
             }
             if ($thumbnailUrl !== '') {
                 $helpMessage = '![alt text](' . $thumbnailUrl . ') ' . $helpMessage;
             }
         }
         if ($helpMessage !== '') {
             $helpMessage = $this->markdownConverter->convertToHtml($helpMessage);
             $helpMessage = $this->addTargetAttribute($helpMessage);
         }
     }
     $configuration['ui']['help']['message'] = $helpMessage;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:49,代码来源:NodeTypeConfigurationEnrichmentAspect.php

示例10: render

 /**
  * Render the URI to the resource. The filename is used from child content.
  *
  * @param string $path The location of the resource, can be either a path relative to the Public resource directory of the package or a resource://... URI
  * @param string $package Target package key. If not set, the current package key will be used
  * @param Resource $resource If specified, this resource object is used instead of the path and package information
  * @param boolean $localize Whether resource localization should be attempted or not
  * @return string The absolute URI to the resource
  * @throws InvalidVariableException
  * @api
  */
 public function render($path = NULL, $package = NULL, Resource $resource = NULL, $localize = TRUE)
 {
     if ($resource !== NULL) {
         $uri = $this->resourceManager->getPublicPersistentResourceUri($resource);
         if ($uri === FALSE) {
             $uri = '404-Resource-Not-Found';
         }
     } else {
         if ($path === NULL) {
             throw new InvalidVariableException('The ResourceViewHelper did neither contain a valuable "resource" nor "path" argument.', 1353512742);
         }
         if ($package === NULL) {
             $package = $this->controllerContext->getRequest()->getControllerPackageKey();
         }
         if (strpos($path, 'resource://') === 0) {
             $matches = array();
             if (preg_match('#^resource://([^/]+)/Public/(.*)#', $path, $matches) === 1) {
                 $package = $matches[1];
                 $path = $matches[2];
             } else {
                 throw new InvalidVariableException(sprintf('The path "%s" which was given to the ResourceViewHelper must point to a public resource.', $path), 1353512639);
             }
         }
         if ($localize === TRUE) {
             $resourcePath = 'resource://' . $package . '/Public/' . $path;
             $localizedResourcePathData = $this->i18nService->getLocalizedFilename($resourcePath);
             $matches = array();
             if (preg_match('#resource://([^/]+)/Public/(.*)#', current($localizedResourcePathData), $matches) === 1) {
                 $package = $matches[1];
                 $path = $matches[2];
             }
         }
         $uri = $this->resourceManager->getPublicPackageResourceUri($package, $path);
     }
     return $uri;
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:47,代码来源:ResourceViewHelper.php

示例11: getAssetProperties

 /**
  * @param Asset $asset
  * @return array
  */
 protected function getAssetProperties(Asset $asset)
 {
     $thumbnail = $this->getAssetThumbnailImage($asset, 16, 16);
     $assetProperties = array('assetUuid' => $this->persistenceManager->getIdentifierByObject($asset), 'filename' => $asset->getResource()->getFilename(), 'previewImageResourceUri' => $this->resourceManager->getPublicPackageResourceUri($thumbnail['package'], $thumbnail['src']), 'previewSize' => array('w' => $thumbnail['width'], 'h' => $thumbnail['height']));
     return $assetProperties;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:10,代码来源:ContentController.php

示例12: render

    /**
     * @param array $items array of Resources,Assets or strings (uri)
     * @param string $id of the carousel instance
     * @param string $class class attribute of carousel element
     * @param bool $autoinclude include scripts and styles if not already done
     * @param int $numItems number of items to display at once
     * @param bool $itemsScaleUp scale up carousel items
     * @param bool $singleItem always display a single item
     * @param bool $showNavigation show carousel navigation
     * @param bool $pagination enable pagination
     * @param int $paginationSpeed speed of the pagination
     * @param bool $paginationNumbers show pagination numbers
     * @param bool $rewindNavigation rewind navigation on end
     * @param bool $autoplay enable autoplay
     * @param int $autoplaySpeed speed of autoplay
     * @param bool $pauseOnHover pause autoplay on hover
     * @param bool $loop loop animation instead of rewind
     * @param bool $isResponsive enable responsive design
     * @param array<string,int> $responsiveConfig responsive configuration array("{minScreenSize}" => [numElements],...))
     * @param int $itemMaxWidth image thumbnail max width
     * @param int $itemMaxHeight image thumbnail max height
     * @param bool $itemAllowCropping allow cropping thumbnails
     * @param bool $itemAllowUpscaling allow upscaling thumbnails
     *
     * @return string
     */
    public function render($items, $id = null, $class = null, $autoinclude = true, $numItems = 1, $itemsScaleUp = true, $singleItem = true, $showNavigation = true, $pagination = true, $paginationSpeed = 800, $paginationNumbers = true, $rewindNavigation = true, $autoplay = true, $autoplaySpeed = 200, $pauseOnHover = true, $loop = true, $isResponsive = false, $responsiveConfig = array("0" => 1, "479" => 2, "768" => 3, "1199" => 5), $itemMaxWidth = null, $itemMaxHeight = null, $itemAllowCropping = false, $itemAllowUpscaling = false)
    {
        if ($id == null) {
            $id = 'oc' . md5(microtime());
        }
        if ($class == null) {
            $class = 'owl-carousel';
        } else {
            $class .= ' owl-carousel';
        }
        //build config array
        $config = array();
        $config['items'] = $numItems;
        $config['itemsScaleUp'] = $itemsScaleUp;
        $config['singleItem'] = $singleItem;
        $config['nav'] = $showNavigation;
        $config['pagination'] = $pagination;
        $config['paginationSpeed'] = $paginationSpeed;
        $config['paginationNumbers'] = $paginationNumbers;
        $config['rewindNav'] = $rewindNavigation;
        $config['autoplay'] = $autoplay;
        $config['autoplaySpeed'] = $autoplaySpeed;
        $config['autoplayHoverPause'] = $pauseOnHover;
        $config['loop'] = $loop;
        $config['responsiveClass'] = $isResponsive;
        //include dependencies if necessary
        $includeContent = '';
        if ($autoinclude) {
            $viewHelper = $this->objectManager->get('Axovis\\Flow\\Owlcarousel\\ViewHelpers\\IncludeViewHelper');
            $includeContent = $viewHelper->render(true, 'remaining');
        }
        //build items content
        $itemsContent = '';
        foreach ($items as $item) {
            $title = '';
            $caption = '';
            if ($item instanceof Resource) {
                $uri = $this->resourceManager->getPublicPersistentResourceUri($item);
            } else {
                if ($item instanceof Asset) {
                    $thumbnailConfiguration = new ThumbnailConfiguration(null, $itemMaxWidth, null, $itemMaxHeight, $itemAllowCropping, $itemAllowUpscaling, false);
                    $uri = $this->assetService->getThumbnailUriAndSizeForAsset($item, $thumbnailConfiguration)['src'];
                    //$uri = $this->resourceManager->getPublicPersistentResourceUri($item->getResource());
                    $title = $item->getTitle();
                    $caption = $item->getCaption();
                } else {
                    if (is_string($item)) {
                        $uri = $item;
                    } else {
                        $title = 'Dummy Image';
                        $uri = $this->resourceManager->getPublicPackageResourceUri('Axovis.Flow.Owlcarousel', 'Images/dummy-image.png');
                    }
                }
            }
            $itemsContent .= '
                <div class="item">
                    <div>
                        <img src="' . $uri . '" title="' . $title . '" alt="' . $title . '" />
                        <div class="carousel-caption">
                            ' . $caption . '
                        </div>
                    </div>
                </div>
            ';
        }
        //build responsive config content
        $responsiveConfigContent = '';
        if ($isResponsive) {
            $responsiveConfigContent = 'config.responsive = {};';
            foreach ($responsiveConfig as $screen => $numItems) {
                $responsiveConfigContent .= '
                    config.responsive["' . $screen . '"] = {};
                    config.responsive["' . $screen . '"].items = ' . $numItems . ';
                ';
//.........这里部分代码省略.........
开发者ID:axovis,项目名称:Axovis.Flow.Owlcarousel,代码行数:101,代码来源:CarouselViewHelper.php


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