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

functions_url_matcher.php

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


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  */
 013   
 014  use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
 015  use Symfony\Component\Routing\Matcher\UrlMatcher;
 016  use Symfony\Component\Routing\RequestContext;
 017   
 018  /**
 019  * @ignore
 020  */
 021  if (!defined('IN_PHPBB'))
 022  {
 023      exit;
 024  }
 025   
 026  /**
 027  * Create a new UrlMatcher class and dump it into the cache file
 028  *
 029  * @param \phpbb\extension\manager $manager Extension manager
 030  * @param RequestContext $context Symfony RequestContext object
 031  * @param string $root_path Root path
 032  * @param string $php_ext PHP file extension
 033  * @return null
 034  */
 035  function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path, $php_ext)
 036  {
 037      if (defined('DEBUG'))
 038      {
 039          return phpbb_create_url_matcher($manager, $context, $root_path);
 040      }
 041   
 042      if (!phpbb_url_matcher_dumped($root_path, $php_ext))
 043      {
 044          phpbb_create_dumped_url_matcher($manager, $root_path, $php_ext);
 045      }
 046   
 047      return phpbb_load_url_matcher($context, $root_path, $php_ext);
 048  }
 049   
 050  /**
 051  * Create a new UrlMatcher class and dump it into the cache file
 052  *
 053  * @param \phpbb\extension\manager $manager Extension manager
 054  * @param string $root_path Root path
 055  * @param string $php_ext PHP file extension
 056  * @return null
 057  */
 058  function phpbb_create_dumped_url_matcher(\phpbb\extension\manager $manager, $root_path, $php_ext)
 059  {
 060      $provider = new \phpbb\controller\provider();
 061      $provider->find_routing_files($manager->get_finder());
 062      $routes = $provider->find($root_path)->get_routes();
 063      $dumper = new PhpMatcherDumper($routes);
 064      $cached_url_matcher_dump = $dumper->dump(array(
 065          'class'            => 'phpbb_url_matcher',
 066      ));
 067   
 068      file_put_contents($root_path . 'cache/url_matcher.' . $php_ext, $cached_url_matcher_dump);
 069  }
 070   
 071  /**
 072  * Create a non-cached UrlMatcher
 073  *
 074  * @param \phpbb\extension\manager $manager Extension manager
 075  * @param RequestContext $context Symfony RequestContext object
 076  * @return UrlMatcher
 077  */
 078  function phpbb_create_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path)
 079  {
 080      $provider = new \phpbb\controller\provider();
 081      $provider->find_routing_files($manager->get_finder());
 082      $routes = $provider->find($root_path)->get_routes();
 083      return new UrlMatcher($routes, $context);
 084  }
 085   
 086  /**
 087  * Load the cached phpbb_url_matcher class
 088  *
 089  * @param RequestContext $context Symfony RequestContext object
 090  * @param string $root_path Root path
 091  * @param string $php_ext PHP file extension
 092  * @return phpbb_url_matcher
 093  */
 094  function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext)
 095  {
 096      require($root_path . 'cache/url_matcher.' . $php_ext);
 097      return new phpbb_url_matcher($context);
 098  }
 099   
 100  /**
 101  * Determine whether we have our dumped URL matcher
 102  *
 103  * The class is automatically dumped to the cache directory
 104  *
 105  * @param string $root_path Root path
 106  * @param string $php_ext PHP file extension
 107  * @return bool True if it exists, false if not
 108  */
 109  function phpbb_url_matcher_dumped($root_path, $php_ext)
 110  {
 111      return file_exists($root_path . 'cache/url_matcher.' . $php_ext);
 112  }
 113