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

RoutableFragmentRenderer.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 2.42 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\Component\HttpKernel\Fragment;
13   
14  use Symfony\Component\HttpKernel\Controller\ControllerReference;
15  use Symfony\Component\HttpFoundation\Request;
16  use Symfony\Component\HttpKernel\EventListener\FragmentListener;
17   
18  /**
19   * Adds the possibility to generate a fragment URI for a given Controller.
20   *
21   * @author Fabien Potencier <fabien@symfony.com>
22   */
23  abstract class RoutableFragmentRenderer implements FragmentRendererInterface
24  {
25      private $fragmentPath = '/_fragment';
26   
27      /**
28       * Sets the fragment path that triggers the fragment listener.
29       *
30       * @param string $path The path
31       *
32       * @see FragmentListener
33       */
34      public function setFragmentPath($path)
35      {
36          $this->fragmentPath = $path;
37      }
38   
39      /**
40       * Generates a fragment URI for a given controller.
41       *
42       * @param ControllerReference  $reference A ControllerReference instance
43       * @param Request              $request   A Request instance
44       * @param bool                 $absolute  Whether to generate an absolute URL or not
45       *
46       * @return string A fragment URI
47       */
48      protected function generateFragmentUri(ControllerReference $reference, Request $request, $absolute = false)
49      {
50          // We need to forward the current _format and _locale values as we don't have
51          // a proper routing pattern to do the job for us.
52          // This makes things inconsistent if you switch from rendering a controller
53          // to rendering a route if the route pattern does not contain the special
54          // _format and _locale placeholders.
55          if (!isset($reference->attributes['_format'])) {
56              $reference->attributes['_format'] = $request->getRequestFormat();
57          }
58          if (!isset($reference->attributes['_locale'])) {
59              $reference->attributes['_locale'] = $request->getLocale();
60          }
61   
62          $reference->attributes['_controller'] = $reference->controller;
63   
64          $reference->query['_path'] = http_build_query($reference->attributes, '', '&');
65   
66          $path = $this->fragmentPath.'?'.http_build_query($reference->query, '', '&');
67   
68          if ($absolute) {
69              return $request->getUriForPath($path);
70          }
71   
72          return $request->getBaseUrl().$path;
73      }
74  }
75