Documentation

IMP_Contents
in package

Contains all functions related to handling the content and output of mail messages in IMP.

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2002-2017 Horde LLC

license

http://www.horde.org/licenses/gpl GPL

Table of Contents

Constants

HEADER_OB  = 1
HEADER_STREAM  = 3
HEADER_TEXT  = 2
RENDER_FULL  = 1
RENDER_INFO  = 8
RENDER_INLINE  = 2
RENDER_INLINE_AUTO  = 16
RENDER_INLINE_DISP_NO  = 4
RENDER_RAW  = 32
RENDER_RAW_FALLBACK  = 64
SUMMARY_BYTES  = 1
SUMMARY_DESCRIP  = 8
SUMMARY_DESCRIP_LINK  = 16
SUMMARY_DOWNLOAD  = 32
SUMMARY_ICON  = 4
SUMMARY_ICON_RAW  = 16384
SUMMARY_IMAGE_SAVE  = 64
SUMMARY_PRINT  = 128
SUMMARY_PRINT_STUB  = 256
SUMMARY_SIZE  = 2
SUMMARY_STRIP  = 512

Properties

$_build  : bool
Have we scanned for embedded parts?
$_embedded  : array<string|int, mixed>
The list of MIME IDs that consist of embedded data.
$_header  : mixed
Message header.
$_indices  : IMP_Indices_Mailbox
The index of the current message.
$_message  : Horde_Mime_Part
The Horde_Mime_Part object for the message.
$_viewcache  : object
Cached data for the MIME Viewer objects.

Methods

__construct()  : mixed
Constructor.
__toString()  : string
String representation of object.
canDisplay()  : int
Can this MIME part be displayed in the given mode?
downloadAllList()  : array<string|int, mixed>
Get download all list.
findBody()  : string
Finds the main "body" text part (if any) in a message.
findMimeType()  : mixed
Find a MIME type in parent parts.
fullMessageText()  : mixed
Returns the full message text.
getBody()  : mixed
Returns the entire body of the message.
getBodyPart()  : object
Gets the raw text for one section of the message.
getHeader()  : mixed
Returns base header information.
getHeaderAndMarkAsSeen()  : mixed
Returns base header information and marks the message as seen.
getIndicesOb()  : IMP_Indices
Return an IMP_Indices object for the current message.
getListInformation()  : array<string|int, mixed>
Returns mailing list information for the message.
getMailbox()  : IMP_Mailbox
Returns the IMAP mailbox for the current message.
getMIMEMessage()  : Horde_Mime_Part
Returns the Horde_Mime_Part object.
getMimePart()  : Horde_Mime_Part
Fetch a part of a MIME message.
getPartName()  : string
Return the descriptive part label, making sure it is not empty.
getSummary()  : array<string|int, mixed>
Get summary info for a MIME ID.
getTree()  : Horde_Tree_Renderer_Base
Returns the MIME part tree of the message.
getUid()  : int
Returns the IMAP UID for the current message.
getViewCache()  : object
Return the view cache object for this message.
isEmbedded()  : bool
Determines if a given MIME part ID is a part of embedded data.
linkView()  : string
Generate a link to the download/view page.
linkViewJS()  : string
Generate a javascript link to the download/view page.
renderMIMEPart()  : array<string|int, mixed>
Render a MIME Part.
urlView()  : Horde_Url
Return the URL to the download/view page.
_addTreeNodes()  : mixed
Adds MIME parts to the tree instance.
_buildMessage()  : mixed
Builds the "virtual" Horde_Mime_Part object by checking for embedded parts.
_fetchData()  : Horde_Imap_Client_Data_Fetch
Get FETCH data from IMAP server for this message.
_getHeader()  : mixed
Returns base header information.
_urlViewParams()  : array<string|int, mixed>
Generates the necessary URL parameters for the download/view page.

Constants

HEADER_STREAM

public mixed HEADER_STREAM = 3

HEADER_TEXT

public mixed HEADER_TEXT = 2

RENDER_FULL

public mixed RENDER_FULL = 1

RENDER_INFO

public mixed RENDER_INFO = 8

RENDER_INLINE

public mixed RENDER_INLINE = 2

RENDER_INLINE_AUTO

public mixed RENDER_INLINE_AUTO = 16

RENDER_INLINE_DISP_NO

public mixed RENDER_INLINE_DISP_NO = 4

RENDER_RAW_FALLBACK

public mixed RENDER_RAW_FALLBACK = 64

SUMMARY_BYTES

public mixed SUMMARY_BYTES = 1

SUMMARY_DESCRIP

public mixed SUMMARY_DESCRIP = 8
public mixed SUMMARY_DESCRIP_LINK = 16

SUMMARY_DOWNLOAD

public mixed SUMMARY_DOWNLOAD = 32

SUMMARY_ICON

public mixed SUMMARY_ICON = 4

SUMMARY_ICON_RAW

public mixed SUMMARY_ICON_RAW = 16384

SUMMARY_IMAGE_SAVE

public mixed SUMMARY_IMAGE_SAVE = 64

SUMMARY_PRINT

public mixed SUMMARY_PRINT = 128

SUMMARY_PRINT_STUB

public mixed SUMMARY_PRINT_STUB = 256

SUMMARY_SIZE

public mixed SUMMARY_SIZE = 2

SUMMARY_STRIP

public mixed SUMMARY_STRIP = 512

Properties

$_build

Have we scanned for embedded parts?

protected bool $_build = \false

$_embedded

The list of MIME IDs that consist of embedded data.

protected array<string|int, mixed> $_embedded = array()

$_header

Message header.

protected mixed $_header

$_message

The Horde_Mime_Part object for the message.

protected Horde_Mime_Part $_message

$_viewcache

Cached data for the MIME Viewer objects.

protected object $_viewcache

Methods

__construct()

Constructor.

public __construct(mixed $in) : mixed
Parameters
$in : mixed

An IMP_Indices_Mailbox or Horde_Mime_Part object.

Tags
throws
IMP_Exception

__toString()

String representation of object.

public __toString() : string
Return values
string

The indices string.

canDisplay()

Can this MIME part be displayed in the given mode?

public canDisplay(mixed $part, int $mask[, string $type = null ]) : int
Parameters
$part : mixed

The MIME part or a MIME ID string.

$mask : int

One of the RENDER_ constants.

$type : string = null

The type to use (overrides the MIME ID if $id is a MIME part).

Return values
int

The RENDER_ constant of the allowable display.

downloadAllList()

Get download all list.

public downloadAllList() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array of downloadable parts.

findBody()

Finds the main "body" text part (if any) in a message.

public findBody([string $subtype = null ]) : string

"Body" data is the first text part in the base MIME part.

Parameters
$subtype : string = null

Specifically search for this subtype.

Return values
string

The MIME ID of the main body part.

findMimeType()

Find a MIME type in parent parts.

public findMimeType(string $id, string $type) : mixed
Parameters
$id : string

The MIME ID to begin the search at.

$type : string

The MIME type to search for.

Return values
mixed

Either the requested MIME part, or null if not found.

fullMessageText()

Returns the full message text.

public fullMessageText([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

Additional options:

  • stream: (boolean) If true, return a stream for bodytext. DEFAULT: No
Return values
mixed

The full message text or a stream resource if 'stream' is true.

getBody()

Returns the entire body of the message.

public getBody([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

Additional options:

  • stream: (boolean) If true, return a stream. DEFAULT: No
Return values
mixed

The text of the part, or a stream resource if 'stream' is true.

getBodyPart()

Gets the raw text for one section of the message.

public getBodyPart(int $id[, array<string|int, mixed> $options = array() ]) : object
Parameters
$id : int

The ID of the MIME part.

$options : array<string|int, mixed> = array()

Additional options:

  • decode: (boolean) Attempt to decode the bodypart on the remote server. DEFAULT: No
  • length: (integer) If set, only download this many bytes of the bodypart from the server. DEFAULT: All data is retrieved.
  • mimeheaders: (boolean) Include the MIME headers also? DEFAULT: No
  • stream: (boolean) If true, return a stream. DEFAULT: No
Return values
object

Object with the following properties:

  • data: (mixed) The text of the part or a stream resource if 'stream' option is true.
  • decode: (string) If 'decode' option is true, and bodypart decoded on server, the content-type of the decoded data.

getHeader()

Returns base header information.

public getHeader([int $type = self::HEADER_OB ]) : mixed
Parameters
$type : int = self::HEADER_OB

Return type (HEADER_* constant).

Return values
mixed

Either a Horde_Mime_Headers object (HEADER_OB), header text (HEADER_TEXT), or a stream resource (HEADER_STREAM).

getHeaderAndMarkAsSeen()

Returns base header information and marks the message as seen.

public getHeaderAndMarkAsSeen([int $type = self::HEADER_OB ]) : mixed
Parameters
$type : int = self::HEADER_OB

See getHeader().

Return values
mixed

See getHeader().

getIndicesOb()

Return an IMP_Indices object for the current message.

public getIndicesOb() : IMP_Indices
Return values
IMP_Indices

An indices object.

getListInformation()

Returns mailing list information for the message.

public getListInformation() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array with 2 elements:

  - exists: (boolean) True if this is a mailing list message.
  - reply_list: (string) If non-null, the e-mail address to use to post
                to the list.

getMIMEMessage()

Returns the Horde_Mime_Part object.

public getMIMEMessage() : Horde_Mime_Part
Return values
Horde_Mime_Part

A Horde_Mime_Part object.

getMimePart()

Fetch a part of a MIME message.

public getMimePart(int $id[, array<string|int, mixed> $options = array() ]) : Horde_Mime_Part
Parameters
$id : int

The MIME index of the part requested.

$options : array<string|int, mixed> = array()

Additional options:

  • length: (integer) If set, only download this many bytes of the bodypart from the server. DEFAULT: All data is retrieved.
  • nocontents: (boolean) If true, don't add the contents to the part DEFAULT: Contents are added to the part
Return values
Horde_Mime_Part

The raw MIME part asked for. If not found, returns null.

getPartName()

Return the descriptive part label, making sure it is not empty.

public getPartName(Horde_Mime_Part $part[, bool $use_descrip = false ]) : string
Parameters
$part : Horde_Mime_Part

The MIME Part object.

$use_descrip : bool = false

Use description? If false, uses name.

Return values
string

The part label (non-empty).

getSummary()

Get summary info for a MIME ID.

public getSummary(string $id[, int $mask = 0 ]) : array<string|int, mixed>
Parameters
$id : string

The MIME ID.

$mask : int = 0

A bitmask indicating what information to return:

Always output:
  'type' = MIME type

IMP_Contents::SUMMARY_BYTES
  Output: parts = 'bytes'

IMP_Contents::SUMMARY_SIZE
  Output: parts = 'size'

IMP_Contents::SUMMARY_ICON
IMP_Contents::SUMMARY_ICON_RAW
  Output: parts = 'icon'

IMP_Contents::SUMMARY_DESCRIP
  Output: parts = 'description_raw'

IMP_Contents::SUMMARY_DESCRIP_LINK
  Output: parts = 'description'

IMP_Contents::SUMMARY_DOWNLOAD
  Output: parts = 'download', 'download_url'

IMP_Contents::SUMMARY_IMAGE_SAVE
  Output: parts = 'img_save'

IMP_Contents::SUMMARY_PRINT
IMP_Contents::SUMMARY_PRINT_STUB
  Output: parts = 'print'

IMP_Contents::SUMMARY_STRIP
  Output: parts = 'strip'
Return values
array<string|int, mixed>

An array with the requested information.

getTree()

Returns the MIME part tree of the message.

public getTree([string $renderer = 'Horde_Core_Tree_Renderer_Html' ]) : Horde_Tree_Renderer_Base
Parameters
$renderer : string = 'Horde_Core_Tree_Renderer_Html'

Either the tree renderer driver or a full class name to use.

Tags
throws
Horde_Tree_Exception
Return values
Horde_Tree_Renderer_Base

A tree instance representing the MIME parts.

getUid()

Returns the IMAP UID for the current message.

public getUid() : int
Return values
int

The message UID.

getViewCache()

Return the view cache object for this message.

public getViewCache() : object
Return values
object

View object.

isEmbedded()

Determines if a given MIME part ID is a part of embedded data.

public isEmbedded(string $mime_id) : bool
Parameters
$mime_id : string

The MIME ID.

Return values
bool

True if the MIME ID is part of embedded data.

linkView()

Generate a link to the download/view page.

public linkView(Horde_Mime_Part $mime_part, int $actionID, string $text[, array<string|int, mixed> $options = array() ]) : string
Parameters
$mime_part : Horde_Mime_Part

The MIME part to view.

$actionID : int

The actionID value.

$text : string

The ESCAPED (!) link text.

$options : array<string|int, mixed> = array()

Additional parameters:

  - attr: (array) Additional attributed to set on the link.
  - class: (string) The CSS class to use.
  - jstext: (string) The JS text to use.
  - params: (array) A list of any additional parameters that need to be
            passed to the download/view page.
Return values
string

A HTML href link to the download/view page.

linkViewJS()

Generate a javascript link to the download/view page.

public linkViewJS(Horde_Mime_Part $mime_part, string $actionID, string $text[, array<string|int, mixed> $options = array() ]) : string
Parameters
$mime_part : Horde_Mime_Part

The MIME part to view.

$actionID : string

The actionID to perform.

$text : string

The ESCAPED (!) link text.

$options : array<string|int, mixed> = array()

Additional options:

  • css: (string) The CSS class to use.
  • jstext: (string) The javascript link text.
  • onload: (string) A JS function to run when popup window is fully loaded.
  • params: (array) A list of any additional parameters that need to be passed to download/view page. (key = name)
  • widget: (boolean) If true use Horde::widget() to generate, Horde::link() otherwise.
Return values
string

A HTML href link to the download/view page.

renderMIMEPart()

Render a MIME Part.

public renderMIMEPart(string $mime_id, int $mode[, array<string|int, mixed> $options = array() ]) : array<string|int, mixed>
Parameters
$mime_id : string

The MIME ID to render.

$mode : int

One of the RENDER_ constants.

$options : array<string|int, mixed> = array()

Additional options:

  • autodetect: (boolean) Attempt to auto-detect MIME type?
  • mime_part: (Horde_Mime_Part) The MIME part to render.
  • type: (string) Use this MIME type instead of the MIME type identified in the MIME part.
Return values
array<string|int, mixed>

See Horde_Mime_Viewer_Base::render(). The following fields may also be present in addition to the fields defined in Horde_Mime_Viewer_Base:

  • attach: (boolean) Force display of this part as an attachment.
  • js: (array) A list of javascript commands to run after the content is displayed on screen.
  • name: (string) Contains the MIME name information.
  • wrap: (string) If present, indicates that this part, and all child parts, will be wrapped in a DIV with the given class name.

urlView()

Return the URL to the download/view page.

public urlView([Horde_Mime_Part $mime_part = null ][, int $actionID = 'view_attach' ][, array<string|int, mixed> $options = array() ]) : Horde_Url
Parameters
$mime_part : Horde_Mime_Part = null

The MIME part to view.

$actionID : int = 'view_attach'

The actionID to perform.

$options : array<string|int, mixed> = array()

Additional options:

  • params: (array) A list of any additional parameters that need to be passed to the download/view page (key => name).
Return values
Horde_Url

The URL to the download/view page.

_addTreeNodes()

Adds MIME parts to the tree instance.

protected _addTreeNodes(mixed $tree, Horde_Mime_Part $part) : mixed
Parameters
$tree : mixed
$part : Horde_Mime_Part

The MIME part to add.

_buildMessage()

Builds the "virtual" Horde_Mime_Part object by checking for embedded parts.

protected _buildMessage([array<string|int, mixed> $parts = null ]) : mixed
Parameters
$parts : array<string|int, mixed> = null

The parts list to process.

_fetchData()

Get FETCH data from IMAP server for this message.

protected _fetchData(Horde_Imap_Client_Fetch_Query $query) : Horde_Imap_Client_Data_Fetch
Parameters
$query : Horde_Imap_Client_Fetch_Query

Search query.

Return values
Horde_Imap_Client_Data_Fetch

Fetch data for the message.

_getHeader()

Returns base header information.

protected _getHeader(int $type, bool $seen) : mixed
Parameters
$type : int

See getHeader().

$seen : bool

Mark message as seen?

Return values
mixed

See getHeader().

_urlViewParams()

Generates the necessary URL parameters for the download/view page.

protected _urlViewParams(Horde_Mime_Part $mime_part, int $actionID, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$mime_part : Horde_Mime_Part

The MIME part to view.

$actionID : int

The actionID to perform.

$params : array<string|int, mixed>

Additional parameters to pass.

Return values
array<string|int, mixed>

The array of parameters.


        
On this page

Search results