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


PHP AssetFactory::getLastModified方法代码示例

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


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

示例1: process

 public function process(AssetInterface $asset, AssetFactory $factory)
 {
     $path = $asset->getTargetPath();
     $ext = pathinfo($path, PATHINFO_EXTENSION);
     $lastModified = $factory->getLastModified($asset);
     if (null !== $lastModified) {
         $path = substr_replace($path, "{$lastModified}.{$ext}", -1 * strlen($ext));
         $asset->setTargetPath($path);
     }
 }
开发者ID:widmogrod,项目名称:zf2-assetic-module,代码行数:10,代码来源:LastModifiedStrategy.php

示例2: getHash

 protected function getHash(AssetInterface $asset, AssetFactory $factory)
 {
     $hash = hash_init('sha1');
     hash_update($hash, $factory->getLastModified($asset));
     if ($asset instanceof AssetCollectionInterface) {
         foreach ($asset as $i => $leaf) {
             $sourcePath = $leaf->getSourcePath();
             hash_update($hash, $sourcePath ?: $i);
         }
     }
     return substr(hash_final($hash), 0, 7);
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:12,代码来源:CacheBustingWorker.php

示例3: prepareRequest

 /**
  * Combines asset file references of a single type to produce
  * a URL reference to the combined contents.
  * @param array $assets List of asset files.
  * @param string $localPath File extension, used for aesthetic purposes only.
  * @return string URL to contents.
  */
 protected function prepareRequest(array $assets, $localPath = null)
 {
     if (substr($localPath, -1) != '/') {
         $localPath = $localPath . '/';
     }
     $this->localPath = $localPath;
     $this->storagePath = storage_path('cms/combiner/assets');
     list($assets, $extension) = $this->prepareAssets($assets);
     /*
      * Cache and process
      */
     $cacheKey = $this->getCacheKey($assets);
     $cacheInfo = $this->useCache ? $this->getCache($cacheKey) : false;
     if (!$cacheInfo) {
         $this->setHashOnCombinerFilters($cacheKey);
         $combiner = $this->prepareCombiner($assets);
         if ($this->useDeepHashing) {
             $factory = new AssetFactory($this->localPath);
             $lastMod = $factory->getLastModified($combiner);
         } else {
             $lastMod = $combiner->getLastModified();
         }
         $cacheInfo = ['version' => $cacheKey . '-' . $lastMod, 'etag' => $cacheKey, 'lastMod' => $lastMod, 'files' => $assets, 'path' => $this->localPath, 'extension' => $extension];
         $this->putCache($cacheKey, $cacheInfo);
     }
     return $this->getCombinedUrl($cacheInfo['version']);
 }
开发者ID:jiiis,项目名称:ptn,代码行数:34,代码来源:CombineAssets.php

示例4: writeAssets

 /**
  * Write collection in web folder
  *
  * @param Assetic\Factory\AssetFactory $assetFactory
  * @param string $file
  */
 protected function writeAssets($assetFactory, $file, $web, $tragetFile)
 {
     if (true === $this->lastModifedHandler($assetFactory->getLastModified(), $file, $web . $tragetFile)) {
         $writer = new AssetWriter($web);
         $writer->writeAsset($assetFactory);
     }
 }
开发者ID:jochum-mediaservices,项目名称:contentinum5.5,代码行数:13,代码来源:Manager.php


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