Remove unneeded IMP_Contents binder
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 4 Oct 2010 19:35:16 +0000 (13:35 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 4 Oct 2010 19:35:31 +0000 (13:35 -0600)
19 files changed:
imp/lib/Ajax/Application.php
imp/lib/Application.php
imp/lib/Compose.php
imp/lib/Filter.php
imp/lib/Injector/Binder/Contents.php [deleted file]
imp/lib/Injector/Factory/Contents.php
imp/lib/Mailbox/List.php
imp/lib/Message.php
imp/lib/Mime/Viewer/Partial.php
imp/lib/Spam.php
imp/lib/Ui/Compose.php
imp/lib/Views/ShowMessage.php
imp/message-mimp.php
imp/message.php
imp/pgp.php
imp/saveimage.php
imp/smime.php
imp/thread.php
imp/view.php

index a28e579..2e756c3 100644 (file)
@@ -1816,7 +1816,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         $imp_compose = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Compose')->create($this->_vars->imp_compose);
         if (!($imp_contents = $imp_compose->getContentsOb())) {
             $imp_contents = $this->_vars->uid
-                ? $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($this->_vars->uid))
+                ? $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($this->_vars->uid))
                 : null;
         }
 
index 65ffa57..10c333d 100644 (file)
@@ -91,7 +91,6 @@ class IMP_Application extends Horde_Registry_Application
         /* Add IMP-specific binders. */
         $binders = array(
             'IMP_AuthImap' => new IMP_Injector_Binder_AuthImap(),
-            'IMP_Contents' => new IMP_Injector_Binder_Contents(),
             'IMP_Crypt_Pgp' => new IMP_Injector_Binder_Pgp(),
             'IMP_Crypt_Smime' => new IMP_Injector_Binder_Smime(),
             'IMP_Identity' => new IMP_Injector_Binder_Identity(),
index c2001c3..cffb590 100644 (file)
@@ -316,7 +316,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         global $injector, $prefs;
 
         try {
-            $contents = $injector->getInstance('IMP_Contents')->getOb($indices);
+            $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create($indices);
         } catch (IMP_Exception $e) {
             throw new IMP_Compose_Exception($e);
         }
@@ -409,7 +409,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
                     // even though the server is the same. UIDVALIDITY should
                     // catch any true server/backend changes.
                     ($imp_imap->checkUidvalidity($imap_url['mailbox']) == $imap_url['uidvalidity']) &&
-                    $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($imap_url['mailbox'], $imap_url['uid']))) {
+                    $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($imap_url['mailbox'], $imap_url['uid']))) {
                     $this->_metadata['mailbox'] = $imap_url['mailbox'];
                     $this->_metadata['reply_type'] = $reply_type;
                     $this->_metadata['uid'] = $imap_url['uid'];
@@ -1793,7 +1793,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         $attached = 0;
         foreach ($indices as $mbox => $idx) {
             ++$attached;
-             $contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $idx));
+             $contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $idx));
              $headerob = $contents->getHeaderOb();
 
              $part = new Horde_Mime_Part();
@@ -2714,7 +2714,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
     public function getContentsOb()
     {
         return $this->getMetadata('reply_type')
-            ? $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($this->getMetadata('mailbox'), $this->getMetadata('uid')))
+            ? $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($this->getMetadata('mailbox'), $this->getMetadata('uid')))
             : null;
     }
 
index e3edecf..3d74d77 100644 (file)
@@ -119,7 +119,7 @@ class IMP_Filter
 
         /* Get the list of from addresses. */
         foreach ($indices as $mbox => $idx) {
-            $contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $idx));
+            $contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $idx));
             $hdr = $contents->getHeaderOb();
             $addr[] = Horde_Mime_Address::bareAddress($hdr->getValue('from'));
         }
diff --git a/imp/lib/Injector/Binder/Contents.php b/imp/lib/Injector/Binder/Contents.php
deleted file mode 100644 (file)
index a2aeeb0..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Binder for IMP_Contents::.
- *
- * 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_Contents implements Horde_Injector_Binder
-{
-    /**
-     */
-    public function create(Horde_Injector $injector)
-    {
-        return new IMP_Injector_Factory_Contents($injector);
-    }
-
-    /**
-     */
-    public function equals(Horde_Injector_Binder $binder)
-    {
-        return false;
-    }
-
-}
index e29f688..5447df6 100644 (file)
@@ -35,23 +35,6 @@ class IMP_Injector_Factory_Contents
     private $_instances = array();
 
     /**
-     * The injector.
-     *
-     * @var Horde_Injector
-     */
-    private $_injector;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Injector $injector  The injector to use.
-     */
-    public function __construct(Horde_Injector $injector)
-    {
-        $this->_injector = $injector;
-    }
-
-    /**
      * Return the IMP_Contents:: instance.
      *
      * @param IMP_Indices $indices  An indices object.
@@ -59,7 +42,7 @@ class IMP_Injector_Factory_Contents
      * @return IMP_Contents  The singleton contents instance.
      * @throws IMP_Exception
      */
-    public function getOb($indices)
+    public function create($indices)
     {
         $key = strval($indices);
 
index 0eff314..d2a9b2b 100644 (file)
@@ -194,7 +194,7 @@ class IMP_Mailbox_List implements Countable, Serializable
                           !in_array('\\seen', $v['flags'])))) {
                         if (empty($preview_info[$k])) {
                             try {
-                                $imp_contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $k));
+                                $imp_contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $k));
                                 $prev = $imp_contents->generatePreview();
                                 $preview_info[$k] = array('IMPpreview' => $prev['text'], 'IMPpreviewc' => $prev['cut']);
                                 if (!is_null($cache)) {
index 56e254c..f86d7e8 100644 (file)
@@ -339,7 +339,7 @@ class IMP_Message
 
         foreach ($indices as $folder => $index) {
             /* Fetch the message contents. */
-            $imp_contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($folder, $index));
+            $imp_contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($folder, $index));
 
             /* Fetch the message headers. */
             $imp_headers = $imp_contents->getHeaderOb();
@@ -494,7 +494,7 @@ class IMP_Message
 
         $uidvalidity = $imp_imap->checkUidvalidity($mbox);
 
-        $contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb($indices);
+        $contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create($indices);
         $message = $contents->getMIMEMessage();
         $boundary = trim($message->getContentTypeParameter('boundary'), '"');
 
index 1fb0106..245f617 100644 (file)
@@ -109,7 +109,7 @@ class IMP_Mime_Viewer_Partial extends Horde_Mime_Viewer_Base
             if ($val == $number) {
                 $parts[$number] = $this->_mimepart->getContents();
             } else {
-                $ic = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $val));
+                $ic = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $val));
                 $parts[$ic->getMIMEMessage()->getContentTypeParameter('number')] = $ic->getBody();
             }
         }
index b56f439..0436b37 100644 (file)
@@ -57,7 +57,7 @@ class IMP_Spam
                 /* Fetch the raw message contents (headers and complete
                  * body). */
                 try {
-                    $imp_contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $idx));
+                    $imp_contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $idx));
                 } catch (IMP_Exception $e) {
                     continue;
                 }
index af94651..3a7f7f6 100644 (file)
@@ -233,7 +233,7 @@ class IMP_Ui_Compose
 
         if (!is_null($indices)) {
             try {
-                $ob = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb($indices);
+                $ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create($indices);
             } catch (Horde_Exception $e) {}
         }
 
index 289ad70..41f8735 100644 (file)
@@ -127,7 +127,7 @@ class IMP_Views_ShowMessage
 
         /* Parse MIME info and create the body of the message. */
         try {
-            $imp_contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mailbox, $uid));
+            $imp_contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mailbox, $uid));
         } catch (IMP_Exception $e) {
             $result['error'] = $error_msg;
             $result['errortype'] = 'horde.error';
index 5774950..3be720e 100644 (file)
@@ -118,7 +118,7 @@ $use_pop = ($_SESSION['imp']['protocol'] == 'pop');
 
 /* Parse the message. */
 try {
-    $imp_contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($imp_mailbox));
+    $imp_contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($imp_mailbox));
 } catch (IMP_Exception $e) {
     IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name)->add('a', 'm')->redirect();
 }
index ffaaa26..a7086e2 100644 (file)
@@ -207,7 +207,7 @@ $uid = $index_array['uid'];
 
 /* Parse the message. */
 try {
-    $imp_contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($imp_mailbox));
+    $imp_contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($imp_mailbox));
 } catch (IMP_Exception $e) {
     $imp_mailbox->removeMsgs(true);
     _returnToMailbox(null, 'message_missing');
index f735d61..4cc7eb7 100644 (file)
@@ -158,7 +158,7 @@ case 'info_personal_private_key':
 
 case 'save_attachment_public_key':
     /* Retrieve the key from the message. */
-    $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($vars->mailbox, $vars->uid));
+    $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($vars->mailbox, $vars->uid));
     $mime_part = $contents->getMIMEPart($vars->mime_id);
     if (empty($mime_part)) {
         throw new IMP_Exception('Cannot retrieve public key from message.');
index 9a20dac..1cb8cf5 100644 (file)
@@ -21,7 +21,7 @@ $vars = Horde_Variables::getDefaultVariables();
 /* Run through the action handlers. */
 switch ($vars->actionID) {
 case 'save_image':
-    $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($vars->mbox, $vars->uid));
+    $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($vars->mbox, $vars->uid));
     $mime_part = $contents->getMIMEPart($vars->id);
     $image_data = array(
         'data' => $mime_part->getContents(),
index 125e404..838b786 100644 (file)
@@ -102,7 +102,7 @@ case 'process_import_personal_certs':
 
 case 'save_attachment_public_key':
     /* Retrieve the key from the message. */
-    $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($vars->mailbox, $vars->uid));
+    $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($vars->mailbox, $vars->uid));
     $mime_part = $contents->getMIMEPart($vars->mime_id);
     if (empty($mime_part)) {
         throw new IMP_Exception('Cannot retrieve public key from message.');
index 6b0acb9..039d657 100644 (file)
@@ -94,7 +94,7 @@ foreach ($imp_indices->indices() as $mbox => $idxlist) {
 
         /* Get the body of the message. */
         $curr_msg = $curr_tree = array();
-        $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $idx));
+        $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $idx));
         $mime_id = $contents->findBody();
         if ($contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE)) {
             $ret = $contents->renderMIMEPart($mime_id, IMP_Contents::RENDER_INLINE);
index 51dcf48..32cf7e7 100644 (file)
@@ -68,7 +68,7 @@ if ($vars->actionID == 'compose_attach_preview') {
     if (!$vars->uid || !$vars->mailbox) {
         exit;
     }
-    $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($vars->mailbox, $vars->uid));
+    $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($vars->mailbox, $vars->uid));
 }
 
 /* Run through action handlers */