コード例 #1
0
ファイル: Engine.php プロジェクト: rsky/symfony
 public function render($name, array $parameters = array())
 {
     list(, $options) = $this->splitTemplateName($name);
     $renderer = $options['renderer'];
     if (isset($this->renderers[$renderer]) && is_string($this->renderers[$renderer])) {
         $this->renderers[$renderer] = $this->container->get($this->renderers[$renderer]);
         $this->renderers[$renderer]->setEngine($this);
     }
     if ('php' === $renderer) {
         $parameters = $this->escapeParameters($parameters);
     }
     return parent::render($name, $parameters);
 }
コード例 #2
0
ファイル: Engine.php プロジェクト: skoop/symfony-sandbox
 public function render($name, array $parameters = array())
 {
     ++$this->level;
     list(, $options) = $this->splitTemplateName($name);
     if ('php' === $options['renderer']) {
         // escape only once
         if (1 === $this->level && !isset($parameters['_data'])) {
             $parameters = $this->escapeParameters($parameters);
         }
     }
     $content = parent::render($name, $parameters);
     --$this->level;
     return $content;
 }
コード例 #3
0
ファイル: Engine.php プロジェクト: spf13/symfony
 /**
  * Constructor.
  *
  * @param ContainerInterface $container A ContainerInterface instance
  * @param LoaderInterface    $loader    A loader instance
  */
 public function __construct(ContainerInterface $container, LoaderInterface $loader)
 {
     $this->container = $container;
     parent::__construct($loader);
     foreach ($this->container->findTaggedServiceIds('templating.renderer') as $id => $attributes) {
         if (isset($attributes[0]['alias'])) {
             $this->renderers[$attributes[0]['alias']] = $this->container->get($id);
             $this->renderers[$attributes[0]['alias']]->setEngine($this);
         }
     }
     $this->helpers = array();
     foreach ($this->container->findTaggedServiceIds('templating.helper') as $id => $attributes) {
         if (isset($attributes[0]['alias'])) {
             $this->helpers[$attributes[0]['alias']] = $id;
         }
     }
 }
コード例 #4
0
ファイル: Engine.php プロジェクト: netixpro/symfony
 public function render($name, array $parameters = array())
 {
     ++$this->level;
     list(, $options) = $this->splitTemplateName($name);
     $renderer = $options['renderer'];
     if (isset($this->renderers[$renderer]) && is_string($this->renderers[$renderer])) {
         $this->renderers[$renderer] = $this->container->get($this->renderers[$renderer]);
         $this->renderers[$renderer]->setEngine($this);
     }
     if ('php' === $renderer) {
         // escape only once
         if (1 === $this->level && !isset($parameters['_data'])) {
             $parameters = $this->escapeParameters($parameters);
         }
     }
     $content = parent::render($name, $parameters);
     --$this->level;
     return $content;
 }
コード例 #5
0
ファイル: Engine.php プロジェクト: jackbravo/symfony-sandbox
 /**
  * Constructor.
  *
  * @param ContainerInterface $container The DI container
  * @param LoaderInterface    $loader    A loader instance
  * @param array              $renderers All templating renderers
  */
 public function __construct(ContainerInterface $container, LoaderInterface $loader, array $renderers)
 {
     $this->container = $container;
     parent::__construct($loader, $renderers);
 }