Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

FileExtensionEscapingStrategy.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 1.42 KiB


01  <?php
02   
03  /*
04   * This file is part of Twig.
05   *
06   * (c) 2015 Fabien Potencier
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  /**
13   * Default autoescaping strategy based on file names.
14   *
15   * This strategy sets the HTML as the default autoescaping strategy,
16   * but changes it based on the filename.
17   *
18   * Note that there is no runtime performance impact as the
19   * default autoescaping strategy is set at compilation time.
20   *
21   * @author Fabien Potencier <fabien@symfony.com>
22   */
23  class Twig_FileExtensionEscapingStrategy
24  {
25      /**
26       * Guesses the best autoescaping strategy based on the file name.
27       *
28       * @param string $filename The template file name
29       *
30       * @return string|false The escaping strategy name to use or false to disable
31       */
32      public static function guess($filename)
33      {
34          if (in_array(substr($filename, -1), array('/', '\\'))) {
35              return 'html'; // return html for directories
36          }
37   
38          if ('.twig' === substr($filename, -5)) {
39              $filename = substr($filename, 0, -5);
40          }
41   
42          $extension = pathinfo($filename, PATHINFO_EXTENSION);
43   
44          switch ($extension) {
45              case 'js':
46                  return 'js';
47   
48              case 'css':
49                  return 'css';
50   
51              case 'txt':
52                  return false;
53   
54              default:
55                  return 'html';
56          }
57      }
58  }
59