From: Michael M Slusarz Date: Mon, 4 Oct 2010 19:49:01 +0000 (-0600) Subject: Remove unneeded IMP_Mime_Viewer binder X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7be19256a67f81a97894f9891779b80b8fcd6e7d;p=horde.git Remove unneeded IMP_Mime_Viewer binder --- diff --git a/imp/lib/Application.php b/imp/lib/Application.php index 7f27a6d43..0ffd7d44f 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -97,7 +97,6 @@ class IMP_Application extends Horde_Registry_Application 'IMP_Imap_Tree' => new IMP_Injector_Binder_Imaptree(), 'IMP_Mail' => new IMP_Injector_Binder_Mail(), 'IMP_Mailbox_List' => new IMP_Injector_Binder_MailboxList(), - 'IMP_Mime_Viewer' => new IMP_Injector_Binder_MimeViewer(), 'IMP_Quota' => new IMP_Injector_Binder_Quota(), 'IMP_Search' => new IMP_Injector_Binder_Search(), 'IMP_Sentmail' => new IMP_Injector_Binder_Sentmail() diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index 6a4ada1d1..d0806272e 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -385,7 +385,7 @@ class IMP_Contents ? null : $options['type']; - $viewer = $GLOBALS['injector']->getInstance('IMP_Mime_Viewer')->getViewer($mime_part, $this, $type); + $viewer = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_MimeViewer')->create($mime_part, $this, $type); switch ($mode) { case self::RENDER_FULL: @@ -678,7 +678,7 @@ class IMP_Contents if ($is_atc && $download_zip && ($part['bytes'] > 204800)) { - $viewer = $GLOBALS['injector']->getInstance('IMP_Mime_Viewer')->getViewer($mime_part, $this, $mime_type); + $viewer = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_MimeViewer')->create($mime_part, $this, $mime_type); if (!$viewer->getMetadata('compressed')) { $part['download_zip'] = $this->linkView($mime_part, 'download_attach', null, array('class' => 'downloadZipAtc', 'dload' => true, 'jstext' => sprintf(_("Download %s in .zip Format"), $mime_part->getDescription(true)), 'params' => array('zip' => 1))); } @@ -896,7 +896,7 @@ class IMP_Contents $last_id = null; $mime_part = $this->getMIMEPart($id, array('nocontents' => true)); - $viewer = $GLOBALS['injector']->getInstance('IMP_Mime_Viewer')->getViewer($mime_part, $this); + $viewer = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_MimeViewer')->create($mime_part, $this); if ($viewer->embeddedMimeParts()) { $mime_part = $this->getMIMEPart($id); $viewer->setMIMEPart($mime_part); @@ -931,7 +931,7 @@ class IMP_Contents if (!is_object($part)) { $part = $this->getMIMEPart($part, array('nocontents' => true)); } - $viewer = $GLOBALS['injector']->getInstance('IMP_Mime_Viewer')->getViewer($part, $this, $type); + $viewer = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_MimeViewer')->create($part, $this, $type); if ($mask & self::RENDER_INLINE_AUTO) { $mask |= self::RENDER_INLINE | self::RENDER_INFO; diff --git a/imp/lib/Injector/Binder/MimeViewer.php b/imp/lib/Injector/Binder/MimeViewer.php deleted file mode 100644 index f9eb0a111..000000000 --- a/imp/lib/Injector/Binder/MimeViewer.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @category Horde - * @license http://www.fsf.org/copyleft/gpl.html GPL - * @package IMP - */ -class IMP_Injector_Binder_MimeViewer implements Horde_Injector_Binder -{ - /** - */ - public function create(Horde_Injector $injector) - { - return new IMP_Injector_Factory_MimeViewer($injector); - } - - /** - */ - public function equals(Horde_Injector_Binder $binder) - { - return false; - } - -} diff --git a/imp/lib/Injector/Factory/MimeViewer.php b/imp/lib/Injector/Factory/MimeViewer.php index 7add9a4ea..b05f6467a 100644 --- a/imp/lib/Injector/Factory/MimeViewer.php +++ b/imp/lib/Injector/Factory/MimeViewer.php @@ -56,16 +56,15 @@ class IMP_Injector_Factory_MimeViewer * @return Horde_Mime_Viewer_Base The newly created instance. * @throws Horde_Mime_Viewer_Exception */ - public function getViewer(Horde_Mime_Part $mime, - IMP_Contents $contents = null, - $type = null) + public function create(Horde_Mime_Part $mime, + IMP_Contents $contents = null, $type = null) { list($driver, $params) = $this->_injector->getInstance('Horde_Mime_Viewer')->getViewerConfig($type ? $type : $mime->getType(), 'imp'); switch ($driver) { case 'Report': case 'Security': - $params['viewer_callback'] = array($this, 'getViewerCallback'); + $params['viewer_callback'] = array($this, 'createCallback'); break; } @@ -88,10 +87,10 @@ class IMP_Injector_Factory_MimeViewer * @return Horde_Mime_Viewer_Base The newly created instance. * @throws Horde_Mime_Viewer_Exception */ - public function getViewerCallback(Horde_Mime_Viewer_Base $viewer, - Horde_Mime_Part $mime, $type) + public function createCallback(Horde_Mime_Viewer_Base $viewer, + Horde_Mime_Part $mime, $type) { - return $this->getViewer($mime, $viewer->getConfigParam('imp_contents'), $type); + return $this->create($mime, $viewer->getConfigParam('imp_contents'), $type); } } diff --git a/imp/lib/Prefs/Ui.php b/imp/lib/Prefs/Ui.php index 611074d05..bdc66e5d4 100644 --- a/imp/lib/Prefs/Ui.php +++ b/imp/lib/Prefs/Ui.php @@ -310,7 +310,7 @@ class IMP_Prefs_Ui $mock_part = new Horde_Mime_Part(); $mock_part->setType('text/html'); - $v = $GLOBALS['injector']->getInstance('IMP_Mime_Viewer')->getViewer($mock_part); + $v = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_MimeViewer')->create($mock_part); if (!$v->canRender('inline')) { $ui->suppress[] = 'alternative_display';