[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/phpbb/event/ -> kernel_request_subscriber.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * 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  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1