當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。