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

AutoExpireFlashBag.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 3.58 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('display' => array(), 'new' => 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      }
046   
047      /**
048       * {@inheritdoc}
049       */
050      public function getName()
051      {
052          return $this->name;
053      }
054   
055      public function setName($name)
056      {
057          $this->name = $name;
058      }
059   
060      /**
061       * {@inheritdoc}
062       */
063      public function initialize(array &$flashes)
064      {
065          $this->flashes = &$flashes;
066   
067          // The logic: messages from the last request will be stored in new, so we move them to previous
068          // This request we will show what is in 'display'.  What is placed into 'new' this time round will
069          // be moved to display next time round.
070          $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array();
071          $this->flashes['new'] = array();
072      }
073   
074      /**
075       * {@inheritdoc}
076       */
077      public function add($type, $message)
078      {
079          $this->flashes['new'][$type][] = $message;
080      }
081   
082      /**
083       * {@inheritdoc}
084       */
085      public function peek($type, array $default = array())
086      {
087          return $this->has($type) ? $this->flashes['display'][$type] : $default;
088      }
089   
090      /**
091       * {@inheritdoc}
092       */
093      public function peekAll()
094      {
095          return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array();
096      }
097   
098      /**
099       * {@inheritdoc}
100       */
101      public function get($type, array $default = array())
102      {
103          $return = $default;
104   
105          if (!$this->has($type)) {
106              return $return;
107          }
108   
109          if (isset($this->flashes['display'][$type])) {
110              $return = $this->flashes['display'][$type];
111              unset($this->flashes['display'][$type]);
112          }
113   
114          return $return;
115      }
116   
117      /**
118       * {@inheritdoc}
119       */
120      public function all()
121      {
122          $return = $this->flashes['display'];
123          $this->flashes = array('new' => array(), 'display' => array());
124   
125          return $return;
126      }
127   
128      /**
129       * {@inheritdoc}
130       */
131      public function setAll(array $messages)
132      {
133          $this->flashes['new'] = $messages;
134      }
135   
136      /**
137       * {@inheritdoc}
138       */
139      public function set($type, $messages)
140      {
141          $this->flashes['new'][$type] = (array) $messages;
142      }
143   
144      /**
145       * {@inheritdoc}
146       */
147      public function has($type)
148      {
149          return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
150      }
151   
152      /**
153       * {@inheritdoc}
154       */
155      public function keys()
156      {
157          return array_keys($this->flashes['display']);
158      }
159   
160      /**
161       * {@inheritdoc}
162       */
163      public function getStorageKey()
164      {
165          return $this->storageKey;
166      }
167   
168      /**
169       * {@inheritdoc}
170       */
171      public function clear()
172      {
173          return $this->all();
174      }
175  }
176