Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

HttpKernelExtension.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 2.56 KiB


01  <?php
02   
03  /*
04   * This file is part of the Symfony package.
05   *
06   * (c) Fabien Potencier <fabien@symfony.com>
07   *
08   * For the full copyright and license information, please view the LICENSE
09   * file that was distributed with this source code.
10   */
11   
12  namespace Symfony\Bridge\Twig\Extension;
13   
14  use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
15  use Symfony\Component\HttpKernel\Controller\ControllerReference;
16   
17  /**
18   * Provides integration with the HttpKernel component.
19   *
20   * @author Fabien Potencier <fabien@symfony.com>
21   */
22  class HttpKernelExtension extends \Twig_Extension
23  {
24      private $handler;
25   
26      /**
27       * Constructor.
28       *
29       * @param FragmentHandler $handler A FragmentHandler instance
30       */
31      public function __construct(FragmentHandler $handler)
32      {
33          $this->handler = $handler;
34      }
35   
36      public function getFunctions()
37      {
38          return array(
39              new \Twig_SimpleFunction('render', array($this, 'renderFragment'), array('is_safe' => array('html'))),
40              new \Twig_SimpleFunction('render_*', array($this, 'renderFragmentStrategy'), array('is_safe' => array('html'))),
41              new \Twig_SimpleFunction('controller', array($this, 'controller')),
42          );
43      }
44   
45      /**
46       * Renders a fragment.
47       *
48       * @param string|ControllerReference $uri     A URI as a string or a ControllerReference instance
49       * @param array                      $options An array of options
50       *
51       * @return string The fragment content
52       *
53       * @see FragmentHandler::render()
54       */
55      public function renderFragment($uri, $options = array())
56      {
57          $strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
58          unset($options['strategy']);
59   
60          return $this->handler->render($uri, $strategy, $options);
61      }
62   
63      /**
64       * Renders a fragment.
65       *
66       * @param string                     $strategy A strategy name
67       * @param string|ControllerReference $uri      A URI as a string or a ControllerReference instance
68       * @param array                      $options  An array of options
69       *
70       * @return string The fragment content
71       *
72       * @see FragmentHandler::render()
73       */
74      public function renderFragmentStrategy($strategy, $uri, $options = array())
75      {
76          return $this->handler->render($uri, $strategy, $options);
77      }
78   
79      public function controller($controller, $attributes = array(), $query = array())
80      {
81          return new ControllerReference($controller, $attributes, $query);
82      }
83   
84      /**
85       * {@inheritdoc}
86       */
87      public function getName()
88      {
89          return 'http_kernel';
90      }
91  }
92