commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / packages / ezc / Mail / src / structs / content_disposition_header.php
1 <?php
2 /**
3 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
4 * @license http://ez.no/licenses/new_bsd New BSD License
5 * @version 1.7beta1
6 * @filesource
7 * @package Mail
8 */
9
10 /**
11 * A container to store a Content-Disposition header as described in http://www.faqs.org/rfcs/rfc2183.
12 *
13 * This container is used on the contentDisposition property on mail parts.
14 * Use it for reading and setting the Content-Disposition header.
15 *
16 * @package Mail
17 * @version 1.7beta1
18 */
19 class ezcMailContentDispositionHeader extends ezcBaseStruct
20 {
21 /**
22 * The disposition type, either "inline" or "attachment".
23 *
24 * @var string
25 */
26 public $disposition;
27
28 /**
29 * The filename of the attachment.
30 *
31 * The filename should never include path information.
32 *
33 * @var string
34 */
35 public $fileName;
36
37 /**
38 * The filename of the attachment, formatted for display. Used only for
39 * parsing, not used when generating a mail.
40 *
41 * The filename should never include path information.
42 *
43 * Added for issue #13038. If you use __set_state() be sure to set this
44 * property also.
45 *
46 * @var string
47 */
48 public $displayFileName;
49
50 /**
51 * The language of the filename.
52 *
53 * @var string
54 */
55 public $fileNameLanguage;
56
57 /**
58 * The characterset of the file name.
59 *
60 * @var string
61 */
62 public $fileNameCharSet;
63
64 /**
65 * The creation date of the file attachment.
66 *
67 * The time should be formatted as specified by http://www.faqs.org/rfcs/rfc822.html
68 * section 5.
69 *
70 * A typical example is: Sun, 21 May 2006 16:00:50 +0400
71 *
72 * @var string
73 */
74 public $creationDate;
75
76 /**
77 * The last modification date of the file attachment.
78 *
79 * The time should be formatted as specified by http://www.faqs.org/rfcs/rfc822.html
80 * section 5.
81 *
82 * A typical example is: Sun, 21 May 2006 16:00:50 +0400
83 *
84 * @var string
85 */
86 public $modificationDate;
87
88 /**
89 * The last date the file attachment was read.
90 *
91 * The time should be formatted as specified by http://www.faqs.org/rfcs/rfc822.html
92 * section 5.
93 *
94 * A typical example is: Sun, 21 May 2006 16:00:50 +0400
95 *
96 * @var string
97 */
98 public $readDate;
99
100 /**
101 * The size of the content in bytes.
102 *
103 * @var int
104 */
105 public $size;
106
107 /**
108 * Any additional parameters provided in the Content-Disposition header.
109 *
110 * The format of the field is array(parameterName=>parameterValue)
111 *
112 * @var array(string=>string)
113 */
114 public $additionalParameters = array();
115
116 /**
117 * Holds language and characterset data for the additional parameters.
118 *
119 * Format: array(parameterName=>array('charSet'=>string,'language'=>string))
120 *
121 * @apichange Merge this with $additionalParamters OR come up with an entirely new idea for the ContentDispositionHeader
122 * @var array(string=>array())
123 */
124 public $additionalParametersMetaData = array();
125
126 /**
127 * Constructs a new ezcMailContentDispositionHeader holding the various values of this
128 * container.
129 *
130 * @param string $disposition
131 * @param string $fileName
132 * @param string $creationDate
133 * @param string $modificationDate
134 * @param string $readDate
135 * @param string $size
136 * @param array(string=>string) $additionalParameters
137 * @param string $fileNameLanguage
138 * @param string $fileNameCharSet
139 */
140 public function __construct( $disposition = 'inline',
141 $fileName = null,
142 $creationDate = null,
143 $modificationDate = null,
144 $readDate = null,
145 $size = null,
146 $additionalParameters = array(),
147 $fileNameLanguage = null,
148 $fileNameCharSet = null,
149 $displayFileName = null )
150 {
151 $this->disposition = $disposition;
152 $this->fileName = $fileName;
153 $this->fileNameLanguage = $fileNameLanguage;
154 $this->fileNameCharSet = $fileNameCharSet;
155 $this->displayFileName = $displayFileName;
156 $this->creationDate = $creationDate;
157 $this->modificationDate = $modificationDate;
158 $this->readDate = $readDate;
159 $this->size = $size;
160 $this->additionalParameters = $additionalParameters;
161 }
162
163 /**
164 * Returns a new instance of this class with the data specified by $array.
165 *
166 * $array contains all the data members of this class in the form:
167 * array('member_name'=>value).
168 *
169 * __set_state makes this class exportable with var_export.
170 * var_export() generates code, that calls this method when it
171 * is parsed with PHP.
172 *
173 * @param array(string=>mixed) $array
174 * @return ezcMailAddress
175 */
176 static public function __set_state( array $array )
177 {
178 return new ezcMailContentDispositionHeader( $array['disposition'],
179 $array['fileName'],
180 $array['creationDate'],
181 $array['modificationDate'],
182 $array['readDate'],
183 $array['size'],
184 $array['additionalParameters'],
185 $array['fileNameLanguage'],
186 $array['fileNameCharSet'],
187 $array['displayFileName']
188 );
189 }
190 }
191
192 ?>