1: <?php
2: /**
3: * Copyright 2013-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 2013-2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * Metadata information for linked attachments.
16: *
17: * @author Michael Slusarz <slusarz@horde.org>
18: * @category Horde
19: * @copyright 2013-2014 Horde LLC
20: * @license http://www.horde.org/licenses/gpl
21: * @package IMP
22: *
23: * @property array $data Raw data.
24: * @property string $dtoken Delete token.
25: * @property string $filename Filename.
26: * @property integer $time Timestamp.
27: * @property string $type MIME type.
28: */
29: class IMP_Compose_Attachment_Linked_Metadata
30: extends IMP_Compose_Attachment_Metadata
31: {
32: /**
33: * Mapping from array keys -> property names.
34: *
35: * @var array
36: */
37: protected $_map = array(
38: 'd' => 'dtoken',
39: 'f' => 'filename',
40: 'm' => 'type',
41: 't' => 'time'
42: );
43:
44: /**
45: */
46: public function __get($name)
47: {
48: switch ($name) {
49: case 'dtoken':
50: case 'filename':
51: case 'type':
52: $key = array_search($name, $this->_map);
53: return isset($this->_data[$key])
54: ? $this->_data[$key]
55: : null;
56:
57: case 'time':
58: $key = array_search($name, $this->_map);
59: return isset($this->_data[$key])
60: ? $this->_data[$key]
61: : 0;
62: }
63:
64: return parent::__get($name);
65: }
66:
67: /**
68: */
69: public function __set($name, $value)
70: {
71: if (($key = array_search($name, $this->_map)) !== false) {
72: $this->_data[$key] = $value;
73: } else {
74: parent::__set($name, $value);
75: }
76: }
77:
78: }
79: