當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Swift::getPlugin方法代碼示例

本文整理匯總了PHP中Swift::getPlugin方法的典型用法代碼示例。如果您正苦於以下問題:PHP Swift::getPlugin方法的具體用法?PHP Swift::getPlugin怎麽用?PHP Swift::getPlugin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Swift的用法示例。


在下文中一共展示了Swift::getPlugin方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testListenersCanBeRemovedOnceAdded

 public function testListenersCanBeRemovedOnceAdded()
 {
     $listener = new MockSendListener();
     $conn = $this->getWorkingMockConnection(1);
     $swift = new Swift($conn);
     $swift->attachPlugin($listener, "myplugin");
     $this->assertReference($listener, $swift->getPlugin("myplugin"));
     $swift->removePlugin("myplugin");
     $this->assertNull($swift->getPlugin("myplugin"));
 }
開發者ID:Esleelkartea,項目名稱:legedia-ESLE,代碼行數:10,代碼來源:TestOfPluginAPI.php

示例2: getPlugin

 /**
  * Get a reference to the plugin identified by $name
  * @param string the ID of the plugin
  * @return Swift_Events_Listener
  */
 public function getPlugin($name)
 {
     try {
         $plugin = $this->swift->getPlugin($name);
         return $plugin;
     } catch (Exception $e) {
         return null;
     }
 }
開發者ID:darkcolonist,項目名稱:kohana234-doctrine115,代碼行數:14,代碼來源:EasySwift.php

示例3: array


//.........這裏部分代碼省略.........
         Swift_ClassLoader::load('Swift_Connection_Multi');
         Swift_ClassLoader::load('Swift_Connection_SMTP');
         $pool = new Swift_Connection_Multi();
         // first choose method
         if ($fs->prefs['smtp_server']) {
             $split = explode(':', $fs->prefs['smtp_server']);
             $port = null;
             if (count($split) == 2) {
                 $fs->prefs['smtp_server'] = $split[0];
                 $port = $split[1];
             }
             // connection... SSL, TLS or none
             if ($fs->prefs['email_ssl']) {
                 $smtp = new Swift_Connection_SMTP($fs->prefs['smtp_server'], $port ? $port : SWIFT_SMTP_PORT_SECURE, SWIFT_SMTP_ENC_SSL);
             } else {
                 if ($fs->prefs['email_tls']) {
                     $smtp = new Swift_Connection_SMTP($fs->prefs['smtp_server'], $port ? $port : SWIFT_SMTP_PORT_SECURE, SWIFT_SMTP_ENC_TLS);
                 } else {
                     $smtp = new Swift_Connection_SMTP($fs->prefs['smtp_server'], $port);
                 }
             }
             if ($fs->prefs['smtp_user']) {
                 $smtp->setUsername($fs->prefs['smtp_user']);
                 $smtp->setPassword($fs->prefs['smtp_pass']);
             }
             if (defined('FS_SMTP_TIMEOUT')) {
                 $smtp->setTimeout(FS_SMTP_TIMEOUT);
             }
             $pool->addConnection($smtp);
         } else {
             Swift_ClassLoader::load('Swift_Connection_NativeMail');
             // a connection to localhost smtp server as fallback, discarded if there is no such thing available.
             $pool->addConnection(new Swift_Connection_SMTP());
             $pool->addConnection(new Swift_Connection_NativeMail());
         }
         $swift = new Swift($pool);
         if (isset($data['task_id'])) {
             $swift->attachPlugin(new NotificationsThread($data['task_id'], $emails, $db), 'MessageThread');
         }
         if (defined('FS_MAIL_DEBUG')) {
             $swift->log->enable();
             Swift_ClassLoader::load('Swift_Plugin_VerboseSending');
             $view = new Swift_Plugin_VerboseSending_DefaultView();
             $swift->attachPlugin(new Swift_Plugin_VerboseSending($view), "verbose");
         }
         $message = new Swift_Message($subject, $body);
         // check for reply-to
         if (isset($data['project']) && $data['project']->prefs['notify_reply']) {
             $message->setReplyTo($data['project']->prefs['notify_reply']);
         }
         if (isset($data['project']) && isset($data['project']->prefs['bounce_address'])) {
             $message->setReturnPath($data['project']->prefs['bounce_address']);
         }
         $message->headers->setCharset('utf-8');
         $message->headers->set('Precedence', 'list');
         $message->headers->set('X-Mailer', 'Flyspray');
         // Add custom headers, possibly
         if (isset($data['headers'])) {
             $headers = array_map('trim', explode("\n", $data['headers']));
             if ($headers = array_filter($headers)) {
                 foreach ($headers as $header) {
                     list($name, $value) = explode(':', $header);
                     $message->headers->set(sprintf('X-Flyspray-%s', $name), $value);
                 }
             }
         }
         $recipients = new Swift_RecipientList();
         $recipients->addTo($emails);
         // && $result purpose: if this has been set to false before, it should never become true again
         // to indicate an error
         $result = $swift->batchSend($message, $recipients, $fs->prefs['admin_email']) === count($emails) && $result;
         if (isset($data['task_id'])) {
             $plugin =& $swift->getPlugin('MessageThread');
             if (count($plugin->thread_info)) {
                 $stmt = $db->x->autoPrepare('{notification_threads}', array('task_id', 'recipient_id', 'message_id'));
                 $db->x->executeMultiple($stmt, $plugin->thread_info);
                 $stmt->free();
             }
         }
         $swift->disconnect();
     }
     if (count($jids)) {
         $jids = array_unique($jids);
         if (!$fs->prefs['jabber_username'] || !$fs->prefs['jabber_password']) {
             return $result;
         }
         // nothing that can't be guessed correctly ^^
         if (!$fs->prefs['jabber_port']) {
             $fs->prefs['jabber_port'] = 5222;
         }
         require_once 'class.jabber2.php';
         $jabber = new Jabber($fs->prefs['jabber_username'], $fs->prefs['jabber_password'], $fs->prefs['jabber_security'], $fs->prefs['jabber_port'], $fs->prefs['jabber_server']);
         $jabber->SetResource('flyspray');
         $jabber->login();
         foreach ($jids as $jid) {
             $result = $jabber->send_message($jid, $body, $subject, 'normal') && $result;
         }
     }
     return $result;
 }
開發者ID:negram,項目名稱:flyspray,代碼行數:101,代碼來源:class.notify.php

示例4:

 /**
  * Get a reference to the plugin identified by $name
  * @param string the ID of the plugin
  * @return Swift_Events_Listener
  */
 function &getPlugin($name)
 {
     $plugin =& $this->swift->getPlugin($name);
     return $plugin;
 }
開發者ID:jeffthestampede,項目名稱:excelsior,代碼行數:10,代碼來源:EasySwift.php

示例5: postConnect

 /**
  * Call the current connection's postConnect() method
  */
 public function postConnect(Swift $instance)
 {
     Swift_ClassLoader::load("Swift_Plugin_ConnectionRotator");
     if (!$instance->getPlugin("_ROTATOR")) {
         $instance->attachPlugin(new Swift_Plugin_ConnectionRotator(), "_ROTATOR");
     }
     $this->connections[$this->active]->postConnect($instance);
 }
開發者ID:AlexanderS,項目名稱:Part-DB,代碼行數:11,代碼來源:Rotator.php

示例6: testMailSendPluginIsLoadedWhenConnected

 public function testMailSendPluginIsLoadedWhenConnected()
 {
     $swift = new Swift(new Swift_Connection_NativeMail());
     $this->assertIsA($swift->getPlugin("_MAIL_SEND"), "Swift_Plugin_MailSend");
 }
開發者ID:Esleelkartea,項目名稱:legedia-ESLE,代碼行數:5,代碼來源:TestOfNativeMailConnection.php


注:本文中的Swift::getPlugin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。