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


PHP AssetFactory::setFilterManager方法代碼示例

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


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

示例1: setUp

 protected function setUp()
 {
     if (!class_exists('Twig_Environment')) {
         $this->markTestSkipped('Twig is not installed.');
     }
     $this->am = $this->getMock('Assetic\\AssetManager');
     $this->fm = $this->getMock('Assetic\\FilterManager');
     $this->valueSupplier = $this->getMock('Assetic\\ValueSupplierInterface');
     $this->factory = new AssetFactory(__DIR__ . '/templates');
     $this->factory->setAssetManager($this->am);
     $this->factory->setFilterManager($this->fm);
     $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem(__DIR__ . '/templates'));
     $this->twig->addExtension(new AsseticExtension($this->factory, array(), $this->valueSupplier));
 }
開發者ID:selimcr,項目名稱:servigases,代碼行數:14,代碼來源:AsseticExtensionTest.php

示例2: getMinifiedAsset

 private function getMinifiedAsset()
 {
     if (!(new SplFileInfo($this->asset->getPath()))->isWritable()) {
         throw new Exception("path " . $this->asset->getPath() . " is not writable");
     }
     $factory = new AssetFactory($this->asset->getPath());
     $factory->addWorker(new CacheBustingWorker());
     $factory->setDefaultOutput('*');
     $fm = new FilterManager();
     $fm->set('min', $this->filter);
     $factory->setFilterManager($fm);
     $asset = $factory->createAsset(call_user_func(function ($files) {
         $r = [];
         foreach ($files as $file) {
             $r[] = $file['fs'];
         }
         return $r;
     }, $this->files), ['min'], ['name' => $this->asset->getBasename()]);
     // only write the asset file if it does not already exist..
     if (!file_exists($this->asset->getPath() . DIRECTORY_SEPARATOR . $asset->getTargetPath())) {
         $writer = new AssetWriter($this->asset->getPath());
         $writer->writeAsset($asset);
         // TODO: write some code to garbage collect files of a certain age?
         // possible alternative, modify CacheBustingWorker to have option
         // to append a timestamp instead of a hash
     }
     return $asset;
 }
開發者ID:evalok,項目名稱:php-assetify,代碼行數:28,代碼來源:Minifier.php

示例3: getAsseticFactory

 protected function getAsseticFactory()
 {
     if (empty($this->config["input_path"][0])) {
         throw new \Exception('Empty input path');
     }
     $factory = new AssetFactory($this->config["input_path"][0], $this->config["debug"]);
     $factory->setDefaultOutput("");
     // add a FilterManager to the AssetFactory
     $fm = new FilterManager();
     $factory->setFilterManager($fm);
     // adding some filters to the filter manager
     if ($this->config["less_filter"]) {
         $lessphpFilter = new LessphpFilter();
         if ($this->lessPresets) {
             $lessphpFilter->setPresets($this->lessPresets);
         }
         $fm->set("less", $lessphpFilter);
     }
     if ($this->config["scss_filter"]) {
         $scssFilter = new ScssphpFilter();
         $fm->set("scss", $scssFilter);
     }
     $fm->set("min", new CssMinFilter());
     return $factory;
 }
開發者ID:sugiphp,項目名稱:assets,代碼行數:25,代碼來源:CssPacker.php

示例4: getAssetFactory

 /**
  * @param $rootPath
  * @param $debug
  * @return AssetFactory
  */
 private function getAssetFactory($rootPath, $debug)
 {
     $filterManager = new FilterManager();
     $filterManager->set('yui_js', new JsCompressorFilter(dirname(__DIR__) . '/../optimizers/yuicompressor/yuicompressor-2.4.7.jar'));
     $assetFactory = new AssetFactory($rootPath, $debug);
     $assetFactory->setFilterManager($filterManager);
     $assetFactory->setAssetManager(new AssetManager());
     return $assetFactory;
 }
開發者ID:eberhm,項目名稱:phoenix,代碼行數:14,代碼來源:Optimizer.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->am = $this->getMock('Assetic\\AssetManager');
     $this->fm = $this->getMock('Assetic\\FilterManager');
     $factory = new AssetFactory(__DIR__ . '/templates');
     $factory->setAssetManager($this->am);
     $factory->setFilterManager($this->fm);
     $this->engine->addExtension(new AsseticExtensionForTest($factory));
     $this->loader = new SmartyFormulaLoader($this->engine);
 }
開發者ID:Danack,項目名稱:SmartyBundle,代碼行數:11,代碼來源:SmartyFormulaLoaderTest.php

示例6: build

 /**
  * Builds the AssetFactory object
  *
  * @return \Assetic\Factory\AssetFactory
  */
 public function build()
 {
     $assetManager = new AssetManager();
     $filterManager = new FilterManager();
     foreach ($this->filters as $filterName => $filter) {
         $filterManager->set($filterName, $filter);
     }
     $assetsFactory = new AssetFactory($this->configurationHandler->webDir());
     $assetsFactory->setAssetManager($assetManager);
     $assetsFactory->setFilterManager($filterManager);
     return $assetsFactory;
 }
開發者ID:redkite-labs,項目名稱:redkitecms-framework,代碼行數:17,代碼來源:AsseticFactoryBuilder.php

示例7: factoryAf

 protected function factoryAf()
 {
     $uglify = new UglifyJs2Filter("/usr/bin/uglifyjs", "/usr/bin/node");
     $uglify->setCompress(true);
     $uglify->setMangle(true);
     $uglify->setCompress(true);
     $factory = new AssetFactory(__DIR__ . "/../");
     $filterManager = new FilterManager();
     $filterManager->set("uglify", $uglify);
     $factory->setFilterManager($filterManager);
     return $factory;
 }
開發者ID:jeanpasqualini-lesson,項目名稱:lesson-assetic,代碼行數:12,代碼來源:MainTest.php

示例8: configureAssetTools

 protected function configureAssetTools()
 {
     $fm = new FilterManager();
     $fm->set('less', new LessphpFilter());
     $fm->set('cssrewrite', new AssetCssUriRewriteFilter());
     $fm->set('cssmin', new CssMinFilter());
     $fm->set('jscompile', new CompilerApiFilter());
     //$fm->set('jscompilejar', new CompilerJarFilter(storage_path('jar/compiler.jar')));
     $factory = new AssetFactory(Config::get('asset-manager::asset.paths.asset_path'));
     $factory->setFilterManager($fm);
     $factory->setDebug(Config::get('app.debug'));
     $this->assetFactory = $factory;
 }
開發者ID:dustingraham,項目名稱:asset-manager,代碼行數:13,代碼來源:AssetCompiler.php

示例9: getAsseticFactory

 protected function getAsseticFactory()
 {
     if (empty($this->config["input_path"][0])) {
         throw new \Exception("Empty input path");
     }
     $factory = new AssetFactory($this->config["input_path"][0], $this->config["debug"]);
     $factory->setDefaultOutput("");
     // add a FilterManager to the AssetFactory
     $fm = new FilterManager();
     $factory->setFilterManager($fm);
     $fm->set("jshrink", new JShrinkFilter());
     return $factory;
 }
開發者ID:sugiphp,項目名稱:assets,代碼行數:13,代碼來源:JsPacker.php

示例10: renderThemeAssets

 public function renderThemeAssets()
 {
     $conf = (array) $this->getThemeAssets();
     $factory = new Factory\AssetFactory($conf['root_path']);
     $factory->setAssetManager($this->getAssetManager());
     $factory->setFilterManager($this->getFilterManager());
     $factory->setDebug($this->configuration->isDebug());
     $mobileDetect = $this->serviceManager->get('dxMobileDetect');
     $isTablet = $mobileDetect->isTablet();
     $assetName = 'assets';
     $filterName = 'filters';
     $optionName = 'options';
     $outputName = 'output';
     if ($mobileDetect->isMobile()) {
         $assetName = $assetName . 'Mobile';
         $filterName = $filterName . 'Mobile';
         $optionName = $optionName . 'Mobile';
         $outputName = $outputName . 'Mobile';
     }
     if ($mobileDetect->isTablet()) {
         $assetName = $assetName . 'Tablet';
         $filterName = $filterName . 'Tablet';
         $optionName = $optionName . 'Tablet';
         $outputName = $outputName . 'Mobile';
     }
     $collections = (array) $conf['collections'];
     foreach ($collections as $name => $options) {
         $assets = isset($options[$assetName]) ? $options[$assetName] : isset($options['assets']) ? $options['assets'] : array();
         $filtersx = isset($options[$filterName]) ? $options[$filterName] : isset($options['filters']) ? $options['filters'] : array();
         $options = isset($options[$optionName]) ? $options[$optionName] : isset($options['options']) ? $options['options'] : array();
         $options['output'] = isset($options[$outputName]) ? $options[$outputName] : isset($options['output']) ? $options['output'] : $name;
         $filters = $this->initFilters($filtersx);
         /** @var $asset \Assetic\Asset\AssetCollection */
         $asset = $factory->createAsset($assets, $filters, $options);
         # allow to move all files 1:1 to new directory
         # its particulary usefull when this assets are images.
         if (isset($options['move_raw']) && $options['move_raw']) {
             foreach ($asset as $key => $value) {
                 $name = md5($value->getSourceRoot() . $value->getSourcePath());
                 $value->setTargetPath($value->getSourcePath());
                 $value = $this->cache($value);
                 $this->assetManager->set($name, $value);
             }
         } else {
             $asset = $this->cache($asset);
             $this->assetManager->set($name, $asset);
         }
     }
     $writer = new AssetWriter($this->configuration->getWebPath());
     $writer->writeManagerAssets($this->assetManager);
 }
開發者ID:dennesabing,項目名稱:dxapp,代碼行數:51,代碼來源:ThemeAssets.php

示例11: setUp

 protected function setUp()
 {
     if (!class_exists('Twig_Environment')) {
         $this->markTestSkipped('Twig is not installed.');
     }
     $this->am = $this->getMock('Assetic\\AssetManager');
     $this->fm = $this->getMock('Assetic\\FilterManager');
     $factory = new AssetFactory(__DIR__ . '/templates');
     $factory->setAssetManager($this->am);
     $factory->setFilterManager($this->fm);
     $twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'));
     $twig->addExtension(new AsseticExtension($factory, array('some_func' => array('filter' => 'some_filter', 'options' => array('output' => 'css/*.css')))));
     $this->loader = new TwigFormulaLoader($twig);
 }
開發者ID:selimcr,項目名稱:servigases,代碼行數:14,代碼來源:TwigFormulaLoaderTest.php

示例12: init

 /**
  * {@inheritDoc}
  */
 public function init(Application $app)
 {
     $app['assets'] = $app->share(function () use($app) {
         $assetManager = new AssetManager();
         $filterManager = new FilterManager();
         $filterManager->set('less', new LessphpFilter());
         $filterManager->set('cssmin', new CssMinFilter());
         $filterManager->set('jsmin', new JSqueezeFilter());
         $factory = new AssetFactory($app['assets.path']);
         $factory->setAssetManager($assetManager);
         $factory->setFilterManager($filterManager);
         $factory->setDefaultOutput('misc/*');
         return $factory;
     });
 }
開發者ID:lukezbihlyj,項目名稱:silex-assets,代碼行數:18,代碼來源:Module.php

示例13: setUp

    protected function setUp()
    {
        if (!class_exists('Twig_Environment')) {
            $this->markTestSkipped('Twig is not installed.');
        }

        $this->am = $this->getMock('Assetic\\AssetManager');
        $this->fm = $this->getMock('Assetic\\FilterManager');

        $factory = new AssetFactory(__DIR__.'/templates');
        $factory->setAssetManager($this->am);
        $factory->setFilterManager($this->fm);

        $twig = new \Twig_Environment();
        $twig->addExtension(new AsseticExtension($factory));

        $this->loader = new TwigFormulaLoader($twig);
    }
開發者ID:naderman,項目名稱:assetic,代碼行數:18,代碼來源:TwigFormulaLoaderTest.php

示例14: register

 /**
  *
  * @param  Application $app
  */
 function register(Application $app)
 {
     $app['assetic.asset.root'] = '';
     $app['assetic.asset.output_root'] = '';
     $app['assetic.debug'] = false;
     $app['assetic.filter'] = array();
     $app['assetic.filter.default'] = array('cssmin' => '\\Assetic\\Filter\\CssMinFilter', 'cssrewrite' => '\\Assetic\\Filter\\CssRewriteFilter');
     $app['assetic.filter_manager'] = $app->share(function ($app) {
         $filterManager = new FilterManager();
         return $filterManager;
     });
     $app['assetic.asset_manager'] = $app->share(function ($app) {
         $assetManager = new AssetManager();
         return $assetManager;
     });
     $app['assetic.asset_factory'] = $app->share(function ($app) {
         $assetFactory = new AssetFactory($app['assetic.asset.root']);
         $assetFactory->setDefaultOutput($app['assetic.asset.output_root']);
         $assetFactory->setFilterManager($app['assetic.filter_manager']);
         $assetFactory->setAssetManager($app['assetic.asset_manager']);
         $assetFactory->setDebug($app['assetic.debug']);
         return $assetFactory;
     });
     $app['assetic.lazy_asset_manager'] = $app->share(function ($app) {
         $lazyAssetManager = new LazyAssetManager($app['assetic.asset_factory']);
         $lazyAssetManager->setLoader('twig', new TwigAsseticIntegrationFormulaLoader($app['twig'], null, $app));
         return $lazyAssetManager;
     });
     $app['assetic.asset_writer'] = $app->share(function ($app) {
         $assetWriter = new AssetWriter($app['assetic.asset.output_root']);
         return $assetWriter;
     });
     /*
      * Twig
      *
      */
     // Replace Twig loader
     $app['twig.loader.filesystem'] = $app->share(function ($app) {
         return new \Wake\Twig_AsseticLoader_Filesystem($app['twig.path']);
     });
     $app['twig.loader'] = $app->share(function ($app) {
         return new \Wake\Twig_AsseticLoader_Chain(array($app['twig.loader.array'], $app['twig.loader.filesystem']));
     });
 }
開發者ID:wake,項目名稱:twig-assetic-integration-provider,代碼行數:48,代碼來源:TwigAsseticIntegrationProvider.php

示例15: register

 public function register()
 {
     // Register the asset manager singleton
     $this->app->bindShared('Concrete\\Package\\AssetPipeline\\Src\\Asset\\UtilityInterface', function ($app) {
         return new AssetUtility($app);
     });
     // Register filter settings repository singleton
     $this->app->singleton('Concrete\\Package\\AssetPipeline\\Src\\Asset\\Filter\\SettingsRepositoryInterface', 'Concrete\\Package\\AssetPipeline\\Src\\Asset\\Filter\\SettingsRepository');
     // Register Assetic's AssetFactory
     $this->app->bindShared('Assetic\\Factory\\AssetFactory', function ($app) {
         $am = new AssetManager();
         $fm = new FilterManager();
         $factory = new AssetFactory(DIR_BASE);
         $factory->setAssetManager($am);
         $factory->setFilterManager($fm);
         return $factory;
     });
     $singletons = array('helper/assets' => '\\Concrete\\Package\\AssetPipeline\\Src\\Service\\Assets');
     foreach ($singletons as $key => $value) {
         $this->app->singleton($this->pkgHandle . '/' . $key, $value);
     }
 }
開發者ID:mainio,項目名稱:c5_asset_pipeline,代碼行數:22,代碼來源:PackageServiceProvider.php


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