TYPO3  7.6
Base64Encoder.php
Go to the documentation of this file.
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 
17 {
31  public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
32  {
33  if (0 >= $maxLineLength || 76 < $maxLineLength) {
34  $maxLineLength = 76;
35  }
36 
37  $encodedString = base64_encode($string);
38  $firstLine = '';
39 
40  if (0 != $firstLineOffset) {
41  $firstLine = substr(
42  $encodedString, 0, $maxLineLength - $firstLineOffset
43  )."\r\n";
44  $encodedString = substr(
45  $encodedString, $maxLineLength - $firstLineOffset
46  );
47  }
48 
49  return $firstLine.trim(chunk_split($encodedString, $maxLineLength, "\r\n"));
50  }
51 
55  public function charsetChanged($charset)
56  {
57  }
58 }