Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
 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: /**
12:  * Handles RFC 2231 specified Encoding in Swift Mailer.
13:  * @package Swift
14:  * @subpackage Encoder
15:  * @author Chris Corbyn
16:  */
17: class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
18: {
19:     /**
20:      * A character stream to use when reading a string as characters instead of bytes.
21:      * @var Swift_CharacterStream
22:      * @access private
23:      */
24:     private $_charStream;
25: 
26:     /**
27:      * Creates a new Rfc2231Encoder using the given character stream instance.
28:      * @param Swift_CharacterStream
29:      */
30:     public function __construct(Swift_CharacterStream $charStream)
31:     {
32:         $this->_charStream = $charStream;
33:     }
34: 
35:     /**
36:      * Takes an unencoded string and produces a string encoded according to
37:      * RFC 2231 from it.
38:      * @param  string $string          to encode
39:      * @param  int    $firstLineOffset
40:      * @param  int    $maxLineLength,  optional, 0 indicates the default of 75 bytes
41:      * @return string
42:      */
43:     public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
44:     {
45:         $lines = array(); $lineCount = 0;
46:         $lines[] = '';
47:         $currentLine =& $lines[$lineCount++];
48: 
49:         if (0 >= $maxLineLength) {
50:             $maxLineLength = 75;
51:         }
52: 
53:         $this->_charStream->flushContents();
54:         $this->_charStream->importString($string);
55: 
56:         $thisLineLength = $maxLineLength - $firstLineOffset;
57: 
58:         while (false !== $char = $this->_charStream->read(4)) {
59:             $encodedChar = rawurlencode($char);
60:             if (0 != strlen($currentLine)
61:                 && strlen($currentLine . $encodedChar) > $thisLineLength)
62:             {
63:                 $lines[] = '';
64:                 $currentLine =& $lines[$lineCount++];
65:                 $thisLineLength = $maxLineLength;
66:             }
67:             $currentLine .= $encodedChar;
68:         }
69: 
70:         return implode("\r\n", $lines);
71:     }
72: 
73:     /**
74:      * Updates the charset used.
75:      * @param string $charset
76:      */
77:     public function charsetChanged($charset)
78:     {
79:         $this->_charStream->setCharacterSet($charset);
80:     }
81: }
82: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen