\Horde_Core_Factory_MimeViewer

A Horde_Injector based Horde_Mime_Viewer factory.

This class is used for factories that are intended to have their create() methods manually called by code.

Copyright 2011-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.

Summary

Methods
Properties
Constants
__construct()
create()
getViewerConfig()
getViewerCallback()
getIcon()
No public properties found
No constants found
_getDriverName()
$_injector
N/A
_loadConfig()
_getDriver()
$_config
N/A

Properties

$_injector

$_injector : \Horde_Injector

The injector.

Type

\Horde_Injector

$_config

$_config : array

Driver configuration.

Type

array

Methods

__construct()

__construct(\Horde_Injector  $injector) 

Constructor.

Parameters

\Horde_Injector $injector

The injector to use.

create()

create(\Horde_Mime_Part  $mime, array  $opts = array()) : \Horde_Mime_Viewer_Base

Attempts to return a concrete Horde_Mime_Viewer object based on the MIME type.

Parameters

\Horde_Mime_Part $mime

An object with the data to be rendered.

array $opts

Additional options:

  app: (string) The Horde application to search for drivers in.
       DEFAULT: current app
  type: (string) The MIME type to use for loading.
        DEFAULT: Uses MIME type in $mime.

Throws

\Horde_Mime_Viewer_Exception

Returns

\Horde_Mime_Viewer_Base —

The newly created instance.

getViewerConfig()

getViewerConfig(string  $type, string  $app) : array

Gets the configuration for a MIME type.

Parameters

string $type

The MIME type.

string $app

The current Horde application.

Returns

array —

The driver and a list of configuration parameters.

getViewerCallback()

getViewerCallback(\Horde_Mime_Viewer_Base  $viewer, \Horde_Mime_Part  $mime, string  $type) : \Horde_Mime_Viewer_Base

Callback used to return a MIME Viewer object from within certain Viewer drivers.

Parameters

\Horde_Mime_Viewer_Base $viewer

The MIME Viewer driver requesting the new object.

\Horde_Mime_Part $mime

An object with the data to be rendered.

string $type

The MIME type to use for rendering.

Throws

\Horde_Mime_Viewer_Exception

Returns

\Horde_Mime_Viewer_Base —

The newly created instance.

getIcon()

getIcon(\Horde_Mime_Part|string  $mime, array  $opts = array()) : \Horde_Themes_Image

Return the appropriate icon for a MIME object/MIME type.

Parameters

\Horde_Mime_Part|string $mime

The MIME object or type to query.

array $opts

Additional options:

'app' - (string) The Horde application to search for drivers in.
        DEFAULT: current app

Returns

\Horde_Themes_Image

An object which contains the URI and filesystem location of the image.

_getDriverName()

_getDriverName(string  $driver, string  $base) : string

Return the classname of the driver to load.

Parameters

string $driver

Driver name.

string $base

The base classname.

Throws

\Horde_Exception

Returns

string —

Classname.

_loadConfig()

_loadConfig(string  $app) 

Create the driver configuration for an application.

Parameters

string $app

The Horde application to search for drivers in.

_getDriver()

_getDriver(string  $type, string  $app) : array

Get the driver config for a MIME type.

Parameters

string $type

The MIME type query.

string $app

The Horde application to search for drivers in.

Returns

array —

The driver config.