class Helper

Methods

static string
mailTagger(string $mail = '', string $name = null)

Build a person string compliant to RFC2822

static string
mailListTagger(array $list)

Build a list of person strings compliant to RFC2822

static string
headerTagger(string $name = '', string $value = '', array $adds = array())

Build a mail header tag compliant to RFC2822

static string
listAddresses(array $list = array(), string $type = 'to')

Build a list of name=>email pairs compliant to RFC2822

static string
formatText(string $txt = '', string $type = 'plain', bool $spaces = false)

Format a text with a special encoding

static string
getMimeType(string $filename = '')

Search the MIME type of a file

static string
html2text(string $str)

Converts HTML to plain text

static array
deduplicate(array $array)

De-duplicate a set of name=>email pairs to let each email just once

static array
checkPeopleArgs()

Clean and build a set of name=>email pairs

static string
charAscii(string $char)

Returns the ASCII equivalent of a character

static bool
isAscii(string $string)

ASCII validator

static bool
isEmail(string $str = '')

Check if an email address is valid

Details

at line 48
static string mailTagger(string $mail = '', string $name = null)

Build a person string compliant to RFC2822

Parameters

string $mail The person's email address
string $name The person's name if so

Return Value

string The generated tag

at line 59
static string mailListTagger(array $list)

Build a list of person strings compliant to RFC2822

Parameters

array $list

Return Value

string

at line 82
static string headerTagger(string $name = '', string $value = '', array $adds = array())

Build a mail header tag compliant to RFC2822

Parameters

string $name The name of the tag
string $value The value of the tag
array $adds A variable=>value pairs to add to the tag string

Return Value

string The generated header tag string

at line 100
static string listAddresses(array $list = array(), string $type = 'to')

Build a list of name=>email pairs compliant to RFC2822

Parameters

array $list A list of name=>email pairs
string $type The type of the field

Return Value

string The generated list

at line 119
static string formatText(string $txt = '', string $type = 'plain', bool $spaces = false)

Format a text with a special encoding

Parameters

string $txt The text to format
string $type The type of the encoding : 'plain' or 'ascii'
bool $spaces Replace all spaces with underscores or not (default is FALSE)

Return Value

string The transformed text

at line 150
static string getMimeType(string $filename = '')

Search the MIME type of a file

Parameters

string $filename The filename to check

Return Value

string The associated MIME type

at line 171
static string html2text(string $str)

Converts HTML to plain text

Parameters

string $str The HTML content to transform

Return Value

string The associated plain text version

at line 182
static array deduplicate(array $array)

De-duplicate a set of name=>email pairs to let each email just once

Parameters

array $array

Return Value

array

at line 218
static array checkPeopleArgs()

Clean and build a set of name=>email pairs

Arguments can be writtent as : ( 'my@email.address' ) ( 'my@email.address', 'my name' ) ( array( 'my name'=>'my@email.address' ) ) ( array( 'my name'=>'my@email.address', 'another name'=>'another@email.address' ) ) ( array( 'my name'=>'my@email.address', 'another@email.address' ) )

Return Value

array

at line 256
static string charAscii(string $char)

Returns the ASCII equivalent of a character

Parameters

string $char The character to test

Return Value

string The ASCII valid character

at line 269
static bool isAscii(string $string)

ASCII validator

Parameters

string $string The content to test

Return Value

bool

at line 280
static bool isEmail(string $str = '')

Check if an email address is valid

Parameters

string $str The email address to check

Return Value

bool