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

Chain.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 3.63 KiB


 001  <?php
 002   
 003  /*
 004   * This file is part of Twig.
 005   *
 006   * (c) 2011 Fabien Potencier
 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  /**
 013   * Loads templates from other loaders.
 014   *
 015   * @author Fabien Potencier <fabien@symfony.com>
 016   */
 017  class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
 018  {
 019      private $hasSourceCache = array();
 020      protected $loaders = array();
 021   
 022      /**
 023       * Constructor.
 024       *
 025       * @param Twig_LoaderInterface[] $loaders An array of loader instances
 026       */
 027      public function __construct(array $loaders = array())
 028      {
 029          foreach ($loaders as $loader) {
 030              $this->addLoader($loader);
 031          }
 032      }
 033   
 034      /**
 035       * Adds a loader instance.
 036       *
 037       * @param Twig_LoaderInterface $loader A Loader instance
 038       */
 039      public function addLoader(Twig_LoaderInterface $loader)
 040      {
 041          $this->loaders[] = $loader;
 042          $this->hasSourceCache = array();
 043      }
 044   
 045      /**
 046       * {@inheritdoc}
 047       */
 048      public function getSource($name)
 049      {
 050          $exceptions = array();
 051          foreach ($this->loaders as $loader) {
 052              if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
 053                  continue;
 054              }
 055   
 056              try {
 057                  return $loader->getSource($name);
 058              } catch (Twig_Error_Loader $e) {
 059                  $exceptions[] = $e->getMessage();
 060              }
 061          }
 062   
 063          throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
 064      }
 065   
 066      /**
 067       * {@inheritdoc}
 068       */
 069      public function exists($name)
 070      {
 071          $name = (string) $name;
 072   
 073          if (isset($this->hasSourceCache[$name])) {
 074              return $this->hasSourceCache[$name];
 075          }
 076   
 077          foreach ($this->loaders as $loader) {
 078              if ($loader instanceof Twig_ExistsLoaderInterface) {
 079                  if ($loader->exists($name)) {
 080                      return $this->hasSourceCache[$name] = true;
 081                  }
 082   
 083                  continue;
 084              }
 085   
 086              try {
 087                  $loader->getSource($name);
 088   
 089                  return $this->hasSourceCache[$name] = true;
 090              } catch (Twig_Error_Loader $e) {
 091              }
 092          }
 093   
 094          return $this->hasSourceCache[$name] = false;
 095      }
 096   
 097      /**
 098       * {@inheritdoc}
 099       */
 100      public function getCacheKey($name)
 101      {
 102          $exceptions = array();
 103          foreach ($this->loaders as $loader) {
 104              if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
 105                  continue;
 106              }
 107   
 108              try {
 109                  return $loader->getCacheKey($name);
 110              } catch (Twig_Error_Loader $e) {
 111                  $exceptions[] = get_class($loader).': '.$e->getMessage();
 112              }
 113          }
 114   
 115          throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
 116      }
 117   
 118      /**
 119       * {@inheritdoc}
 120       */
 121      public function isFresh($name, $time)
 122      {
 123          $exceptions = array();
 124          foreach ($this->loaders as $loader) {
 125              if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
 126                  continue;
 127              }
 128   
 129              try {
 130                  return $loader->isFresh($name, $time);
 131              } catch (Twig_Error_Loader $e) {
 132                  $exceptions[] = get_class($loader).': '.$e->getMessage();
 133              }
 134          }
 135   
 136          throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
 137      }
 138  }
 139