Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'upstream/master' into module-class-map-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/Decode.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class Decode
{
/**
* Explode MIME multipart string into seperate parts
* Explode MIME multipart string into separate parts
*
* Parts consist of the header and the body of each MIME part.
*
Expand All @@ -31,7 +31,7 @@ class Decode
*/
public static function splitMime($body, $boundary)
{
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to assume noone needs \r?
$body = str_replace("\r", '', $body);

$start = 0;
Expand Down Expand Up @@ -113,7 +113,7 @@ public static function splitMessage($message, &$headers, &$body, $EOL = Mime::LI
$firstline = strtok($message, "\n");
if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) {
$headers = array();
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to assume noone needs \r?
$body = str_replace(array("\r", "\n"), array('', $EOL), $message);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function getMime()
* only one part is present, the content of this part is returned. If no
* part had been added, an empty string is returned.
*
* Parts are seperated by the mime boundary as defined in Zend_Mime. If
* Parts are separated by the mime boundary as defined in Zend_Mime. If
* {@link setMime()} has been called before this method, the Zend_Mime
* object set by this call will be used. Otherwise, a new Zend_Mime object
* is generated and used.
Expand Down Expand Up @@ -168,7 +168,7 @@ public function getPartContent($partnum, $EOL = Mime::LINEEND)
}

/**
* Explode MIME multipart string into seperate parts
* Explode MIME multipart string into separate parts
*
* Parts consist of the header and the body of each MIME part.
*
Expand Down
13 changes: 6 additions & 7 deletions src/Mime.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,30 +189,30 @@ public static function encodeQuotedPrintableHeader($str, $charset,

// Split encoded text into separate lines
$tmp = "";
while(strlen($str) > 0) {
while (strlen($str) > 0) {
$currentLine = max(count($lines)-1, 0);
$token = self::getNextQuotedPrintableToken($str);
$str = substr($str, strlen($token));

$tmp .= $token;
if($token == '=20') {
if ($token == '=20') {
// only if we have a single char token or space, we can append the
// tempstring it to the current line or start a new line if necessary.
if(strlen($lines[$currentLine].$tmp) > $lineLength) {
if (strlen($lines[$currentLine].$tmp) > $lineLength) {
$lines[$currentLine+1] = $tmp;
} else {
$lines[$currentLine] .= $tmp;
}
$tmp = "";
}
// don't forget to append the rest to the last line
if(strlen($str) == 0) {
if (strlen($str) == 0) {
$lines[$currentLine] .= $tmp;
}
}

// assemble the lines together by pre- and appending delimiters, charset, encoding.
for($i = 0; $i < count($lines); $i++) {
for ($i = 0; $i < count($lines); $i++) {
$lines[$i] = " ".$prefix.$lines[$i]."?=";
}
$str = trim(implode($lineEnd, $lines));
Expand All @@ -227,7 +227,7 @@ public static function encodeQuotedPrintableHeader($str, $charset,
*/
private static function getNextQuotedPrintableToken($str)
{
if(substr($str, 0, 1) == "=") {
if (substr($str, 0, 1) == "=") {
$token = substr($str, 0, 3);
} else {
$token = substr($str, 0, 1);
Expand Down Expand Up @@ -280,7 +280,6 @@ public static function encodeBase64($str,
*
* @param null|string $boundary
* @access public
* @return void
*/
public function __construct($boundary = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function getHeadersArray($EOL = Mime::LINEEND)
$headers[] = array('Content-Location', $this->location);
}

if ($this->language){
if ($this->language) {
$headers[] = array('Content-Language', $this->language);
}

Expand Down

0 comments on commit 91ae13f

Please sign in to comment.