19d470aa |
1 | <?php |
2 | |
3 | /** |
4 | * ContentType.class.php |
5 | * |
0f459286 |
6 | * This file contains functions needed to handle content type headers |
7 | * (rfc2045) in mime messages. |
19d470aa |
8 | * |
8ed19238 |
9 | * @copyright 2003-2019 The SquirrelMail Project Team |
4b4abf93 |
10 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
883d9cd3 |
11 | * @version $Id$ |
2b646597 |
12 | * @package squirrelmail |
0f459286 |
13 | * @subpackage mime |
14 | * @since 1.3.2 |
19d470aa |
15 | */ |
16 | |
2b646597 |
17 | /** |
0f459286 |
18 | * Class that handles content-type headers |
19 | * Class was named content_type in 1.3.0 and 1.3.1. It is used internally |
20 | * by rfc822header class. |
2b646597 |
21 | * @package squirrelmail |
0f459286 |
22 | * @subpackage mime |
23 | * @since 1.3.2 |
2b646597 |
24 | */ |
19d470aa |
25 | class ContentType { |
0f459286 |
26 | /** |
27 | * Media type |
28 | * @var string |
29 | */ |
30 | var $type0 = 'text'; |
31 | /** |
32 | * Media subtype |
33 | * @var string |
34 | */ |
35 | var $type1 = 'plain'; |
36 | /** |
37 | * Auxiliary header information |
38 | * prepared with parseContentType() function in rfc822header class. |
39 | * @var array |
40 | */ |
41 | var $properties = ''; |
19d470aa |
42 | |
0f459286 |
43 | /** |
0fd4ea6d |
44 | * Constructor (PHP5 style, required in some future version of PHP) |
0f459286 |
45 | * Prepared type0 and type1 properties |
46 | * @param string $type content type string without auxiliary information |
47 | */ |
0fd4ea6d |
48 | function __construct($type) { |
6f6ed9a7 |
49 | $type = strtolower($type); |
19d470aa |
50 | $pos = strpos($type, '/'); |
51 | if ($pos > 0) { |
52 | $this->type0 = substr($type, 0, $pos); |
53 | $this->type1 = substr($type, $pos+1); |
54 | } else { |
55 | $this->type0 = $type; |
56 | } |
57 | $this->properties = array(); |
58 | } |
0fd4ea6d |
59 | |
60 | /** |
61 | * Constructor (PHP4 style, kept for compatibility reasons) |
62 | * Prepared type0 and type1 properties |
63 | * @param string $type content type string without auxiliary information |
64 | */ |
65 | function ContentType($type) { |
77e3ccf6 |
66 | self::__construct($type); |
0fd4ea6d |
67 | } |
19d470aa |
68 | } |