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


PHP Engines\EngineResolver类代码示例

本文整理汇总了PHP中Illuminate\View\Engines\EngineResolver的典型用法代码示例。如果您正苦于以下问题:PHP EngineResolver类的具体用法?PHP EngineResolver怎么用?PHP EngineResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * Template constructor.
  *
  * @param Container $container
  */
 public function __construct(Container $container)
 {
     $settings = $container->get('settings');
     $compiledPath = $settings['storagePath'] . DIRECTORY_SEPARATOR . 'views';
     $resolver = new EngineResolver();
     $resolver->register('blade', function () use($compiledPath, &$settings) {
         $bladeCompiler = new BladeCompiler(new Filesystem(), $compiledPath);
         // Add the @webroot directive.
         $bladeCompiler->directive('webroot', function ($expression) use(&$settings) {
             $segments = explode(',', preg_replace("/[\\(\\)\\\"\\']/", '', $expression));
             $path = rtrim($settings['webrootBasePath'], '/') . '/' . ltrim($segments[0], '/');
             $path = str_replace("'", "\\'", $path);
             return "<?= e('{$path}') ?>";
         });
         // Add the @route directive.
         $bladeCompiler->directive('route', function ($expression) use(&$settings) {
             $segments = explode(',', preg_replace("/[\\(\\)\\\"\\']/", '', $expression));
             $path = rtrim($settings['routeBasePath'], '/') . '/' . ltrim($segments[0], '/');
             $path = str_replace("'", "\\'", $path);
             return "<?= e('{$path}') ?>";
         });
         return new CompilerEngine($bladeCompiler);
     });
     $finder = new FileViewFinder(new Filesystem(), [$settings['templatePath']]);
     $factory = new ViewFactory($resolver, $finder, new Dispatcher());
     $this->factory = $factory;
     $this->container = $container;
 }
开发者ID:garbetjie,项目名称:tiny,代码行数:33,代码来源:TemplateRenderer.php

示例2: __construct

 public function __construct()
 {
     $this->instance('container', $this);
     $this->singleton('events', function () {
         return new Dispatcher();
     });
     $this->singleton('files', function () {
         return new Filesystem();
     });
     $this->singleton('blade.compiler', function () {
         return new BladeCompiler($this['files'], $this['view.compiled']);
     });
     $this->singleton('view.engine.resolver', function () {
         $resolver = new EngineResolver();
         $resolver->register('blade', function () {
             return new CompilerEngine($this['blade.compiler'], $this['files']);
         });
         $resolver->register('php', function () {
             return new PhpEngine();
         });
         return $resolver;
     });
     $this->singleton('view.finder', function () {
         return new FileViewFinder($this['files'], $this['view.paths']);
     });
     $this->singleton('view', function () {
         $env = new Factory($this['view.engine.resolver'], $this['view.finder'], $this['events']);
         $env->setContainer($this['container']);
         return $env;
     });
 }
开发者ID:ngangchill,项目名称:ronin-blade,代码行数:31,代码来源:Container.php

示例3: registerTwigEngine

 /**
  * Register the Twig engine to the EngineResolver.
  * 
  * @param string         $engine
  * @param EngineResolver $resolver
  */
 protected function registerTwigEngine($engine, EngineResolver $resolver)
 {
     $container = $this->app;
     $resolver->register($engine, function () use($container) {
         // Set the loader main namespace (paths).
         $container['twig.loader']->setPaths($container['view.finder']->getPaths());
         return new TwigEngine($container['twig'], $container['view.finder']);
     });
 }
开发者ID:themosis,项目名称:framework,代码行数:15,代码来源:ViewServiceProvider.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->mock_view_finder = Mockery::mock('Illuminate\\View\\ViewFinderInterface')->shouldIgnoreMissing();
     $this->mock_engine_resolver = Mockery::mock('Illuminate\\View\\Engines\\EngineResolver')->shouldIgnoreMissing();
     $this->mock_translator = Mockery::mock('\\Illuminate\\Translation\\Translator')->shouldIgnoreMissing();
     $this->mock_session = Mockery::mock('\\Illuminate\\Session\\Store')->shouldIgnoreMissing();
     $this->mock_dispatcher = Mockery::mock('\\Illuminate\\Contracts\\Events\\Dispatcher')->shouldIgnoreMissing();
     $this->mock_engine_resolver->shouldReceive('resolve')->andReturn(Mockery::mock('\\Illuminate\\View\\Engines\\EngineInterface')->shouldIgnoreMissing());
     $this->factory = new Factory($this->mock_engine_resolver, $this->mock_view_finder, $this->mock_dispatcher, $this->mock_translator);
     $this->factory->setSession($this->mock_session);
 }
开发者ID:SerdarSanri,项目名称:simplemessage,代码行数:12,代码来源:ViewTest.php

示例5: registerJadeEngine

 /**
  * Register the Jade engine implementation.
  *
  * @param \Illuminate\View\Engines\EngineResolver $resolver
  */
 public function registerJadeEngine(EngineResolver $resolver)
 {
     $app = $this->app;
     $app->singleton('jade.compiler', function ($app) {
         $cache = $app['config']['view.compiled'];
         return new JadeCompiler($app['files'], $cache);
     });
     $resolver->register('jade', function () use($app) {
         return new CompilerEngine($app['jade.compiler'], $app['files']);
     });
     $app['view']->addExtension('jade.php', 'jade');
 }
开发者ID:linchpinstudios,项目名称:laravel-jade,代码行数:17,代码来源:ServiceProvider.php

示例6: __construct

 public function __construct($viewsDir, $cacheDir)
 {
     $filesystem = new Filesystem();
     $engineResolver = new EngineResolver();
     $engineResolver->register('blade', function () use($filesystem, $cacheDir) {
         return new CompilerEngine(new BladeCompiler($filesystem, $cacheDir));
     });
     $factory = new Factory($engineResolver, new FileViewFinder($filesystem, [$viewsDir]), new Dispatcher());
     $this->factory = $factory;
     $this->viewsDir = $viewsDir;
     $this->filesystem = $filesystem;
 }
开发者ID:wilgucki,项目名称:blade-builder,代码行数:12,代码来源:App.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param   Factory  $renderer  Rendering engine
  *
  * @since   __DEPLOY_VERSION__
  */
 public function __construct(Factory $renderer = null)
 {
     if (!$renderer) {
         $filesystem = new Filesystem();
         $resolver = new EngineResolver();
         $resolver->register('blade', function () use($filesystem) {
             return new CompilerEngine(new BladeCompiler($filesystem, getcwd() . '/cache'));
         });
         $renderer = new Factory($resolver, new FileViewFinder($filesystem, []), new Dispatcher());
     }
     $this->renderer = $renderer;
 }
开发者ID:babdev,项目名称:renderer,代码行数:19,代码来源:BladeRenderer.php

示例8: registerBladeEngine

 /**
  * Register the Blade engine implementation.
  *
  * @param  \Illuminate\View\Engines\EngineResolver  $resolver
  * @return void
  */
 public function registerBladeEngine($resolver)
 {
     $app = $this->app;
     $resolver->register('blade', function () use($app) {
         $cache = $app['path.storage'] . '/views';
         // The Compiler engine requires an instance of the CompilerInterface, which in
         // this case will be the Blade compiler, so we'll first create the compiler
         // instance to pass into the engine so it can compile the views properly.
         $compiler = new BladeCompiler($app['files'], $cache);
         return new CompilerEngine($compiler, $app['files']);
     });
 }
开发者ID:centaurustech,项目名称:sagip,代码行数:18,代码来源:ViewServiceProvider.php

示例9: registerMarkdownEngine

 /**
  * Register the Markdown engine implementation.
  *
  * @param  EngineResolver  $resolver
  * @return void
  */
 public function registerMarkdownEngine($resolver)
 {
     $app = $this->app;
     $resolver->register('markdown', function () use($app) {
         $cache = storage_path() . '/markdown';
         if (!File::isDirectory($cache)) {
             File::makeDirectory($cache);
         }
         $compiler = new MarkdownCompiler($app['files'], $cache);
         $compiler->setOptions(Config::get('markdown.options'));
         return new CompilerEngine($compiler, $app['files']);
     });
 }
开发者ID:abelit,项目名称:markdown-3,代码行数:19,代码来源:MarkdownServiceProvider.php

示例10: register

 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('minit', function () {
         return new \Minit\Engine();
     });
     $this->app->singleton('view.engine.resolver', function () {
         $resolver = new EngineResolver();
         $resolver->register('php', function () {
             return new \Minit\Engine();
         });
         return $resolver;
     });
 }
开发者ID:elwinar,项目名称:minit,代码行数:18,代码来源:ServiceProvider.php

示例11: registerBladeEngine

 /**
  * Register the Blade engine implementation.
  *
  * @param  \Illuminate\View\Engines\EngineResolver  $resolver
  * @return void
  */
 public function registerBladeEngine($resolver)
 {
     $app = $this->app;
     // The Compiler engine requires an instance of the CompilerInterface, which in
     // this case will be the Blade compiler, so we'll first create the compiler
     // instance to pass into the engine so it can compile the views properly.
     $app->singleton('blade.compiler', function ($app) {
         $cache = $app['config']['view.compiled'];
         return new BladeCompiler($app['files'], $cache);
     });
     $resolver->register('blade', function () use($app) {
         return new CompilerEngine($app['blade.compiler']);
     });
 }
开发者ID:ejay010,项目名称:Ploy,代码行数:20,代码来源:ViewServiceProvider.php

示例12: getEngineResolver

 /**
  * Register the engine resolver instance.
  *
  * @return EngineResolver
  */
 public function getEngineResolver()
 {
     $resolver = new EngineResolver();
     // Add PhpEngine
     $resolver->register('php', function () {
         return new PhpEngine();
     });
     // Add Blade compiler engine
     $resolver->register('blade', function () {
         $compiler = new BladeCompiler($this->files, $this->cachePath);
         return new CompilerEngine($compiler);
     });
     return $resolver;
 }
开发者ID:ymnl007,项目名称:Clerk,代码行数:19,代码来源:BladeEngine.php

示例13: __construct

 /**
  * Create a new Blade Factory instance
  *
  * @param array $view_paths
  * @param mixed $view_cache_path
  */
 public function __construct(array $view_paths, $view_cache_path = null)
 {
     $resolver = new EngineResolver();
     $finder = new FileViewFinder(new Filesystem(), $view_paths);
     $dispatcher = new Dispatcher();
     $resolver->register("blade", function () use($view_cache_path) {
         if (!is_dir($view_cache_path)) {
             mkdir($view_cache_path, 0777, true);
         }
         $blade = new BladeCompiler(new Filesystem(), $view_cache_path);
         return new CompilerEngine($blade);
     });
     parent::__construct($resolver, $finder, $dispatcher);
 }
开发者ID:rakit,项目名称:blade,代码行数:20,代码来源:Blade.php

示例14: makeView

 protected function makeView()
 {
     $app = new Container();
     $resolver = new EngineResolver();
     $resolver->register('php', function () {
         return new PhpEngine();
     });
     $finder = new FileViewFinder(new Filesystem(), [realpath(__DIR__)]);
     $dispatcher = (new Dispatcher($app))->setQueueResolver(function () use($app) {
         return $app->make('Illuminate\\Contracts\\Queue\\Factory');
     });
     $env = new Factory($resolver, $finder, $dispatcher);
     $env->setContainer($app);
     $env->share('app', $app);
     return new Illuminate($env);
 }
开发者ID:michaeljennings,项目名称:carpenter,代码行数:16,代码来源:IlluminateViewTest.php

示例15: getViewFactory

 /**
  * Get the laravel view factory.
  *
  * @return Factory
  */
 protected function getViewFactory()
 {
     if ($this->factory) {
         return $this->factory;
     }
     $resolver = new EngineResolver();
     $resolver->register("blade", function () {
         if (!is_dir($this->cache)) {
             mkdir($this->cache, 0777, true);
         }
         $blade = new BladeCompiler(new Filesystem(), $this->cache);
         Blade::registerDirectives($blade);
         return new CompilerEngine($blade);
     });
     $this->factory = new Factory($resolver, $this->getViewFinder(), new Dispatcher());
     return $this->factory;
 }
开发者ID:ngangchill,项目名称:blade-1,代码行数:22,代码来源:BladeInstance.php


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