\Colibri\IO\MailHelper

Класс помощник для всяких операций с строками

Summary

Methods
Properties
Constants
FixEOL()
UTF8CharBoundary()
WrapText()
Base64EncodeWrapMB()
EncodeQPphp()
EncodeQP()
EncodeQ()
EncodeString()
EncodeHeader()
EncodeFile()
GetBoundaryBegin()
GetBoundaryEnd()
HeaderLine()
TextLine()
CheckForMultbyte()
StripNewLines()
No public properties found
LE
LF
CR
CRLF
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

LE

LE = "\n"

Конец

LF

LF = "\n"

Конец строки

CR

CR = "\r"

Перевод корретки

CRLF

CRLF = "\r\n"

Конец строки и перевод корретки

Methods

FixEOL()

FixEOL(string  $line, string  $char = self::LE) : string

Исправляет конец строки

Parameters

string $line

строка

string $char

добавить в конце

Returns

string

UTF8CharBoundary()

UTF8CharBoundary(string  $encodedText, integer  $maxLength) : integer

Finds last character boundary prior to maxLength in a utf-8 quoted (printable) encoded string.

Original written by Colin Brown.

Parameters

string $encodedText

utf-8 QP text

integer $maxLength

find last character boundary prior to this length

Returns

integer

WrapText()

WrapText(string  $message, string  $length, string  $charset, boolean  $qp_mode = false) : string

Wraps message for use with mailers that do not automatically perform wrapping and for quoted-printable.

Original written by philippe.

Parameters

string $message
string $length
string $charset
boolean $qp_mode

Returns

string

Base64EncodeWrapMB()

Base64EncodeWrapMB(string  $str, string  $charset) : string

Correctly encodes and wraps long multibyte strings for mail headers without breaking lines within a character.

Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php

Parameters

string $str

multi-byte text to wrap encode

string $charset

charset

Returns

string

EncodeQPphp()

EncodeQPphp(string  $input = '', integer  $line_max = 76, boolean  $space_conv = false) : string

Encode string to quoted-printable.

Only uses standard PHP, slow, but will always work

Parameters

string $input

the text to encode

integer $line_max

Number of chars allowed on a line before wrapping

boolean $space_conv

Returns

string

EncodeQP()

EncodeQP(string  $string, integer  $line_max = 76, boolean  $space_conv = false) : string

Encode string to RFC2045 (6.7) quoted-printable format Uses a PHP5 stream filter to do the encoding about 64x faster than the old version Also results in same content as you started with after decoding

Parameters

string $string

the text to encode

integer $line_max

Number of chars allowed on a line before wrapping

boolean $space_conv

Dummy param for compatibility with existing EncodeQP function

Returns

string

EncodeQ()

EncodeQ(string  $str, string  $position = 'text') : string

Encode string to q encoding.

Parameters

string $str

the text to encode

string $position

Where the text is going to be used, see the RFC for what that means

Returns

string

EncodeString()

EncodeString(string  $str, string  $encoding = 'base64') : string

Encodes string to requested format.

Returns an empty string on failure.

Parameters

string $str

The text to encode

string $encoding

The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'

Returns

string

EncodeHeader()

EncodeHeader(string  $str, string  $position = 'text', string  $charset = 'utf-8') : string

Encode a header string to best (shortest) of Q, B, quoted or none.

Parameters

string $str
string $position
string $charset

Returns

string

EncodeFile()

EncodeFile(string  $path, string  $encoding = 'base64') : string

Encodes attachment in requested format.

Returns an empty string on failure.

Parameters

string $path

The full path to the file

string $encoding

The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'

Returns

string

GetBoundaryBegin()

GetBoundaryBegin(string  $boundary, string  $charSet, string  $contentType, string  $encoding) : string

Returns the start of a message boundary.

Parameters

string $boundary
string $charSet
string $contentType
string $encoding

Returns

string

GetBoundaryEnd()

GetBoundaryEnd(string  $boundary) : string

Returns the end of a message boundary.

Parameters

string $boundary

Returns

string

HeaderLine()

HeaderLine(string  $name, string  $value) : string

Returns a formatted header line.

Parameters

string $name
string $value

Returns

string

TextLine()

TextLine(string  $value) : string

Returns a formatted mail line.

Parameters

string $value

Returns

string

CheckForMultbyte()

CheckForMultbyte(string  $string, string  $encoding) : boolean

Checks a string gor multibyte

Parameters

string $string
string $encoding

Returns

boolean

StripNewLines()

StripNewLines(string  $string) : string

Strips a new lines from string

Parameters

string $string

Returns

string