1: <?php
2: /**
3: * The Horde_Mime_Viewer_Security class is a wrapper used to load the
4: * appropriate Horde_Mime_Viewer for secure multipart messages (defined by RFC
5: * 1847). This class handles multipart/signed and multipart/encrypted data.
6: *
7: * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
8: *
9: * See the enclosed file COPYING for license information (LGPL). If you
10: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
11: *
12: * @author Michael Slusarz <slusarz@horde.org>
13: * @category Horde
14: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
15: * @package Mime_Viewer
16: */
17: class Horde_Mime_Viewer_Security extends Horde_Mime_Viewer_Base
18: {
19: /**
20: * Constructor.
21: *
22: * @param Horde_Mime_Part $mime_part The object with the data to be
23: * rendered.
24: * @param array $conf Configuration:
25: * <pre>
26: * 'viewer_callback' - (callback) A callback to a factory that will
27: * return the appropriate viewer for the embedded
28: * MIME type. Is passed three parameters: the
29: * current driver object, the MIME part object, and
30: * the MIME type to use.
31: * </pre>
32: */
33: public function __construct(Horde_Mime_Part $part, array $conf = array())
34: {
35: parent::__construct($part, $conf);
36: }
37:
38: /**
39: * Return the underlying MIME Viewer for this part.
40: *
41: * @return mixed A Horde_Mime_Viewer object, or false if not found.
42: */
43: protected function _getViewer()
44: {
45: if (($callback = $this->getConfigParam('viewer_callback')) &&
46: ($protocol = $this->_mimepart->getContentTypeParameter('protocol'))) {
47: return call_user_func($callback, $this, $this->_mimepart, $protocol);
48: }
49:
50: return false;
51: }
52:
53: }
54: