summaryrefslogtreecommitdiff
path: root/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/swiftmailer/classes/Swift/Mime/ContentEncoder')
-rw-r--r--vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php67
-rw-r--r--vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php123
-rw-r--r--vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php163
-rw-r--r--vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php123
-rw-r--r--vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php88
-rw-r--r--vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php63
6 files changed, 0 insertions, 627 deletions
diff --git a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php b/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
deleted file mode 100644
index 073daaf6..00000000
--- a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Handles Base 64 Transfer Encoding in Swift Mailer.
- *
- * @author Chris Corbyn
- */
-class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base64Encoder implements Swift_Mime_ContentEncoder
-{
- /**
- * Encode stream $in to stream $out.
- *
- * @param Swift_OutputByteStream $os
- * @param Swift_InputByteStream $is
- * @param int $firstLineOffset
- * @param int $maxLineLength, optional, 0 indicates the default of 76 bytes
- */
- public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
- {
- if (0 >= $maxLineLength || 76 < $maxLineLength) {
- $maxLineLength = 76;
- }
-
- $remainder = 0;
-
- while (false !== $bytes = $os->read(8190)) {
- $encoded = base64_encode($bytes);
- $encodedTransformed = '';
- $thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset;
-
- while ($thisMaxLineLength < strlen($encoded)) {
- $encodedTransformed .= substr($encoded, 0, $thisMaxLineLength) . "\r\n";
- $firstLineOffset = 0;
- $encoded = substr($encoded, $thisMaxLineLength);
- $thisMaxLineLength = $maxLineLength;
- $remainder = 0;
- }
-
- if (0 < $remainingLength = strlen($encoded)) {
- $remainder += $remainingLength;
- $encodedTransformed .= $encoded;
- $encoded = null;
- }
-
- $is->write($encodedTransformed);
- }
- }
-
- /**
- * Get the name of this encoding scheme.
- * Returns the string 'base64'.
- *
- * @return string
- */
- public function getName()
- {
- return 'base64';
- }
-}
diff --git a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php b/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php
deleted file mode 100644
index e97195a5..00000000
--- a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Handles Quoted Printable (QP) Transfer Encoding in Swift Mailer using the PHP core function.
- *
- * @author Lars Strojny
- */
-class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_ContentEncoder
-{
- /**
- * @var null|string
- */
- private $charset;
-
- /**
- * @param null|string $charset
- */
- public function __construct($charset = null)
- {
- $this->charset = $charset ? $charset : 'utf-8';
- }
-
- /**
- * Notify this observer that the entity's charset has changed.
- *
- * @param string $charset
- */
- public function charsetChanged($charset)
- {
- $this->charset = $charset;
- }
-
- /**
- * Encode $in to $out.
- *
- * @param Swift_OutputByteStream $os to read from
- * @param Swift_InputByteStream $is to write to
- * @param int $firstLineOffset
- * @param int $maxLineLength 0 indicates the default length for this encoding
- *
- * @throws RuntimeException
- */
- public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
- {
- if ($this->charset !== 'utf-8') {
- throw new RuntimeException(
- sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
- }
-
- $string = '';
-
- while (false !== $bytes = $os->read(8192)) {
- $string .= $bytes;
- }
-
- $is->write($this->encodeString($string));
- }
-
- /**
- * Get the MIME name of this content encoding scheme.
- *
- * @return string
- */
- public function getName()
- {
- return 'quoted-printable';
- }
-
- /**
- * Encode a given string to produce an encoded string.
- *
- * @param string $string
- * @param int $firstLineOffset if first line needs to be shorter
- * @param int $maxLineLength 0 indicates the default length for this encoding
- *
- * @return string
- *
- * @throws RuntimeException
- */
- public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
- {
- if ($this->charset !== 'utf-8') {
- throw new RuntimeException(
- sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
- }
-
- return $this->_standardize(quoted_printable_encode($string));
- }
-
- /**
- * Make sure CRLF is correct and HT/SPACE are in valid places.
- *
- * @param string $string
- *
- * @return string
- */
- protected function _standardize($string)
- {
- // transform CR or LF to CRLF
- $string = preg_replace('~=0D(?!=0A)|(?<!=0D)=0A~', '=0D=0A', $string);
- // transform =0D=0A to CRLF
- $string = str_replace(array("\t=0D=0A", " =0D=0A", "=0D=0A"), array("=09\r\n", "=20\r\n", "\r\n"), $string);
-
- switch ($end = ord(substr($string, -1))) {
- case 0x09:
- $string = substr_replace($string, '=09', -1);
- break;
- case 0x20:
- $string = substr_replace($string, '=20', -1);
- break;
- }
-
- return $string;
- }
-}
diff --git a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php b/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
deleted file mode 100644
index 818e9af6..00000000
--- a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
+++ /dev/null
@@ -1,163 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Handles binary/7/8-bit Transfer Encoding in Swift Mailer.
- *
- * @author Chris Corbyn
- */
-class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_ContentEncoder
-{
- /**
- * The name of this encoding scheme (probably 7bit or 8bit).
- *
- * @var string
- */
- private $_name;
-
- /**
- * True if canonical transformations should be done.
- *
- * @var bool
- */
- private $_canonical;
-
- /**
- * Creates a new PlainContentEncoder with $name (probably 7bit or 8bit).
- *
- * @param string $name
- * @param bool $canonical If canonicalization transformation should be done.
- */
- public function __construct($name, $canonical = false)
- {
- $this->_name = $name;
- $this->_canonical = $canonical;
- }
-
- /**
- * Encode a given string to produce an encoded string.
- *
- * @param string $string
- * @param int $firstLineOffset ignored
- * @param int $maxLineLength - 0 means no wrapping will occur
- *
- * @return string
- */
- public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
- {
- if ($this->_canonical) {
- $string = $this->_canonicalize($string);
- }
-
- return $this->_safeWordWrap($string, $maxLineLength, "\r\n");
- }
-
- /**
- * Encode stream $in to stream $out.
- *
- * @param Swift_OutputByteStream $os
- * @param Swift_InputByteStream $is
- * @param int $firstLineOffset ignored
- * @param int $maxLineLength optional, 0 means no wrapping will occur
- */
- public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
- {
- $leftOver = '';
- while (false !== $bytes = $os->read(8192)) {
- $toencode = $leftOver . $bytes;
- if ($this->_canonical) {
- $toencode = $this->_canonicalize($toencode);
- }
- $wrapped = $this->_safeWordWrap($toencode, $maxLineLength, "\r\n");
- $lastLinePos = strrpos($wrapped, "\r\n");
- $leftOver = substr($wrapped, $lastLinePos);
- $wrapped = substr($wrapped, 0, $lastLinePos);
-
- $is->write($wrapped);
- }
- if (strlen($leftOver)) {
- $is->write($leftOver);
- }
- }
-
- /**
- * Get the name of this encoding scheme.
- *
- * @return string
- */
- public function getName()
- {
- return $this->_name;
- }
-
- /**
- * Not used.
- */
- public function charsetChanged($charset)
- {
- }
-
- /**
- * A safer (but weaker) wordwrap for unicode.
- *
- * @param string $string
- * @param int $length
- * @param string $le
- *
- * @return string
- */
- private function _safeWordwrap($string, $length = 75, $le = "\r\n")
- {
- if (0 >= $length) {
- return $string;
- }
-
- $originalLines = explode($le, $string);
-
- $lines = array();
- $lineCount = 0;
-
- foreach ($originalLines as $originalLine) {
- $lines[] = '';
- $currentLine =& $lines[$lineCount++];
-
- //$chunks = preg_split('/(?<=[\ \t,\.!\?\-&\+\/])/', $originalLine);
- $chunks = preg_split('/(?<=\s)/', $originalLine);
-
- foreach ($chunks as $chunk) {
- if (0 != strlen($currentLine)
- && strlen($currentLine . $chunk) > $length)
- {
- $lines[] = '';
- $currentLine =& $lines[$lineCount++];
- }
- $currentLine .= $chunk;
- }
- }
-
- return implode("\r\n", $lines);
- }
-
- /**
- * Canonicalize string input (fix CRLF).
- *
- * @param string $string
- *
- * @return string
- */
- private function _canonicalize($string)
- {
- return str_replace(
- array("\r\n", "\r", "\n"),
- array("\n", "\n", "\r\n"),
- $string
- );
- }
-}
diff --git a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php b/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
deleted file mode 100644
index 49ea90e6..00000000
--- a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Handles Quoted Printable (QP) Transfer Encoding in Swift Mailer.
- *
- * @author Chris Corbyn
- */
-class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_ContentEncoder
-{
- protected $_dotEscape;
-
- /**
- * Creates a new QpContentEncoder for the given CharacterStream.
- *
- * @param Swift_CharacterStream $charStream to use for reading characters
- * @param Swift_StreamFilter $filter if canonicalization should occur
- * @param bool $dotEscape if dot stuffing workaround must be enabled
- */
- public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null, $dotEscape = false)
- {
- $this->_dotEscape = $dotEscape;
- parent::__construct($charStream, $filter);
- }
-
- public function __sleep()
- {
- return array('_charStream', '_filter', '_dotEscape');
- }
-
- protected function getSafeMapShareId()
- {
- return get_class($this).($this->_dotEscape ? '.dotEscape' : '');
- }
-
- protected function initSafeMap()
- {
- parent::initSafeMap();
- if ($this->_dotEscape) {
- /* Encode . as =2e for buggy remote servers */
- unset($this->_safeMap[0x2e]);
- }
- }
-
- /**
- * Encode stream $in to stream $out.
- *
- * QP encoded strings have a maximum line length of 76 characters.
- * If the first line needs to be shorter, indicate the difference with
- * $firstLineOffset.
- *
- * @param Swift_OutputByteStream $os output stream
- * @param Swift_InputByteStream $is input stream
- * @param int $firstLineOffset
- * @param int $maxLineLength
- */
- public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
- {
- if ($maxLineLength > 76 || $maxLineLength <= 0) {
- $maxLineLength = 76;
- }
-
- $thisLineLength = $maxLineLength - $firstLineOffset;
-
- $this->_charStream->flushContents();
- $this->_charStream->importByteStream($os);
-
- $currentLine = '';
- $prepend = '';
- $size=$lineLen=0;
-
- while (false !== $bytes = $this->_nextSequence()) {
- // If we're filtering the input
- if (isset($this->_filter)) {
- // If we can't filter because we need more bytes
- while ($this->_filter->shouldBuffer($bytes)) {
- // Then collect bytes into the buffer
- if (false === $moreBytes = $this->_nextSequence(1)) {
- break;
- }
-
- foreach ($moreBytes as $b) {
- $bytes[] = $b;
- }
- }
- // And filter them
- $bytes = $this->_filter->filter($bytes);
- }
-
- $enc = $this->_encodeByteSequence($bytes, $size);
- if ($currentLine && $lineLen+$size >= $thisLineLength) {
- $is->write($prepend . $this->_standardize($currentLine));
- $currentLine = '';
- $prepend = "=\r\n";
- $thisLineLength = $maxLineLength;
- $lineLen=0;
- }
- $lineLen+=$size;
- $currentLine .= $enc;
- }
- if (strlen($currentLine)) {
- $is->write($prepend . $this->_standardize($currentLine));
- }
- }
-
- /**
- * Get the name of this encoding scheme.
- * Returns the string 'quoted-printable'.
- *
- * @return string
- */
- public function getName()
- {
- return 'quoted-printable';
- }
-}
diff --git a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php b/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
deleted file mode 100644
index 8480f99f..00000000
--- a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Proxy for quoted-printable content encoders.
- *
- * Switches on the best QP encoder implementation for current charset.
- *
- * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
- */
-class Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_ContentEncoder
-{
- /**
- * @var Swift_Mime_ContentEncoder_QpContentEncoder
- */
- private $safeEncoder;
-
- /**
- * @var Swift_Mime_ContentEncoder_NativeQpContentEncoder
- */
- private $nativeEncoder;
-
- /**
- * @var null|string
- */
- private $charset;
-
- /**
- * Constructor.
- *
- * @param Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder
- * @param Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder
- * @param string|null $charset
- */
- public function __construct(Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder, Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder, $charset)
- {
- $this->safeEncoder = $safeEncoder;
- $this->nativeEncoder = $nativeEncoder;
- $this->charset = $charset;
- }
-
- /**
- * {@inheritdoc}
- */
- public function charsetChanged($charset)
- {
- $this->charset = $charset;
- }
-
- /**
- * {@inheritdoc}
- */
- public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
- {
- $this->getEncoder()->encodeByteStream($os, $is, $firstLineOffset, $maxLineLength);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return 'quoted-printable';
- }
-
- /**
- * {@inheritdoc}
- */
- public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
- {
- return $this->getEncoder()->encodeString($string, $firstLineOffset, $maxLineLength);
- }
-
- /**
- * @return Swift_Mime_ContentEncoder
- */
- private function getEncoder()
- {
- return 'utf-8' === $this->charset ? $this->nativeEncoder : $this->safeEncoder;
- }
-}
diff --git a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php b/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php
deleted file mode 100644
index f717dc78..00000000
--- a/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Handles raw Transfer Encoding in Swift Mailer.
- *
- *
- * @author Sebastiaan Stok <s.stok@rollerscapes.net>
- */
-class Swift_Mime_ContentEncoder_RawContentEncoder implements Swift_Mime_ContentEncoder
-{
- /**
- * Encode a given string to produce an encoded string.
- *
- * @param string $string
- * @param int $firstLineOffset ignored
- * @param int $maxLineLength ignored
- * @return string
- */
- public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
- {
- return $string;
- }
-
- /**
- * Encode stream $in to stream $out.
- *
- * @param Swift_OutputByteStream $in
- * @param Swift_InputByteStream $out
- * @param int $firstLineOffset ignored
- * @param int $maxLineLength ignored
- */
- public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
- {
- while (false !== ($bytes = $os->read(8192))) {
- $is->write($bytes);
- }
- }
-
- /**
- * Get the name of this encoding scheme.
- *
- * @return string
- */
- public function getName()
- {
- return 'raw';
- }
-
- /**
- * Not used.
- */
- public function charsetChanged($charset)
- {
- }
-}