PHP Class IMP_Contents, horde

Author: Michael Slusarz ([email protected])
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_build boolean Have we scanned for embedded parts?
$_embedded array 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.

Public Methods

Method Description
__construct ( mixed $in ) Constructor.
__toString ( ) : string String representation of object.
canDisplay ( mixed $part, integer $mask, string $type = null ) : integer Can this MIME part be displayed in the given mode?
downloadAllList ( ) : array Get download all list.
findBody ( string $subtype = null ) : string Finds the main "body" text part (if any) in a message.
findMimeType ( string $id, string $type ) : mixed Find a MIME type in parent parts.
fullMessageText ( array $options = [] ) : mixed Returns the full message text.
getBody ( array $options = [] ) : mixed Returns the entire body of the message.
getBodyPart ( integer $id, array $options = [] ) : object Gets the raw text for one section of the message.
getHeader ( integer $type = self::HEADER_OB ) : mixed Returns base header information.
getHeaderAndMarkAsSeen ( integer $type = self::HEADER_OB ) : 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 Returns mailing list information for the message.
getMIMEMessage ( ) : Horde_Mime_Part Returns the Horde_Mime_Part object.
getMailbox ( ) : IMP_Mailbox Returns the IMAP mailbox for the current message.
getMimePart ( integer $id, array $options = [] ) : Horde_Mime_Part Fetch a part of a MIME message.
getPartName ( Horde_Mime_Part $part, boolean $use_descrip = false ) : string Return the descriptive part label, making sure it is not empty.
getSummary ( string $id, integer $mask ) : array Get summary info for a MIME ID.
getTree ( string $renderer = 'Horde_Core_Tree_Renderer_Html' ) : Horde_Tree_Renderer_Base Returns the MIME part tree of the message.
getUid ( ) : integer Returns the IMAP UID for the current message.
getViewCache ( ) : object Return the view cache object for this message.
isEmbedded ( string $mime_id ) : boolean Determines if a given MIME part ID is a part of embedded data.
linkView ( Horde_Mime_Part $mime_part, integer $actionID, string $text, array $options = [] ) : string Generate a link to the download/view page.
linkViewJS ( Horde_Mime_Part $mime_part, string $actionID, string $text, array $options = [] ) : string Generate a javascript link to the download/view page.
renderMIMEPart ( string $mime_id, integer $mode, array $options = [] ) : array Render a MIME Part.
urlView ( Horde_Mime_Part $mime_part = null, integer $actionID = 'view_attach', array $options = [] ) : Horde_Url Return the URL to the download/view page.

Protected Methods

Method Description
_addTreeNodes ( $tree, Horde_Mime_Part $part ) Adds MIME parts to the tree instance.
_buildMessage ( array $parts = null ) Builds the "virtual" Horde_Mime_Part object by checking for embedded parts.
_fetchData ( Horde_Imap_Client_Fetch_Query $query ) : Horde_Imap_Client_Data_Fetch Get FETCH data from IMAP server for this message.
_getHeader ( integer $type, boolean $seen ) : mixed Returns base header information.
_urlViewParams ( Horde_Mime_Part $mime_part, integer $actionID, array $params ) : array Generates the necessary URL parameters for the download/view page.

Method Details

__construct() public method

Constructor.
public __construct ( mixed $in )
$in mixed An IMP_Indices_Mailbox or Horde_Mime_Part object.

__toString() public method

String representation of object.
public __toString ( ) : string
return string The indices string.

_addTreeNodes() protected method

Adds MIME parts to the tree instance.
protected _addTreeNodes ( $tree, Horde_Mime_Part $part )
$part Horde_Mime_Part The MIME part to add.

_buildMessage() protected method

Builds the "virtual" Horde_Mime_Part object by checking for embedded parts.
protected _buildMessage ( array $parts = null )
$parts array The parts list to process.

_fetchData() protected method

Get FETCH data from IMAP server for this message.
protected _fetchData ( Horde_Imap_Client_Fetch_Query $query ) : Horde_Imap_Client_Data_Fetch
$query Horde_Imap_Client_Fetch_Query Search query.
return Horde_Imap_Client_Data_Fetch Fetch data for the message.

_getHeader() protected method

Returns base header information.
protected _getHeader ( integer $type, boolean $seen ) : mixed
$type integer See getHeader().
$seen boolean Mark message as seen?
return mixed See getHeader().

_urlViewParams() protected method

Generates the necessary URL parameters for the download/view page.
protected _urlViewParams ( Horde_Mime_Part $mime_part, integer $actionID, array $params ) : array
$mime_part Horde_Mime_Part The MIME part to view.
$actionID integer The actionID to perform.
$params array Additional parameters to pass.
return array The array of parameters.

canDisplay() public method

Can this MIME part be displayed in the given mode?
public canDisplay ( mixed $part, integer $mask, string $type = null ) : integer
$part mixed The MIME part or a MIME ID string.
$mask integer One of the RENDER_ constants.
$type string The type to use (overrides the MIME ID if $id is a MIME part).
return integer The RENDER_ constant of the allowable display.

downloadAllList() public method

Get download all list.
public downloadAllList ( ) : array
return array An array of downloadable parts.

findBody() public method

"Body" data is the first text part in the base MIME part.
public findBody ( string $subtype = null ) : string
$subtype string Specifically search for this subtype.
return string The MIME ID of the main body part.

findMimeType() public method

Find a MIME type in parent parts.
public findMimeType ( string $id, string $type ) : mixed
$id string The MIME ID to begin the search at.
$type string The MIME type to search for.
return mixed Either the requested MIME part, or null if not found.

fullMessageText() public method

Returns the full message text.
public fullMessageText ( array $options = [] ) : mixed
$options array Additional options: - stream: (boolean) If true, return a stream for bodytext. DEFAULT: No
return mixed The full message text or a stream resource if 'stream' is true.

getBody() public method

Returns the entire body of the message.
public getBody ( array $options = [] ) : mixed
$options array Additional options: - stream: (boolean) If true, return a stream. DEFAULT: No
return mixed The text of the part, or a stream resource if 'stream' is true.

getBodyPart() public method

Gets the raw text for one section of the message.
public getBodyPart ( integer $id, array $options = [] ) : object
$id integer The ID of the MIME part.
$options 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 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() public method

Returns base header information.
public getHeader ( integer $type = self::HEADER_OB ) : mixed
$type integer Return type (HEADER_* constant).
return mixed Either a Horde_Mime_Headers object (HEADER_OB), header text (HEADER_TEXT), or a stream resource (HEADER_STREAM).

getHeaderAndMarkAsSeen() public method

Returns base header information and marks the message as seen.
public getHeaderAndMarkAsSeen ( integer $type = self::HEADER_OB ) : mixed
$type integer See getHeader().
return mixed See getHeader().

getIndicesOb() public method

Return an IMP_Indices object for the current message.
public getIndicesOb ( ) : IMP_Indices
return IMP_Indices An indices object.

getListInformation() public method

Returns mailing list information for the message.
public getListInformation ( ) : array
return array 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() public method

Returns the Horde_Mime_Part object.
public getMIMEMessage ( ) : Horde_Mime_Part
return Horde_Mime_Part A Horde_Mime_Part object.

getMailbox() public method

Returns the IMAP mailbox for the current message.
public getMailbox ( ) : IMP_Mailbox
return IMP_Mailbox The message mailbox.

getMimePart() public method

Fetch a part of a MIME message.
public getMimePart ( integer $id, array $options = [] ) : Horde_Mime_Part
$id integer The MIME index of the part requested.
$options 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 Horde_Mime_Part The raw MIME part asked for. If not found, returns null.

getPartName() public method

Return the descriptive part label, making sure it is not empty.
public getPartName ( Horde_Mime_Part $part, boolean $use_descrip = false ) : string
$part Horde_Mime_Part The MIME Part object.
$use_descrip boolean Use description? If false, uses name.
return string The part label (non-empty).

getSummary() public method

Get summary info for a MIME ID.
public getSummary ( string $id, integer $mask ) : array
$id string The MIME ID.
$mask integer 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 array An array with the requested information.

getTree() public method

Returns the MIME part tree of the message.
public getTree ( string $renderer = 'Horde_Core_Tree_Renderer_Html' ) : Horde_Tree_Renderer_Base
$renderer string Either the tree renderer driver or a full class name to use.
return Horde_Tree_Renderer_Base A tree instance representing the MIME parts.

getUid() public method

Returns the IMAP UID for the current message.
public getUid ( ) : integer
return integer The message UID.

getViewCache() public method

Return the view cache object for this message.
public getViewCache ( ) : object
return object View object.

isEmbedded() public method

Determines if a given MIME part ID is a part of embedded data.
public isEmbedded ( string $mime_id ) : boolean
$mime_id string The MIME ID.
return boolean True if the MIME ID is part of embedded data.

linkView() public method

Generate a link to the download/view page.
public linkView ( Horde_Mime_Part $mime_part, integer $actionID, string $text, array $options = [] ) : string
$mime_part Horde_Mime_Part The MIME part to view.
$actionID integer The actionID value.
$text string The ESCAPED (!) link text.
$options 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 string A HTML href link to the download/view page.

linkViewJS() public method

Generate a javascript link to the download/view page.
public linkViewJS ( Horde_Mime_Part $mime_part, string $actionID, string $text, array $options = [] ) : string
$mime_part Horde_Mime_Part The MIME part to view.
$actionID string The actionID to perform.
$text string The ESCAPED (!) link text.
$options 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 string A HTML href link to the download/view page.

renderMIMEPart() public method

Render a MIME Part.
public renderMIMEPart ( string $mime_id, integer $mode, array $options = [] ) : array
$mime_id string The MIME ID to render.
$mode integer One of the RENDER_ constants.
$options 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 array 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() public method

Return the URL to the download/view page.
public urlView ( Horde_Mime_Part $mime_part = null, integer $actionID = 'view_attach', array $options = [] ) : Horde_Url
$mime_part Horde_Mime_Part The MIME part to view.
$actionID integer The actionID to perform.
$options array Additional options: - params: (array) A list of any additional parameters that need to be passed to the download/view page (key => name).
return Horde_Url The URL to the download/view page.

Property Details

$_build protected property

Have we scanned for embedded parts?
protected bool $_build
return boolean

$_embedded protected property

The list of MIME IDs that consist of embedded data.
protected array $_embedded
return array

$_header protected property

Message header.
protected mixed $_header
return mixed

$_indices protected property

The index of the current message.
protected IMP_Indices_Mailbox $_indices
return IMP_Indices_Mailbox

$_message protected property

The Horde_Mime_Part object for the message.
protected Horde_Mime_Part $_message
return Horde_Mime_Part

$_viewcache protected property

Cached data for the MIME Viewer objects.
protected object $_viewcache
return object