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

Escaper.php

Zuletzt modifiziert: 01.05.2026, 11:26 - Dateigröße: 3.93 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\Yaml;
 013   
 014  /**
 015   * Escaper encapsulates escaping rules for single and double-quoted
 016   * YAML strings.
 017   *
 018   * @author Matthew Lewinski <matthew@lewinski.org>
 019   *
 020   * @internal
 021   */
 022  class Escaper
 023  {
 024      // Characters that would cause a dumped string to require double quoting.
 025      const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\x7f|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9";
 026   
 027      // Mapping arrays for escaping a double quoted string. The backslash is
 028      // first to ensure proper escaping because str_replace operates iteratively
 029      // on the input arrays. This ordering of the characters avoids the use of strtr,
 030      // which performs more slowly.
 031      private static $escapees = ['\\', '\\\\', '\\"', '"',
 032                                       "\x00",  "\x01",  "\x02",  "\x03",  "\x04",  "\x05",  "\x06",  "\x07",
 033                                       "\x08",  "\x09",  "\x0a",  "\x0b",  "\x0c",  "\x0d",  "\x0e",  "\x0f",
 034                                       "\x10",  "\x11",  "\x12",  "\x13",  "\x14",  "\x15",  "\x16",  "\x17",
 035                                       "\x18",  "\x19",  "\x1a",  "\x1b",  "\x1c",  "\x1d",  "\x1e",  "\x1f",
 036                                       "\x7f",
 037                                       "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",
 038                                 ];
 039      private static $escaped = ['\\\\', '\\"', '\\\\', '\\"',
 040                                       '\\0',   '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a',
 041                                       '\\b',   '\\t',   '\\n',   '\\v',   '\\f',   '\\r',   '\\x0e', '\\x0f',
 042                                       '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17',
 043                                       '\\x18', '\\x19', '\\x1a', '\\e',   '\\x1c', '\\x1d', '\\x1e', '\\x1f',
 044                                       '\\x7f',
 045                                       '\\N', '\\_', '\\L', '\\P',
 046                                ];
 047   
 048      /**
 049       * Determines if a PHP value would require double quoting in YAML.
 050       *
 051       * @param string $value A PHP value
 052       *
 053       * @return bool True if the value would require double quotes
 054       */
 055      public static function requiresDoubleQuoting($value)
 056      {
 057          return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value);
 058      }
 059   
 060      /**
 061       * Escapes and surrounds a PHP value with double quotes.
 062       *
 063       * @param string $value A PHP value
 064       *
 065       * @return string The quoted, escaped string
 066       */
 067      public static function escapeWithDoubleQuotes($value)
 068      {
 069          return sprintf('"%s"', str_replace(self::$escapees, self::$escaped, $value));
 070      }
 071   
 072      /**
 073       * Determines if a PHP value would require single quoting in YAML.
 074       *
 075       * @param string $value A PHP value
 076       *
 077       * @return bool True if the value would require single quotes
 078       */
 079      public static function requiresSingleQuoting($value)
 080      {
 081          // Determines if a PHP value is entirely composed of a value that would
 082          // require single quoting in YAML.
 083          if (\in_array(strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'])) {
 084              return true;
 085          }
 086   
 087          // Determines if the PHP value contains any single characters that would
 088          // cause it to require single quoting in YAML.
 089          return 0 < preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value);
 090      }
 091   
 092      /**
 093       * Escapes and surrounds a PHP value with single quotes.
 094       *
 095       * @param string $value A PHP value
 096       *
 097       * @return string The quoted, escaped string
 098       */
 099      public static function escapeWithSingleQuotes($value)
 100      {
 101          return sprintf("'%s'", str_replace('\'', '\'\'', $value));
 102      }
 103  }
 104