当前位置: 首页>>代码示例>>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;未经允许,请勿转载。