1: <?php
2:
3: 4: 5: 6: 7: 8: 9:
10:
11: require_once dirname(__FILE__) . '/../HeaderEncoder.php';
12: require_once dirname(__FILE__) . '/../../Encoder/QpEncoder.php';
13: require_once dirname(__FILE__) . '/../../CharacterStream.php';
14:
15: 16: 17: 18: 19: 20:
21: class Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_HeaderEncoder
22: {
23: 24: 25: 26:
27: public function __construct(Swift_CharacterStream $charStream)
28: {
29: parent::__construct($charStream);
30: }
31:
32: protected function initSafeMap()
33: {
34: foreach (array_merge(
35: range(0x61, 0x7A), range(0x41, 0x5A),
36: range(0x30, 0x39), array(0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F)
37: ) as $byte) {
38: $this->_safeMap[$byte] = chr($byte);
39: }
40: }
41:
42: 43: 44: 45: 46:
47: public function getName()
48: {
49: return 'Q';
50: }
51:
52: 53: 54: 55: 56: 57: 58:
59: public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0, $charst = 'utf-8')
60: {
61: return str_replace(array(' ', '=20', "=\r\n"), array('_', '_', "\r\n"),
62: parent::encodeString($string, $firstLineOffset, $maxLineLength)
63: );
64: }
65: }
66: