1: <?php
2: /**
3: * Copyright 2014 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (GPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/gpl.
7: *
8: * @category Horde
9: * @copyright 2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * Iterator filter for IMP_Ftree that filters non-IMAP elements.
16: *
17: * @author Michael Slusarz <slusarz@horde.org>
18: * @category Horde
19: * @copyright 2014 Horde LLC
20: * @license http://www.horde.org/licenses/gpl GPL
21: * @package IMP
22: */
23: class IMP_Ftree_IteratorFilter_Nonimap extends FilterIterator
24: {
25: /**
26: */
27: public function accept()
28: {
29: $curr = $this->current();
30:
31: if (!$curr->nonimap) {
32: return true;
33: }
34:
35: if (($curr->remote || $curr->namespace) && $curr->children) {
36: $iterator = new IMP_Ftree_IteratorFilter(
37: new IMP_Ftree_Iterator($curr)
38: );
39: $iterator->add(array(
40: $iterator::CONTAINERS,
41: $iterator::NONIMAP
42: ));
43:
44: foreach ($iterator as $val) {
45: return true;
46: }
47: }
48:
49: return false;
50: }
51:
52: }
53: