Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

Glob.php

Zuletzt modifiziert: 01.05.2026, 11:26 - Dateigröße: 3.73 KiB


 001  <?php
 002   
 003  /*
 004   * This file is part of the Symfony package.
 005   *
 006   * (c) Fabien Potencier <fabien@symfony.com>
 007   *
 008   * For the full copyright and license information, please view the LICENSE
 009   * file that was distributed with this source code.
 010   */
 011   
 012  namespace Symfony\Component\Finder;
 013   
 014  /**
 015   * Glob matches globbing patterns against text.
 016   *
 017   *     if match_glob("foo.*", "foo.bar") echo "matched\n";
 018   *
 019   *     // prints foo.bar and foo.baz
 020   *     $regex = glob_to_regex("foo.*");
 021   *     for (['foo.bar', 'foo.baz', 'foo', 'bar'] as $t)
 022   *     {
 023   *         if (/$regex/) echo "matched: $car\n";
 024   *     }
 025   *
 026   * Glob implements glob(3) style matching that can be used to match
 027   * against text, rather than fetching names from a filesystem.
 028   *
 029   * Based on the Perl Text::Glob module.
 030   *
 031   * @author Fabien Potencier <fabien@symfony.com> PHP port
 032   * @author     Richard Clamp <richardc@unixbeard.net> Perl version
 033   * @copyright  2004-2005 Fabien Potencier <fabien@symfony.com>
 034   * @copyright  2002 Richard Clamp <richardc@unixbeard.net>
 035   */
 036  class Glob
 037  {
 038      /**
 039       * Returns a regexp which is the equivalent of the glob pattern.
 040       *
 041       * @param string $glob                The glob pattern
 042       * @param bool   $strictLeadingDot
 043       * @param bool   $strictWildcardSlash
 044       * @param string $delimiter           Optional delimiter
 045       *
 046       * @return string regex The regexp
 047       */
 048      public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
 049      {
 050          $firstByte = true;
 051          $escaping = false;
 052          $inCurlies = 0;
 053          $regex = '';
 054          $sizeGlob = \strlen($glob);
 055          for ($i = 0; $i < $sizeGlob; ++$i) {
 056              $car = $glob[$i];
 057              if ($firstByte && $strictLeadingDot && '.' !== $car) {
 058                  $regex .= '(?=[^\.])';
 059              }
 060   
 061              $firstByte = '/' === $car;
 062   
 063              if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1].$glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) {
 064                  $car = '[^/]++/';
 065                  if (!isset($glob[$i + 3])) {
 066                      $car .= '?';
 067                  }
 068   
 069                  if ($strictLeadingDot) {
 070                      $car = '(?=[^\.])'.$car;
 071                  }
 072   
 073                  $car = '/(?:'.$car.')*';
 074                  $i += 2 + isset($glob[$i + 3]);
 075   
 076                  if ('/' === $delimiter) {
 077                      $car = str_replace('/', '\\/', $car);
 078                  }
 079              }
 080   
 081              if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
 082                  $regex .= "\\$car";
 083              } elseif ('*' === $car) {
 084                  $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
 085              } elseif ('?' === $car) {
 086                  $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
 087              } elseif ('{' === $car) {
 088                  $regex .= $escaping ? '\\{' : '(';
 089                  if (!$escaping) {
 090                      ++$inCurlies;
 091                  }
 092              } elseif ('}' === $car && $inCurlies) {
 093                  $regex .= $escaping ? '}' : ')';
 094                  if (!$escaping) {
 095                      --$inCurlies;
 096                  }
 097              } elseif (',' === $car && $inCurlies) {
 098                  $regex .= $escaping ? ',' : '|';
 099              } elseif ('\\' === $car) {
 100                  if ($escaping) {
 101                      $regex .= '\\\\';
 102                      $escaping = false;
 103                  } else {
 104                      $escaping = true;
 105                  }
 106   
 107                  continue;
 108              } else {
 109                  $regex .= $car;
 110              }
 111              $escaping = false;
 112          }
 113   
 114          return $delimiter.'^'.$regex.'$'.$delimiter;
 115      }
 116  }
 117