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

Chain.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 3.57 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;
 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          $this->loaders = array();
 030          foreach ($loaders as $loader) {
 031              $this->addLoader($loader);
 032          }
 033      }
 034   
 035      /**
 036       * Adds a loader instance.
 037       *
 038       * @param Twig_LoaderInterface $loader A Loader instance
 039       */
 040      public function addLoader(Twig_LoaderInterface $loader)
 041      {
 042          $this->loaders[] = $loader;
 043          $this->hasSourceCache = array();
 044      }
 045   
 046      /**
 047       * {@inheritdoc}
 048       */
 049      public function getSource($name)
 050      {
 051          $exceptions = array();
 052          foreach ($this->loaders as $loader) {
 053              if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
 054                  continue;
 055              }
 056   
 057              try {
 058                  return $loader->getSource($name);
 059              } catch (Twig_Error_Loader $e) {
 060                  $exceptions[] = $e->getMessage();
 061              }
 062          }
 063   
 064          throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(', ', $exceptions)));
 065      }
 066   
 067      /**
 068       * {@inheritdoc}
 069       */
 070      public function exists($name)
 071      {
 072          $name = (string) $name;
 073   
 074          if (isset($this->hasSourceCache[$name])) {
 075              return $this->hasSourceCache[$name];
 076          }
 077   
 078          foreach ($this->loaders as $loader) {
 079              if ($loader instanceof Twig_ExistsLoaderInterface) {
 080                  if ($loader->exists($name)) {
 081                      return $this->hasSourceCache[$name] = true;
 082                  }
 083   
 084                  continue;
 085              }
 086   
 087              try {
 088                  $loader->getSource($name);
 089   
 090                  return $this->hasSourceCache[$name] = true;
 091              } catch (Twig_Error_Loader $e) {
 092              }
 093          }
 094   
 095          return $this->hasSourceCache[$name] = false;
 096      }
 097   
 098      /**
 099       * {@inheritdoc}
 100       */
 101      public function getCacheKey($name)
 102      {
 103          $exceptions = array();
 104          foreach ($this->loaders as $loader) {
 105              if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
 106                  continue;
 107              }
 108   
 109              try {
 110                  return $loader->getCacheKey($name);
 111              } catch (Twig_Error_Loader $e) {
 112                  $exceptions[] = get_class($loader).': '.$e->getMessage();
 113              }
 114          }
 115   
 116          throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(' ', $exceptions)));
 117      }
 118   
 119      /**
 120       * {@inheritdoc}
 121       */
 122      public function isFresh($name, $time)
 123      {
 124          $exceptions = array();
 125          foreach ($this->loaders as $loader) {
 126              if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
 127                  continue;
 128              }
 129   
 130              try {
 131                  return $loader->isFresh($name, $time);
 132              } catch (Twig_Error_Loader $e) {
 133                  $exceptions[] = get_class($loader).': '.$e->getMessage();
 134              }
 135          }
 136   
 137          throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(' ', $exceptions)));
 138      }
 139  }
 140