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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
LazyLoadingFragmentHandler.php
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\Component\HttpKernel\DependencyInjection;
13
14 use Symfony\Component\DependencyInjection\ContainerInterface;
15 use Symfony\Component\HttpFoundation\RequestStack;
16 use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
17
18 /**
19 * Lazily loads fragment renderers from the dependency injection container.
20 *
21 * @author Fabien Potencier <fabien@symfony.com>
22 */
23 class LazyLoadingFragmentHandler extends FragmentHandler
24 {
25 private $container;
26 private $rendererIds = array();
27
28 /**
29 * Constructor.
30 *
31 * RequestStack will become required in 3.0.
32 *
33 * @param ContainerInterface $container A container
34 * @param RequestStack $requestStack The Request stack that controls the lifecycle of requests
35 * @param bool $debug Whether the debug mode is enabled or not
36 */
37 public function __construct(ContainerInterface $container, $requestStack = null, $debug = false)
38 {
39 $this->container = $container;
40
41 if ((null !== $requestStack && !$requestStack instanceof RequestStack) || $debug instanceof RequestStack) {
42 $tmp = $debug;
43 $debug = $requestStack;
44 $requestStack = func_num_args() < 3 ? null : $tmp;
45
46 @trigger_error('The '.__METHOD__.' method now requires a RequestStack to be given as second argument as '.__CLASS__.'::setRequest method will not be supported anymore in 3.0.', E_USER_DEPRECATED);
47 } elseif (!$requestStack instanceof RequestStack) {
48 @trigger_error('The '.__METHOD__.' method now requires a RequestStack instance as '.__CLASS__.'::setRequest method will not be supported anymore in 3.0.', E_USER_DEPRECATED);
49 }
50
51 parent::__construct($requestStack, array(), $debug);
52 }
53
54 /**
55 * Adds a service as a fragment renderer.
56 *
57 * @param string $name The service name
58 * @param string $renderer The render service id
59 */
60 public function addRendererService($name, $renderer)
61 {
62 $this->rendererIds[$name] = $renderer;
63 }
64
65 /**
66 * {@inheritdoc}
67 */
68 public function render($uri, $renderer = 'inline', array $options = array())
69 {
70 if (isset($this->rendererIds[$renderer])) {
71 $this->addRenderer($this->container->get($this->rendererIds[$renderer]));
72
73 unset($this->rendererIds[$renderer]);
74 }
75
76 return parent::render($uri, $renderer, $options);
77 }
78 }
79