Remove unneeded IMP_Mime_Viewer binder
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 4 Oct 2010 19:49:01 +0000 (13:49 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 4 Oct 2010 19:58:40 +0000 (13:58 -0600)
imp/lib/Application.php
imp/lib/Contents.php
imp/lib/Injector/Binder/MimeViewer.php [deleted file]
imp/lib/Injector/Factory/MimeViewer.php
imp/lib/Prefs/Ui.php

index 7f27a6d..0ffd7d4 100644 (file)
@@ -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()
index 6a4ada1..d080627 100644 (file)
@@ -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 (file)
index f9eb0a1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * Binder for the Horde_Mime_Viewer which includes support for the IMP
- * drivers.
- *
- * Copyright 2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author   Michael Slusarz <slusarz@horde.org>
- * @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;
-    }
-
-}
index 7add9a4..b05f646 100644 (file)
@@ -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);
     }
 
 }
index 611074d..bdc66e5 100644 (file)
@@ -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';