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


PHP sfApplicationConfiguration::loadHelpers方法代码示例

本文整理汇总了PHP中sfApplicationConfiguration::loadHelpers方法的典型用法代码示例。如果您正苦于以下问题:PHP sfApplicationConfiguration::loadHelpers方法的具体用法?PHP sfApplicationConfiguration::loadHelpers怎么用?PHP sfApplicationConfiguration::loadHelpers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfApplicationConfiguration的用法示例。


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

示例1: boot

 /**
  * {@inheritdoc}
  */
 public function boot(ContainerInterface $container)
 {
     if (empty($this->options)) {
         throw new \RuntimeException('You must provide options for the Symfony 1.4 kernel.');
     }
     if ($this->isBooted()) {
         return;
     }
     if ($this->classLoader && !$this->classLoader->isAutoloaded()) {
         $this->classLoader->autoload();
     }
     $dispatcher = $container->get('event_dispatcher');
     $event = new LegacyKernelBootEvent($container->get('request'), $this->options);
     $dispatcher->dispatch(LegacyKernelEvents::BOOT, $event);
     $this->options = $event->getOptions();
     require_once $this->rootDir . '/config/ProjectConfiguration.class.php';
     $application = $this->options['application'];
     $environment = $this->options['environment'];
     $debug = $this->options['debug'];
     $this->configuration = \ProjectConfiguration::getApplicationConfiguration($application, $environment, $debug, $this->getRootDir());
     $this->configuration->loadHelpers(array('Url'));
     // Create a context to use with some helpers like Url.
     if (!\sfContext::hasInstance()) {
         $session = $container->get('session');
         if ($session->isStarted()) {
             $session->save();
         }
         ob_start();
         \sfContext::createInstance($this->configuration);
         ob_end_flush();
         $session->migrate();
     }
     $this->isBooted = true;
 }
开发者ID:chancegarcia,项目名称:TheodoEvolutionLegacyWrapperBundle,代码行数:37,代码来源:Symfony14Kernel.php

示例2: loadExtensions

 /**
  * Loads standard extensions for Symfony into the view.
  */
 protected function loadExtensions()
 {
     // should be replaced with sf_twig_standard_extensions
     $prefixes = array_merge(array('Helper', 'Url', 'Asset', 'Tag', 'Escaping', 'Partial', 'I18N'), sfConfig::get('sf_standard_helpers'));
     foreach ($prefixes as $prefix) {
         $class_name = $prefix . '_Twig_Extension';
         if (class_exists($class_name)) {
             $this->twig->addExtension(new $class_name());
         }
     }
     // for now the extensions needs the original helpers so lets load thoose.
     $this->configuration->loadHelpers($prefixes);
     // makes it possible to load custom twig extensions.
     foreach (sfConfig::get('sf_twig_extensions', array()) as $extension) {
         if (!class_exists($extension)) {
             throw new InvalidArgumentException(sprintf('Unable to load "%s" as an Twig_Extension into Twig_Environment', $extension));
         }
         $this->twig->addExtension(new $extension());
     }
 }
开发者ID:ryanhughes,项目名称:sfTwigPlugin,代码行数:23,代码来源:sfTwigView.class.php


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