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

AutoExpireFlashBag.php

Zuletzt modifiziert: 09.10.2024, 12:59 - Dateigröße: 3.62 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\HttpFoundation\Session\Flash;
 013   
 014  /**
 015   * AutoExpireFlashBag flash message container.
 016   *
 017   * @author Drak <drak@zikula.org>
 018   */
 019  class AutoExpireFlashBag implements FlashBagInterface
 020  {
 021      private $name = 'flashes';
 022   
 023      /**
 024       * Flash messages.
 025       *
 026       * @var array
 027       */
 028      private $flashes = array();
 029   
 030      /**
 031       * The storage key for flashes in the session
 032       *
 033       * @var string
 034       */
 035      private $storageKey;
 036   
 037      /**
 038       * Constructor.
 039       *
 040       * @param string $storageKey The key used to store flashes in the session.
 041       */
 042      public function __construct($storageKey = '_sf2_flashes')
 043      {
 044          $this->storageKey = $storageKey;
 045          $this->flashes = array('display' => array(), 'new' => array());
 046      }
 047   
 048      /**
 049       * {@inheritdoc}
 050       */
 051      public function getName()
 052      {
 053          return $this->name;
 054      }
 055   
 056      public function setName($name)
 057      {
 058          $this->name = $name;
 059      }
 060   
 061      /**
 062       * {@inheritdoc}
 063       */
 064      public function initialize(array &$flashes)
 065      {
 066          $this->flashes = &$flashes;
 067   
 068          // The logic: messages from the last request will be stored in new, so we move them to previous
 069          // This request we will show what is in 'display'.  What is placed into 'new' this time round will
 070          // be moved to display next time round.
 071          $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array();
 072          $this->flashes['new'] = array();
 073      }
 074   
 075      /**
 076       * {@inheritdoc}
 077       */
 078      public function add($type, $message)
 079      {
 080          $this->flashes['new'][$type][] = $message;
 081      }
 082   
 083      /**
 084       * {@inheritdoc}
 085       */
 086      public function peek($type, array $default = array())
 087      {
 088          return $this->has($type) ? $this->flashes['display'][$type] : $default;
 089      }
 090   
 091      /**
 092       * {@inheritdoc}
 093       */
 094      public function peekAll()
 095      {
 096          return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array();
 097      }
 098   
 099      /**
 100       * {@inheritdoc}
 101       */
 102      public function get($type, array $default = array())
 103      {
 104          $return = $default;
 105   
 106          if (!$this->has($type)) {
 107              return $return;
 108          }
 109   
 110          if (isset($this->flashes['display'][$type])) {
 111              $return = $this->flashes['display'][$type];
 112              unset($this->flashes['display'][$type]);
 113          }
 114   
 115          return $return;
 116      }
 117   
 118      /**
 119       * {@inheritdoc}
 120       */
 121      public function all()
 122      {
 123          $return = $this->flashes['display'];
 124          $this->flashes = array('new' => array(), 'display' => array());
 125   
 126          return $return;
 127      }
 128   
 129      /**
 130       * {@inheritdoc}
 131       */
 132      public function setAll(array $messages)
 133      {
 134          $this->flashes['new'] = $messages;
 135      }
 136   
 137      /**
 138       * {@inheritdoc}
 139       */
 140      public function set($type, $messages)
 141      {
 142          $this->flashes['new'][$type] = (array) $messages;
 143      }
 144   
 145      /**
 146       * {@inheritdoc}
 147       */
 148      public function has($type)
 149      {
 150          return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
 151      }
 152   
 153      /**
 154       * {@inheritdoc}
 155       */
 156      public function keys()
 157      {
 158          return array_keys($this->flashes['display']);
 159      }
 160   
 161      /**
 162       * {@inheritdoc}
 163       */
 164      public function getStorageKey()
 165      {
 166          return $this->storageKey;
 167      }
 168   
 169      /**
 170       * {@inheritdoc}
 171       */
 172      public function clear()
 173      {
 174          return $this->all();
 175      }
 176  }
 177