PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 1.3.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v1.3.1
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / libs / Zend / Mail / Storage / Folder.php
matomo / app / libs / Zend / Mail / Storage Last commit date
Folder 6 years ago Writable 6 years ago Abstract.php 6 years ago Exception.php 6 years ago Folder.php 6 years ago Imap.php 6 years ago Maildir.php 6 years ago Mbox.php 6 years ago Pop3.php 6 years ago
Folder.php
237 lines
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Mail
17 * @subpackage Storage
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Folder.php 23775 2011-03-01 17:25:24Z ralph $
21 */
22
23
24 /**
25 * @category Zend
26 * @package Zend_Mail
27 * @subpackage Storage
28 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
29 * @license http://framework.zend.com/license/new-bsd New BSD License
30 */
31 class Zend_Mail_Storage_Folder implements RecursiveIterator
32 {
33 /**
34 * subfolders of folder array(localName => Zend_Mail_Storage_Folder folder)
35 * @var array
36 */
37 protected $_folders;
38
39 /**
40 * local name (name of folder in parent folder)
41 * @var string
42 */
43 protected $_localName;
44
45 /**
46 * global name (absolute name of folder)
47 * @var string
48 */
49 protected $_globalName;
50
51 /**
52 * folder is selectable if folder is able to hold messages, else it's just a parent folder
53 * @var bool
54 */
55 protected $_selectable = true;
56
57 /**
58 * create a new mail folder instance
59 *
60 * @param string $localName name of folder in current subdirectory
61 * @param string $globalName absolute name of folder
62 * @param bool $selectable if true folder holds messages, if false it's just a parent for subfolders
63 * @param array $folders init with given instances of Zend_Mail_Storage_Folder as subfolders
64 */
65 public function __construct($localName, $globalName = '', $selectable = true, array $folders = array())
66 {
67 $this->_localName = $localName;
68 $this->_globalName = $globalName ? $globalName : $localName;
69 $this->_selectable = $selectable;
70 $this->_folders = $folders;
71 }
72
73 /**
74 * implements RecursiveIterator::hasChildren()
75 *
76 * @return bool current element has children
77 */
78 public function hasChildren()
79 {
80 $current = $this->current();
81 return $current && $current instanceof Zend_Mail_Storage_Folder && !$current->isLeaf();
82 }
83
84 /**
85 * implements RecursiveIterator::getChildren()
86 *
87 * @return Zend_Mail_Storage_Folder same as self::current()
88 */
89 public function getChildren()
90 {
91 return $this->current();
92 }
93
94 /**
95 * implements Iterator::valid()
96 *
97 * @return bool check if there's a current element
98 */
99 public function valid()
100 {
101 return key($this->_folders) !== null;
102 }
103
104 /**
105 * implements Iterator::next()
106 *
107 * @return null
108 */
109 public function next()
110 {
111 next($this->_folders);
112 }
113
114 /**
115 * implements Iterator::key()
116 *
117 * @return string key/local name of current element
118 */
119 public function key()
120 {
121 return key($this->_folders);
122 }
123
124 /**
125 * implements Iterator::current()
126 *
127 * @return Zend_Mail_Storage_Folder current folder
128 */
129 public function current()
130 {
131 return current($this->_folders);
132 }
133
134 /**
135 * implements Iterator::rewind()
136 *
137 * @return null
138 */
139 public function rewind()
140 {
141 reset($this->_folders);
142 }
143
144 /**
145 * get subfolder named $name
146 *
147 * @param string $name wanted subfolder
148 * @return Zend_Mail_Storage_Folder folder named $folder
149 * @throws Zend_Mail_Storage_Exception
150 */
151 public function __get($name)
152 {
153 if (!isset($this->_folders[$name])) {
154 /**
155 * @see Zend_Mail_Storage_Exception
156 */
157 // require_once 'Zend/Mail/Storage/Exception.php';
158 throw new Zend_Mail_Storage_Exception("no subfolder named $name");
159 }
160
161 return $this->_folders[$name];
162 }
163
164 /**
165 * add or replace subfolder named $name
166 *
167 * @param string $name local name of subfolder
168 * @param Zend_Mail_Storage_Folder $folder instance for new subfolder
169 * @return null
170 */
171 public function __set($name, Zend_Mail_Storage_Folder $folder)
172 {
173 $this->_folders[$name] = $folder;
174 }
175
176 /**
177 * remove subfolder named $name
178 *
179 * @param string $name local name of subfolder
180 * @return null
181 */
182 public function __unset($name)
183 {
184 unset($this->_folders[$name]);
185 }
186
187 /**
188 * magic method for easy output of global name
189 *
190 * @return string global name of folder
191 */
192 public function __toString()
193 {
194 return (string)$this->getGlobalName();
195 }
196
197 /**
198 * get local name
199 *
200 * @return string local name
201 */
202 public function getLocalName()
203 {
204 return $this->_localName;
205 }
206
207 /**
208 * get global name
209 *
210 * @return string global name
211 */
212 public function getGlobalName()
213 {
214 return $this->_globalName;
215 }
216
217 /**
218 * is this folder selectable?
219 *
220 * @return bool selectable
221 */
222 public function isSelectable()
223 {
224 return $this->_selectable;
225 }
226
227 /**
228 * check if folder has no subfolder
229 *
230 * @return bool true if no subfolders
231 */
232 public function isLeaf()
233 {
234 return empty($this->_folders);
235 }
236 }
237