當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AssetInterface::ensureFilter方法代碼示例

本文整理匯總了PHP中Assetic\Asset\AssetInterface::ensureFilter方法的典型用法代碼示例。如果您正苦於以下問題:PHP AssetInterface::ensureFilter方法的具體用法?PHP AssetInterface::ensureFilter怎麽用?PHP AssetInterface::ensureFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Assetic\Asset\AssetInterface的用法示例。


在下文中一共展示了AssetInterface::ensureFilter方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dump

 public function dump(AssetInterface $asset)
 {
     $writer = new \Assetic\AssetWriter(sys_get_temp_dir(), $this->container->getParameter('assetic.variables'));
     $ref = new \ReflectionMethod($writer, 'getCombinations');
     $ref->setAccessible(true);
     $name = $asset->getSourcePath();
     $type = substr($name, strrpos($name, '.') + 1);
     switch ($type) {
         case 'coffee':
             $asset->ensureFilter($this->container->get('assetic.filter.coffee'));
             $type = 'js';
             break;
         case 'less':
             $asset->ensureFilter($this->container->get('assetic.filter.less'));
             $type = 'css';
             break;
     }
     $combinations = $ref->invoke($writer, $asset->getVars());
     $asset->setValues($combinations[0]);
     $asset->load();
     $content = $asset->getContent();
     // because the assetic cssrewrite makes bullshit here, we need to reimplement the filter
     if ($type === 'css') {
         $content = $this->cssFilter($content, '/' . dirname($asset->getSourcePath()));
     }
     return $content;
 }
開發者ID:roomthirteen,項目名稱:Room13AsseticServerBundle,代碼行數:27,代碼來源:DumpAssetCommand.php

示例2: process

 public function process(AssetInterface $asset)
 {
     if (0 < preg_match($this->pattern, $asset->getTargetUrl())) {
         $asset->ensureFilter($this->filter);
     }
     return $asset;
 }
開發者ID:norwayapp,項目名稱:Invest,代碼行數:7,代碼來源:EnsureFilterWorker.php

示例3: createInnerAsset

 private function createInnerAsset()
 {
     if ($this->innerAsset) {
         throw new RuntimeException('The inner asset must be created only once.');
     }
     $this->innerAsset = $this->factory->parseInputWithFixedValues($this->input, $this->currentDir, $this->roots, $this->vars, $this->values);
     foreach ($this->filters as $filter) {
         $this->innerAsset->ensureFilter($filter);
     }
     if (null !== $this->content) {
         $this->innerAsset->setContent($this->content);
     }
     if (null !== $this->targetPath) {
         $this->innerAsset->setTargetPath($this->targetPath);
     }
     // GC
     $this->factory = null;
     $this->input = null;
     $this->currentDir = null;
     $this->roots = null;
     $this->content = null;
     $this->targetPath = null;
 }
開發者ID:puli,項目名稱:assetic-extension,代碼行數:23,代碼來源:LazyAsset.php

示例4: applyFilters

 private function applyFilters(AssetInterface $asset, $fileType)
 {
     if ($fileType == 'css') {
         $asset->ensureFilter(new CssRewriteFilter());
         //NECESSARY FOR IMAGE PATHS
     }
 }
開發者ID:mpoiriert,項目名稱:nucleus,代碼行數:7,代碼來源:Manager.php

示例5: process

 public function process(AssetInterface $asset, AssetFactory $factory)
 {
     if (self::CHECK_SOURCE === (self::CHECK_SOURCE & $this->flags) && preg_match($this->pattern, $asset->getSourcePath()) || self::CHECK_TARGET === (self::CHECK_TARGET & $this->flags) && preg_match($this->pattern, $asset->getTargetPath())) {
         $asset->ensureFilter($this->filter);
     }
 }
開發者ID:BusinessCookies,項目名稱:CoffeeMachineProject,代碼行數:6,代碼來源:EnsureFilterWorker.php

示例6: ensureByFilter

 /**
  * Ensure that the filters as filter are set.
  *
  * @param   AssetInterface  $asset
  * @param   mixed           $filter    Either an instance of FilterInterface or a classname.
  * @throws  Exception\RuntimeException
  */
 protected function ensureByFilter(AssetInterface $asset, $filter)
 {
     if ($filter instanceof FilterInterface) {
         $filterInstance = $filter;
         $asset->ensureFilter($filterInstance);
         return;
     }
     $filterClass = $filter;
     if (!is_subclass_of($filterClass, 'Assetic\\Filter\\FilterInterface', true)) {
         $filterClass .= substr($filterClass, -6) === 'Filter' ? '' : 'Filter';
         $filterClass = 'Assetic\\Filter\\' . $filterClass;
     }
     if (!class_exists($filterClass)) {
         throw new Exception\RuntimeException('No filter found for ' . $filter);
     }
     if (!isset($this->filterInstances[$filterClass])) {
         $this->filterInstances[$filterClass] = new $filterClass();
     }
     $filterInstance = $this->filterInstances[$filterClass];
     $asset->ensureFilter($filterInstance);
 }
開發者ID:crsoares,項目名稱:assetmanager,代碼行數:28,代碼來源:AssetFilterManager.php

示例7: ensureFilter

 /**
  * Ensures the current asset includes the supplied filter.
  *
  * @param FilterInterface $filter
  */
 public function ensureFilter(FilterInterface $filter)
 {
     $this->asset->ensureFilter($filter);
 }
開發者ID:sunnyct,項目名稱:silexcmf-assetic,代碼行數:9,代碼來源:AssetCache.php

示例8: cleanFilters

 /**
  * Clean filters, remove css-rewrite filter and inherit collection filters.
  *
  * @param AssetInterface $asset            The asset.
  * @param array          $inheritedFilters The inherited filters.
  *
  * @return void
  */
 private function cleanFilters(AssetInterface $asset, array $inheritedFilters)
 {
     // remove css-rewrite filter
     $filters = $asset->getFilters();
     $asset->clearFilters();
     foreach ($filters as $filter) {
         if (!$filter instanceof CssRewriteFilter) {
             $asset->ensureFilter($filter);
         }
     }
     // inherit filters
     foreach ($inheritedFilters as $filter) {
         if (!$filter instanceof CssRewriteFilter) {
             $asset->ensureFilter($filter);
         }
     }
 }
開發者ID:bit3,項目名稱:contao-theme-plus,代碼行數:25,代碼來源:AssetOrganizerSubscriber.php

示例9: process

 /**
  * Processes an asset.
  *
  * @param AssetInterface $asset An asset
  * @param Boolean        $debug Debug mode
  */
 public function process(AssetInterface $asset, $debug = false)
 {
     if ((null === $this->debug || $this->debug === $debug) && preg_match($this->pattern, $asset->getTargetUrl())) {
         $asset->ensureFilter($this->filter);
     }
 }
開發者ID:nresni,項目名稱:symfony-sandbox,代碼行數:12,代碼來源:EnsureFilterWorker.php


注:本文中的Assetic\Asset\AssetInterface::ensureFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。