Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
AutoExpireFlashBag.php
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 private $flashes = ['display' => [], 'new' => []];
023 private $storageKey;
024
025 /**
026 * @param string $storageKey The key used to store flashes in the session
027 */
028 public function __construct($storageKey = '_symfony_flashes')
029 {
030 $this->storageKey = $storageKey;
031 }
032
033 /**
034 * {@inheritdoc}
035 */
036 public function getName()
037 {
038 return $this->name;
039 }
040
041 public function setName($name)
042 {
043 $this->name = $name;
044 }
045
046 /**
047 * {@inheritdoc}
048 */
049 public function initialize(array &$flashes)
050 {
051 $this->flashes = &$flashes;
052
053 // The logic: messages from the last request will be stored in new, so we move them to previous
054 // This request we will show what is in 'display'. What is placed into 'new' this time round will
055 // be moved to display next time round.
056 $this->flashes['display'] = \array_key_exists('new', $this->flashes) ? $this->flashes['new'] : [];
057 $this->flashes['new'] = [];
058 }
059
060 /**
061 * {@inheritdoc}
062 */
063 public function add($type, $message)
064 {
065 $this->flashes['new'][$type][] = $message;
066 }
067
068 /**
069 * {@inheritdoc}
070 */
071 public function peek($type, array $default = [])
072 {
073 return $this->has($type) ? $this->flashes['display'][$type] : $default;
074 }
075
076 /**
077 * {@inheritdoc}
078 */
079 public function peekAll()
080 {
081 return \array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : [];
082 }
083
084 /**
085 * {@inheritdoc}
086 */
087 public function get($type, array $default = [])
088 {
089 $return = $default;
090
091 if (!$this->has($type)) {
092 return $return;
093 }
094
095 if (isset($this->flashes['display'][$type])) {
096 $return = $this->flashes['display'][$type];
097 unset($this->flashes['display'][$type]);
098 }
099
100 return $return;
101 }
102
103 /**
104 * {@inheritdoc}
105 */
106 public function all()
107 {
108 $return = $this->flashes['display'];
109 $this->flashes['display'] = [];
110
111 return $return;
112 }
113
114 /**
115 * {@inheritdoc}
116 */
117 public function setAll(array $messages)
118 {
119 $this->flashes['new'] = $messages;
120 }
121
122 /**
123 * {@inheritdoc}
124 */
125 public function set($type, $messages)
126 {
127 $this->flashes['new'][$type] = (array) $messages;
128 }
129
130 /**
131 * {@inheritdoc}
132 */
133 public function has($type)
134 {
135 return \array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
136 }
137
138 /**
139 * {@inheritdoc}
140 */
141 public function keys()
142 {
143 return array_keys($this->flashes['display']);
144 }
145
146 /**
147 * {@inheritdoc}
148 */
149 public function getStorageKey()
150 {
151 return $this->storageKey;
152 }
153
154 /**
155 * {@inheritdoc}
156 */
157 public function clear()
158 {
159 return $this->all();
160 }
161 }
162