Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
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 |
SurrogateListener.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\EventListener;
13
14 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15 use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
16 use Symfony\Component\HttpKernel\HttpCache\HttpCache;
17 use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface;
18 use Symfony\Component\HttpKernel\KernelEvents;
19
20 /**
21 * SurrogateListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for Surrogates.
22 *
23 * @author Fabien Potencier <fabien@symfony.com>
24 */
25 class SurrogateListener implements EventSubscriberInterface
26 {
27 private $surrogate;
28
29 public function __construct(SurrogateInterface $surrogate = null)
30 {
31 $this->surrogate = $surrogate;
32 }
33
34 /**
35 * Filters the Response.
36 */
37 public function onKernelResponse(FilterResponseEvent $event)
38 {
39 if (!$event->isMasterRequest()) {
40 return;
41 }
42
43 $kernel = $event->getKernel();
44 $surrogate = $this->surrogate;
45 if ($kernel instanceof HttpCache) {
46 $surrogate = $kernel->getSurrogate();
47 if (null !== $this->surrogate && $this->surrogate->getName() !== $surrogate->getName()) {
48 $surrogate = $this->surrogate;
49 }
50 }
51
52 if (null === $surrogate) {
53 return;
54 }
55
56 $surrogate->addSurrogateControl($event->getResponse());
57 }
58
59 public static function getSubscribedEvents()
60 {
61 return [
62 KernelEvents::RESPONSE => 'onKernelResponse',
63 ];
64 }
65 }
66