From: Michael M Slusarz Date: Mon, 4 Oct 2010 19:35:16 +0000 (-0600) Subject: Remove unneeded IMP_Contents binder X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1bb736257b203c2348525be5c8b0efdcb5e3e341;p=horde.git Remove unneeded IMP_Contents binder --- diff --git a/imp/lib/Ajax/Application.php b/imp/lib/Ajax/Application.php index a28e57942..2e756c36f 100644 --- a/imp/lib/Ajax/Application.php +++ b/imp/lib/Ajax/Application.php @@ -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; } diff --git a/imp/lib/Application.php b/imp/lib/Application.php index 65ffa5785..10c333d52 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -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(), diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index c2001c3a4..cffb59096 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -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; } diff --git a/imp/lib/Filter.php b/imp/lib/Filter.php index e3edecfa9..3d74d773f 100644 --- a/imp/lib/Filter.php +++ b/imp/lib/Filter.php @@ -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 index a2aeeb069..000000000 --- a/imp/lib/Injector/Binder/Contents.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @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; - } - -} diff --git a/imp/lib/Injector/Factory/Contents.php b/imp/lib/Injector/Factory/Contents.php index e29f688d3..5447df689 100644 --- a/imp/lib/Injector/Factory/Contents.php +++ b/imp/lib/Injector/Factory/Contents.php @@ -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); diff --git a/imp/lib/Mailbox/List.php b/imp/lib/Mailbox/List.php index 0eff31434..d2a9b2b4c 100644 --- a/imp/lib/Mailbox/List.php +++ b/imp/lib/Mailbox/List.php @@ -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)) { diff --git a/imp/lib/Message.php b/imp/lib/Message.php index 56e254c13..f86d7e8b3 100644 --- a/imp/lib/Message.php +++ b/imp/lib/Message.php @@ -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'), '"'); diff --git a/imp/lib/Mime/Viewer/Partial.php b/imp/lib/Mime/Viewer/Partial.php index 1fb010669..245f6170d 100644 --- a/imp/lib/Mime/Viewer/Partial.php +++ b/imp/lib/Mime/Viewer/Partial.php @@ -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(); } } diff --git a/imp/lib/Spam.php b/imp/lib/Spam.php index b56f4392c..0436b3749 100644 --- a/imp/lib/Spam.php +++ b/imp/lib/Spam.php @@ -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; } diff --git a/imp/lib/Ui/Compose.php b/imp/lib/Ui/Compose.php index af946510b..3a7f7f6ed 100644 --- a/imp/lib/Ui/Compose.php +++ b/imp/lib/Ui/Compose.php @@ -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) {} } diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index 289ad7064..41f873500 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -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'; diff --git a/imp/message-mimp.php b/imp/message-mimp.php index 577495058..3be720e1d 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -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(); } diff --git a/imp/message.php b/imp/message.php index ffaaa2688..a7086e20f 100644 --- a/imp/message.php +++ b/imp/message.php @@ -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'); diff --git a/imp/pgp.php b/imp/pgp.php index f735d6143..4cc7eb7e8 100644 --- a/imp/pgp.php +++ b/imp/pgp.php @@ -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.'); diff --git a/imp/saveimage.php b/imp/saveimage.php index 9a20dac69..1cb8cf566 100644 --- a/imp/saveimage.php +++ b/imp/saveimage.php @@ -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(), diff --git a/imp/smime.php b/imp/smime.php index 125e4049a..838b786bc 100644 --- a/imp/smime.php +++ b/imp/smime.php @@ -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.'); diff --git a/imp/thread.php b/imp/thread.php index 6b0acb909..039d657c4 100644 --- a/imp/thread.php +++ b/imp/thread.php @@ -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); diff --git a/imp/view.php b/imp/view.php index 51dcf482b..32cf7e7d5 100644 --- a/imp/view.php +++ b/imp/view.php @@ -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 */