Class MIME_Viewer

Description

The MIME_Viewer:: class provides an abstracted interface to render out MIME types into HTML format. It depends on a set of MIME_Viewer_* drivers which handle the actual rendering, and also a configuration file to map MIME types to drivers.

$Horde: framework/MIME/MIME/Viewer.php,v 1.64.10.15 2009/01/06 15:23:20 jan Exp $

Copyright 1999-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Located in /MIME/MIME/Viewer.php (line 18)


	
			
Direct descendents
Class Description
 class MIME_Viewer_audio The MIME_Viewer_audio class sends audio parts to the browser for handling by the browser, a plugin, or a helper application.
 class MIME_Viewer_deb The MIME_Viewer_deb class renders out lists of files in Debian packages by using the dpkg tool to query the package.
 class MIME_Viewer_default The MIME_Viewer_default class simply prints out the encapsulated content. It exists as a fallback if no other intelligent rendering mechanism could be used.
 class MIME_Viewer_enriched The MIME_Viewer_enriched class renders out plain text from enriched content tags, ala RFC 1896.
 class MIME_Viewer_images The MIME_Viewer_images class allows images to be displayed.
 class MIME_Viewer_msexcel The MIME_Viewer_msexcel class renders out Microsoft Excel documents in HTML format by using the xlHtml package.
 class MIME_Viewer_mspowerpoint The MIME_Viewer_mspowerpoint class renders out Microsoft Powerpoint documents in HTML format by using the xlHtml package.
 class MIME_Viewer_msword The MIME_Viewer_msword class renders out Microsoft Word documents in HTML format by using the wvWare package.
 class MIME_Viewer_ooo The MIME_Viewer_ooo class renders out OpenOffice.org documents in HTML format.
 class MIME_Viewer_pdf The MIME_Viewer_pdf class simply outputs the PDF file with the content-type 'application/pdf' enabling web browsers with a PDF viewer plugin to view the PDF file inside the browser.
 class MIME_Viewer_plain The MIME_Viewer_plain class renders out plain text with URLs made into hyperlinks (if viewing inline).
 class MIME_Viewer_rar The MIME_Viewer_rar class renders out the contents of .rar archives in HTML format.
 class MIME_Viewer_report The MIME_Viewer_report class is a wrapper used to load the appropriate MIME_Viewer for multipart/report data (RFC 3462).
 class MIME_Viewer_rfc822 The MIME_Viewer_rfc822 class renders out messages from the message/rfc822 content type.
 class MIME_Viewer_richtext The MIME_Viewer_richtext class renders out HTML text from text/richtext content tags, (RFC 1896 [7.1.3]).
 class MIME_Viewer_rpm The MIME_Viewer_rpm class renders out lists of files in RPM packages by using the rpm tool to query the package.
 class MIME_Viewer_rtf The MIME_Viewer_rtf class renders out Rich Text Fromat documents in HTML format by using the UnRTF package (http://www.gnu.org/software/unrtf/unrtf.html).
 class MIME_Viewer_security The MIME_Viewer_security class is a wrapper used to load the appropriate MIME_Viewer for secure multipart messages (defined by RFC 1847). This class handles multipart/signed and multipart/encrypted data.
 class MIME_Viewer_simple The MIME_Viewer_simple class renders out plain text without any modifications.
 class MIME_Viewer_smil The MIME_Viewer_smil renders SMIL documents to very basic HTML.
 class MIME_Viewer_source The MIME_Viewer_source class is a class for any viewer that wants to provide line numbers to extend.
 class MIME_Viewer_tgz The MIME_Viewer_tgz class renders out plain or gzipped tarballs in HTML.
 class MIME_Viewer_tnef The MIME_Viewer_tnef class allows MS-TNEF attachments to be displayed.
 class MIME_Viewer_webcpp The MIME_Viewer_webcpp class renders out various content in HTML format by using Web C Plus Plus.
 class MIME_Viewer_wordperfect The MIME_Viewer_wordperfect class renders out WordPerfect documents in HTML format by using the libwpd package (http://libwpd.sourceforge.net/).
 class MIME_Viewer_zip The MIME_Viewer_zip class renders out the contents of ZIP files in HTML format.
 class MIME_Viewer_html The MIME_Viewer_html class renders out HTML text with an effort to remove potentially malicious code.
 class MIME_Viewer_vcard The MIME_Viewer_vcard class renders out vCards in HTML format.
Variable Summary
Method Summary
 MIME_Viewer MIME_Viewer (MIME_Part &$mime_part, [ $conf = array()])
 boolean canDisplayInline ()
 MIME_Viewer &factory (MIME_Part &$mime_part, [string $mime_type = null])
 boolean forceInlineView ()
 string getCharset ()
 mixed getConfigParam (string $param)
 stdClass getDriver (string $mimeType, [string $module = 'horde'])
 string getIcon (string $mimeType)
 string getType ()
 stdClass includeDriver (string $mime_type)
 string render ([mixed $params = null])
 string renderAttachmentInfo (mixed $params)
 string resolveDriver ([string $driver = 'default'], [string $app = 'horde'])
 void setMIMEPart (MIME_Part &$mime_part)
Variables
MIME_Part $mime_part (line 25)

The MIME_Part object to render.

array $_conf = array() (line 32)

Configuration parameters.

array $_driverCache = array() (line 39)

getDriver cache.

boolean $_forceinline = false (line 47)

Force viewing of a part inline, regardless of the Content-Disposition of the MIME Part.

Methods
Constructor MIME_Viewer (line 144)

Constructor for MIME_Viewer

MIME_Viewer MIME_Viewer (MIME_Part &$mime_part, [ $conf = array()])
  • MIME_Part &$mime_part: Reference to a MIME_Part object with the information to be rendered.
  • $conf
canDisplayInline (line 220)

Can this driver render the the data inline?

  • return: True if the driver can display inline.
boolean canDisplayInline ()
factory (line 60)

Attempts to return a concrete MIME_Viewer_* object based on the type of MIME_Part passed onto it.

  • return: The MIME_Viewer object, or false on error.
MIME_Viewer &factory (MIME_Part &$mime_part, [string $mime_type = null])
  • MIME_Part &$mime_part: Reference to a MIME_Part object with the information to be rendered.
  • string $mime_type: Use this MIME type instead of the type stored in the $mime_part.
forceInlineView (line 473)

Should we force viewing of this MIME Part inline, regardless of the Content-Disposition of the MIME Part?

  • return: Force viewing inline?
boolean forceInlineView ()
getCharset (line 449)

Returns the character set used for the Viewer.

Should be overridden by individual drivers to perform custom tasks.

  • return: The character set used by this Viewer.
string getCharset ()
getConfigParam (line 462)

Return a configuration parameter for the current viewer.

  • return: The value of the parameter; returns null if the parameter doesn't exist.
mixed getConfigParam (string $param)
  • string $param: The parameter name.
getDriver (line 262)

Given an input MIME type and a module name, this function resolves it into a specific output driver which can handle it.

  • return: Object with the following items:
     'driver'  --  Name of driver (e.g. 'enscript')
     'exact'   --  Was the driver and exact match? (true/false)
     'module'  --  The module containing driver (e.g. 'horde')
    Returns false if driver could not be found.
stdClass getDriver (string $mimeType, [string $module = 'horde'])
  • string $mimeType: MIME type to resolve.
  • string $module: Module in which to search for the driver.
getIcon (line 352)

Given a MIME type, this function will return an appropriate icon.

  • return: The URL to the appropriate icon.
string getIcon (string $mimeType)
  • string $mimeType: The MIME type that we need an icon for.
getType (line 170)

Return the MIME type of the rendered content. This can be

overridden by the individual drivers, depending on what format they output in. By default, it passes through the MIME type of the object, or replaces custom extension types with 'text/plain' to let the browser do a best-guess render.

  • return: MIME-type of the output content.
string getType ()

Redefined in descendants as:
includeDriver (line 95)

Include the code for the relevant driver.

  • return: See MIME_Driver::getDriver().
stdClass includeDriver (string $mime_type)
  • string $mime_type: The Content-type of the part to be rendered.
render (line 191)

Return the rendered version of the object.

Should be overridden by individual drivers to perform custom tasks. The $mime_part class variable has the information to render, encapsulated in a MIME_Part object.

  • return: Rendered version of the object.
string render ([mixed $params = null])
  • mixed $params: Any optional parameters this driver needs at runtime.

Redefined in descendants as:
renderAttachmentInfo (line 211)

Return text/html output used as alternative output when the fully

rendered object cannot (or should not) be displayed. For example, this function should be used for MIME attachments that cannot be viewed inline, where the user may be given options on how to view the attachment. Should be overridden by individual drivers to perform custom tasks. The $mime_part class variable has the information to render, encapsulated in a MIME_Part object.

  • return: Text/html rendered information.
string renderAttachmentInfo (mixed $params)
  • mixed $params: Any optional parameters this driver needs at runtime.

Redefined in descendants as:
resolveDriver (line 238)

Given a driver and an application, this returns the fully qualified filesystem path to the driver source file.

  • return: Filesystem path of the driver/application queried.
string resolveDriver ([string $driver = 'default'], [string $app = 'horde'])
  • string $driver: Driver name.
  • string $app: Application name.
setMIMEPart (line 156)

Sets the MIME_Part object for the class.

void setMIMEPart (MIME_Part &$mime_part)
  • MIME_Part &$mime_part: Reference to a MIME_Part object with the information to be rendered.

Documentation generated on Sun, 30 Jan 2011 05:23:18 +0000 by phpDocumentor 1.4.3