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 by subscribed status.
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_Subscribed extends FilterIterator
24: {
25: /**
26: * Are IMAP subscriptions active?
27: *
28: * @var boolean
29: */
30: private $_sub;
31:
32: /**
33: */
34: public function __construct(Iterator $iterator)
35: {
36: global $injector;
37:
38: parent::__construct($iterator);
39:
40: $this->_sub = $injector->getInstance('IMP_Ftree')->subscriptions;
41: }
42:
43: /**
44: */
45: public function accept()
46: {
47: return (!$this->_sub ||
48: $this->current()->subscribed ||
49: $this->current()->children);
50: }
51:
52: }
53: