Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of SwiftMailer.
5
 * (c) 2004-2009 Chris Corbyn
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
//@require 'Swift/Mime/Headers/AbstractHeader.php';
12
//@require 'Swift/Mime/HeaderEncoder.php';
13
 
14
/**
15
 * A Simple MIME Header.
16
 * @package Swift
17
 * @subpackage Mime
18
 * @author Chris Corbyn
19
 */
20
class Swift_Mime_Headers_UnstructuredHeader
21
  extends Swift_Mime_Headers_AbstractHeader
22
{
23
 
24
  /**
25
   * The value of this Header.
26
   * @var string
27
   * @access private
28
   */
29
  private $_value;
30
 
31
  /**
32
   * Creates a new SimpleHeader with $name.
33
   * @param string $name
34
   * @param Swift_Mime_HeaderEncoder $encoder
35
   */
36
  public function __construct($name, Swift_Mime_HeaderEncoder $encoder)
37
  {
38
    $this->setFieldName($name);
39
    $this->setEncoder($encoder);
40
  }
41
  /**
42
   * Get the type of Header that this instance represents.
43
   * @return int
44
   * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX
45
   * @see TYPE_DATE, TYPE_ID, TYPE_PATH
46
   */
47
  public function getFieldType()
48
  {
49
    return self::TYPE_TEXT;
50
  }
51
 
52
  /**
53
   * Set the model for the field body.
54
   * This method takes a string for the field value.
55
   * @param string $model
56
   */
57
  public function setFieldBodyModel($model)
58
  {
59
    $this->setValue($model);
60
  }
61
 
62
  /**
63
   * Get the model for the field body.
64
   * This method returns a string.
65
   * @return string
66
   */
67
  public function getFieldBodyModel()
68
  {
69
    return $this->getValue();
70
  }
71
 
72
  /**
73
   * Get the (unencoded) value of this header.
74
   * @return string
75
   */
76
  public function getValue()
77
  {
78
    return $this->_value;
79
  }
80
 
81
  /**
82
   * Set the (unencoded) value of this header.
83
   * @param string $value
84
   */
85
  public function setValue($value)
86
  {
87
    $this->clearCachedValueIf($this->_value != $value);
88
    $this->_value = $value;
89
  }
90
 
91
  /**
92
   * Get the value of this header prepared for rendering.
93
   * @return string
94
   */
95
  public function getFieldBody()
96
  {
97
    if (!$this->getCachedValue())
98
    {
99
      $this->setCachedValue(
100
        str_replace('\\', '\\\\', $this->encodeWords(
101
          $this, $this->_value, -1, $this->getCharset(), $this->getEncoder()
102
          ))
103
        );
104
    }
105
    return $this->getCachedValue();
106
  }
107
 
108
}