PHP Class Jyxo\Mail\Parser

Based on \Mail\IMAPv2 class (c) Copyright 2004-2005 Richard York
Author: Jaroslav HanslĂ­k
Datei anzeigen Open project: jyxo/php

Public Methods

Method Description
__construct ( resource $connection, integer $uid ) Creates an instance.
decodeBody ( string $body, string $encoding ) : string Decodes body.
getAllRelatedParts ( string $pid ) : array Returns all related parts.
getAttachments ( ) : array Returns a list of attachments.
getBody ( string $pid = '1', integer $mode = self::BODY, string $mimeType = 'text/html', integer $attempt = 1 ) : array Returns body of the given part.
getHeaders ( string $pid = null ) : array Returns headers.
getInlines ( ) : array Returns a list of part Ids of inline parts.
getMime ( array $types ) : array Returns a list of part Ids of given types.
getMimeExcept ( array $exceptTypes ) : array Returns a list of part Ids of all parts except for the given types.
getRelatedParts ( string $pid, array $types, boolean $all = false ) : array Returns related parts.
parseBody ( string $pid = null, string $mimeType = 'text/html', boolean $alternative = true, boolean $all = false ) Parses message body.

Private Methods

Method Description
addPart ( integer $structureNo, string $partType ) Adds a part to the list.
checkIfParsed ( ) Parses a message if not already parsed.
convertToUtf8 ( string $string, string $charset = '' ) : string Converts a string from various encodings to UTF-8.
decodeFilename ( string $filename ) : string Decodes attachment's name.
decodeMimeHeader ( string $header ) : string Decodes given header.
getDefaultPid ( string $mimeType = 'text/html', integer $attempt = 1 ) : string Returns default part's Id.
getMajorMimeType ( integer $mimetypeNo ) : string Returns textual representation of the major mime-type.
getMultipartPid ( string $pid, string $mimeType, string $lookFor ) : string Returns a part Id.
getRawHeaders ( string $pid = null ) : string Returns raw headers.
isMultipart ( string $subtype ) : boolean Returns if the message is multipart/subtype.
isParentAlternative ( integer $partNo ) : boolean Returns if the parent is multipart/alternative type.
isPartMultipart ( integer $partNo, string $subtype ) : boolean Returns if the given part is is multipart/subtype.
parseMultiparts ( string $pid, string $mimeType, string $lookFor = 'all', integer $pidAdd = 1, boolean $getAlternative = true ) Parses multiple parts.
setStructure ( array $subparts = null, string $parentPartId = null, boolean $skipPart = false, boolean $lastWasSigned = false ) Creates message structure.

Method Details

__construct() public method

Creates an instance.
public __construct ( resource $connection, integer $uid )
$connection resource IMAP folder connection.
$uid integer Message Id

decodeBody() public static method

Decodes body.
public static decodeBody ( string $body, string $encoding ) : string
$body string Body
$encoding string Body encoding
return string

getAllRelatedParts() public method

Returns all related parts.
public getAllRelatedParts ( string $pid ) : array
$pid string Part Id
return array

getAttachments() public method

Returns a list of attachments.
public getAttachments ( ) : array
return array

getBody() public method

Returns body of the given part.
public getBody ( string $pid = '1', integer $mode = self::BODY, string $mimeType = 'text/html', integer $attempt = 1 ) : array
$pid string Part Id
$mode integer Body return mode
$mimeType string Requested mime-type
$attempt integer Number of retries
return array

getHeaders() public method

Returns headers.
public getHeaders ( string $pid = null ) : array
$pid string Part Id
return array

getInlines() public method

Returns a list of part Ids of inline parts.
public getInlines ( ) : array
return array

getMime() public method

Returns a list of part Ids of given types.
public getMime ( array $types ) : array
$types array Part types
return array

getMimeExcept() public method

Returns a list of part Ids of all parts except for the given types.
public getMimeExcept ( array $exceptTypes ) : array
$exceptTypes array Ignored part types
return array

getRelatedParts() public method

Returns related parts.
public getRelatedParts ( string $pid, array $types, boolean $all = false ) : array
$pid string Part Id
$types array List of types to search for
$all boolean Return all types
return array

parseBody() public method

Parses message body.
public parseBody ( string $pid = null, string $mimeType = 'text/html', boolean $alternative = true, boolean $all = false )
$pid string Part Id
$mimeType string Default mime-type
$alternative boolean Should the alternative part be used as well
$all boolean Should all parts get parsed