123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <?php
-
-
-
-
-
- class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
- {
-
-
- protected $_userFormat;
-
-
- protected $_userCharset;
-
-
- protected $_userDelSp;
-
-
- private $_nestingLevel = self::LEVEL_ALTERNATIVE;
-
-
-
- public function __construct(Swift_Mime_HeaderSet $headers,
- Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $charset = null)
- {
- parent::__construct($headers, $encoder, $cache, $grammar);
- $this->setContentType('text/plain');
- if (!is_null($charset))
- {
- $this->setCharset($charset);
- }
- }
-
-
-
- public function setBody($body, $contentType = null, $charset = null)
- {
- parent::setBody($body, $contentType);
- if (isset($charset))
- {
- $this->setCharset($charset);
- }
- return $this;
- }
-
-
-
- public function getCharset()
- {
- return $this->_getHeaderParameter('Content-Type', 'charset');
- }
-
-
-
- public function setCharset($charset)
- {
- $this->_setHeaderParameter('Content-Type', 'charset', $charset);
- if ($charset !== $this->_userCharset)
- {
- $this->_clearCache();
- }
- $this->_userCharset = $charset;
- parent::charsetChanged($charset);
- return $this;
- }
-
-
-
- public function getFormat()
- {
- return $this->_getHeaderParameter('Content-Type', 'format');
- }
-
-
-
- public function setFormat($format)
- {
- $this->_setHeaderParameter('Content-Type', 'format', $format);
- $this->_userFormat = $format;
- return $this;
- }
-
-
-
- public function getDelSp()
- {
- return ($this->_getHeaderParameter('Content-Type', 'delsp') == 'yes')
- ? true
- : false;
- }
-
-
-
- public function setDelSp($delsp = true)
- {
- $this->_setHeaderParameter('Content-Type', 'delsp', $delsp ? 'yes' : null);
- $this->_userDelSp = $delsp;
- return $this;
- }
-
-
-
- public function getNestingLevel()
- {
- return $this->_nestingLevel;
- }
-
-
-
- public function charsetChanged($charset)
- {
- $this->setCharset($charset);
- }
-
-
-
-
- protected function _fixHeaders()
- {
- parent::_fixHeaders();
- if (count($this->getChildren()))
- {
- $this->_setHeaderParameter('Content-Type', 'charset', null);
- $this->_setHeaderParameter('Content-Type', 'format', null);
- $this->_setHeaderParameter('Content-Type', 'delsp', null);
- }
- else
- {
- $this->setCharset($this->_userCharset);
- $this->setFormat($this->_userFormat);
- $this->setDelSp($this->_userDelSp);
- }
- }
-
-
- protected function _setNestingLevel($level)
- {
- $this->_nestingLevel = $level;
- }
-
- }
|