Horde_Mime_Viewer_Richtext
extends Horde_Mime_Viewer_Base
in package
The Horde_Mime_Viewer_Richtext class renders out HTML text from text/richtext content tags, (RFC 1896 [7.1.3]).
A minimal richtext implementation is one that simply converts "
We implement the following tags:
The following tags are implemented differently than described in the RFC
(due to limitations in HTML output):
The following tags are NOT implemented:
Copyright 2004-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Table of Contents
- $_capability : array<string|int, mixed>
- This driver's display capabilities.
- $_conf : array<string|int, mixed>
- Viewer configuration.
- $_metadata : array<string|int, mixed>
- Metadata for the current viewer/data.
- $_mimepart : Horde_Mime_Part
- The Horde_Mime_Part object to render.
- $_required : array<string|int, mixed>
- Required configuration parameters.
- __construct() : mixed
- Constructor.
- canRender() : bool
- Can this driver render the the data?
- embeddedMimeParts() : bool
- Does this MIME part possibly contain embedded MIME parts?
- getConfigParam() : mixed
- Return a configuration parameter for the current viewer.
- getDriver() : string
- Returns the driver name for the current object.
- getEmbeddedMimeParts() : mixed
- If this MIME part can contain embedded MIME part(s), and those part(s) exist, return a representation of that data.
- getMetadata() : mixed
- Returns metadata information on the viewer/data.
- render() : array<string|int, mixed>
- Return the rendered version of the Horde_Mime_Part object.
- setConfigParam() : mixed
- Sets a configuration parameter for the current viewer.
- setMimePart() : mixed
- Sets the Horde_Mime_Part object for the class.
- _getEmbeddedMimeParts() : mixed
- If this MIME part can contain embedded MIME part(s), and those part(s) exist, return a representation of that data.
- _getTempFile() : string
- Returns a temporary file name.
- _getViewer() : mixed
- Return the underlying MIME Viewer for this part.
- _render() : array<string|int, mixed>
- Return the full rendered version of the Horde_Mime_Part object.
- _renderFullReturn() : array<string|int, mixed>
- Internal helper function to add base HTML tags to a render() return array that contains a single MIME part.
- _renderInfo() : array<string|int, mixed>
- Return the rendered information about the Horde_Mime_Part object.
- _renderInline() : array<string|int, mixed>
- Return the rendered inline version of the Horde_Mime_Part object.
- _renderRaw() : array<string|int, mixed>
- Return the raw representation of the Horde_Mime_Part object.
- _renderReturn() : array<string|int, mixed>
- Internal helper function to create render data array for a MIME Part object that only has a single part.
- _textFilter() : string
- Filter text.
- _toHTML() : string
- Convert richtext to HTML.
Properties
$_capability
This driver's display capabilities.
protected
array<string|int, mixed>
$_capability
= array('full' => \true, 'info' => \false, 'inline' => \true, 'raw' => \false)
$_conf
Viewer configuration.
protected
array<string|int, mixed>
$_conf
= array()
$_metadata
Metadata for the current viewer/data.
protected
array<string|int, mixed>
$_metadata
= array(
// Is the part *data* compressed (not the rendered data)?
'compressed' => \false,
// Does this part contain emebedded MIME data?
'embedded' => \false,
// Force inline display of this part?
'forceinline' => \false,
)
$_mimepart
The Horde_Mime_Part object to render.
protected
Horde_Mime_Part
$_mimepart
= \null
$_required
Required configuration parameters.
protected
array<string|int, mixed>
$_required
= array()
Methods
__construct()
Constructor.
public
__construct(Horde_Mime_Part $part[, array<string|int, mixed> $conf = array() ]) : mixed
Parameters
- $part : Horde_Mime_Part
- $conf : array<string|int, mixed> = array()
-
Configuration:
temp_file - (callback) A callback function that returns a temporary filename. Is passed one parameter: a prefix string. DEFAULT: Uses Horde_Util::getTempFile(). text_filter - (callback) A callback function used to filter text. Is called the same as Horde_Text_Filter::filter(). DEFAULT: Uses Horde_Text_Filter::filter().
Tags
Return values
mixed —canRender()
Can this driver render the the data?
public
canRender(string $mode) : bool
Parameters
- $mode : string
-
The mode. Either 'full', 'inline', 'info', or 'raw'.
Return values
bool —True if the driver can render the data for the given view.
embeddedMimeParts()
Does this MIME part possibly contain embedded MIME parts?
public
embeddedMimeParts() : bool
Return values
bool —True if this driver supports parsing embedded MIME parts.
getConfigParam()
Return a configuration parameter for the current viewer.
public
getConfigParam(string $param) : mixed
Parameters
- $param : string
-
The parameter name.
Return values
mixed —The value of the parameter; returns null if the parameter doesn't exist.
getDriver()
Returns the driver name for the current object.
public
getDriver() : string
Return values
string —The driver name.
getEmbeddedMimeParts()
If this MIME part can contain embedded MIME part(s), and those part(s) exist, return a representation of that data.
public
getEmbeddedMimeParts() : mixed
Return values
mixed —A Horde_Mime_Part object representing the embedded data. Returns null if no embedded MIME part(s) exist.
getMetadata()
Returns metadata information on the viewer/data.
public
getMetadata(string $data) : mixed
Parameters
- $data : string
-
The metadata key.
Return values
mixed —The requested information, or null if the key doesn't exist.
render()
Return the rendered version of the Horde_Mime_Part object.
public
render(string $mode) : array<string|int, mixed>
Parameters
- $mode : string
-
The mode:
'full' - A full representation of the MIME part, for use in a view where the output to the browser can be set to the value returned in 'type'. This mode should only return a single MIME ID entry for viewing and should not return any status information. 'inline' - A representation of the MIME part that can be viewed inline on a text/html page that may contain other HTML elements. 'info' - A representation of the MIME part that can be viewed inline on an text/html page that may contain other HTML elements. This view is not a full view, but rather a condensed view of the contents of the MIME part. This view is intended to be displayed to the user with the intention that this MIME part's subparts may also independently be viewed inline. 'raw' - The raw data of the MIME part, generally useful for downloading a part. This view exists in case this raw data needs to be altered in any way.
Return values
array<string|int, mixed> —An array. The keys are the MIME parts that were handled by the driver. The values are either null (which indicates the driver is recommending that this particular MIME ID should not be displayed) or an array with the following keys:
'data' - (string) The rendered data. 'status' - (array) An array of status information to be displayed to the user. Consists of arrays with the following keys: 'class' - (string) The class to use for display. 'img' - (string) An image to display. 'text' - (array) The text to display. 'type' - (string) The MIME type of the rendered data.
setConfigParam()
Sets a configuration parameter for the current viewer.
public
setConfigParam(string $param, mixed $value) : mixed
Parameters
- $param : string
-
The parameter name.
- $value : mixed
-
The parameter value.
Return values
mixed —setMimePart()
Sets the Horde_Mime_Part object for the class.
public
setMimePart(Horde_Mime_Part $mime_part) : mixed
Parameters
- $mime_part : Horde_Mime_Part
-
The object with the data to be rendered.
Return values
mixed —_getEmbeddedMimeParts()
If this MIME part can contain embedded MIME part(s), and those part(s) exist, return a representation of that data.
protected
_getEmbeddedMimeParts() : mixed
Return values
mixed —A Horde_Mime_Part object representing the embedded data. Returns null if no embedded MIME part(s) exist.
_getTempFile()
Returns a temporary file name.
protected
_getTempFile() : string
Return values
string —A temp filename.
_getViewer()
Return the underlying MIME Viewer for this part.
protected
_getViewer() : mixed
Return values
mixed —A Horde_Mime_Viewer object, or false if not found.
_render()
Return the full rendered version of the Horde_Mime_Part object.
protected
_render() : array<string|int, mixed>
Return values
array<string|int, mixed> —See parent::render().
_renderFullReturn()
Internal helper function to add base HTML tags to a render() return array that contains a single MIME part.
protected
_renderFullReturn(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
See render().
Return values
array<string|int, mixed> —See render().
_renderInfo()
Return the rendered information about the Horde_Mime_Part object.
protected
_renderInfo() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —See render().
_renderInline()
Return the rendered inline version of the Horde_Mime_Part object.
protected
_renderInline() : array<string|int, mixed>
Return values
array<string|int, mixed> —See parent::render().
_renderRaw()
Return the raw representation of the Horde_Mime_Part object.
protected
_renderRaw() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —See render().
_renderReturn()
Internal helper function to create render data array for a MIME Part object that only has a single part.
protected
_renderReturn([string $data = null ][, string $type = null ]) : array<string|int, mixed>
Parameters
- $data : string = null
-
The rendered data.
- $type : string = null
-
The rendered type.
Return values
array<string|int, mixed> —See render().
_textFilter()
Filter text.
protected
_textFilter(string $text, mixed $driver[, array<string|int, mixed> $params = array() ]) : string
Parameters
- $text : string
-
TODO
- $driver : mixed
-
TODO
- $params : array<string|int, mixed> = array()
-
TODO
Return values
string —The filtered text.
_toHTML()
Convert richtext to HTML.
protected
_toHTML() : string
Return values
string —The converted HTML string.