Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

kernel_request_subscriber.php

Zuletzt modifiziert: 09.10.2024, 12:51 - Dateigröße: 1.93 KiB


 01  <?php
 02  /**
 03  *
 04  * This file is part of the phpBB Forum Software package.
 05  *
 06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 07  * @license GNU General Public License, version 2 (GPL-2.0)
 08  *
 09  * For full copyright and license information, please see
 10  * the docs/CREDITS.txt file.
 11  *
 12  */
 13   
 14  namespace phpbb\event;
 15   
 16  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 17  use Symfony\Component\HttpKernel\KernelEvents;
 18  use Symfony\Component\HttpKernel\Event\GetResponseEvent;
 19  use Symfony\Component\HttpKernel\EventListener\RouterListener;
 20  use Symfony\Component\Routing\RequestContext;
 21   
 22  class kernel_request_subscriber implements EventSubscriberInterface
 23  {
 24      /**
 25      * Extension manager object
 26      * @var \phpbb\extension\manager
 27      */
 28      protected $manager;
 29   
 30      /**
 31      * PHP file extension
 32      * @var string
 33      */
 34      protected $php_ext;
 35   
 36      /**
 37      * Root path
 38      * @var string
 39      */
 40      protected $root_path;
 41   
 42      /**
 43      * Construct method
 44      *
 45      * @param \phpbb\extension\manager $manager Extension manager object
 46      * @param string $root_path Root path
 47      * @param string $php_ext PHP file extension
 48      */
 49      public function __construct(\phpbb\extension\manager $manager, $root_path, $php_ext)
 50      {
 51          $this->root_path = $root_path;
 52          $this->php_ext = $php_ext;
 53          $this->manager = $manager;
 54      }
 55   
 56      /**
 57      * This listener is run when the KernelEvents::REQUEST event is triggered
 58      *
 59      * This is responsible for setting up the routing information
 60      *
 61      * @param GetResponseEvent $event
 62      * @throws \BadMethodCallException
 63      * @return null
 64      */
 65      public function on_kernel_request(GetResponseEvent $event)
 66      {
 67          $request = $event->getRequest();
 68          $context = new RequestContext();
 69          $context->fromRequest($request);
 70   
 71          $matcher = phpbb_get_url_matcher($this->manager, $context, $this->root_path, $this->php_ext);
 72          $router_listener = new RouterListener($matcher, $context);
 73          $router_listener->onKernelRequest($event);
 74      }
 75   
 76      public static function getSubscribedEvents()
 77      {
 78          return array(
 79              KernelEvents::REQUEST        => 'on_kernel_request',
 80          );
 81      }
 82  }
 83