CRM-11958 - hook_civicrm_alterMailer - Cleanup comments/formatting
authorTim Otten <totten@civicrm.org>
Thu, 5 Sep 2013 19:20:36 +0000 (12:20 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 5 Sep 2013 19:24:07 +0000 (12:24 -0700)
----------------------------------------
* CRM-11958: New hook implementation for altering outgoing mail configuration
  http://issues.civicrm.org/jira/browse/CRM-11958

CRM/Core/Config.php
CRM/Utils/Hook.php
tests/phpunit/CRM/Core/Config/MailerTest.php

index 94dbefce4e4fb869f9f9e2eca7c995ec6f7d744c..c7a82abac055ed94f3fdd00827308d10c6155006 100644 (file)
@@ -503,12 +503,10 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
   }
 
   /**
-   * retrieve a mailer to send any mail from the applciation
+   * Retrieve a mailer to send any mail from the applciation
    *
    * @param boolean $persist open a persistent smtp connection, should speed up mailings
-   *
    * @access private
-   *
    * @return object
    */
   static function &getMailer($persist = FALSE) {
@@ -574,7 +572,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
         CRM_Core_Error::debug_log_message(ts('Outbound mail has been disabled. Click <a href=\'%1\'>Administer >> System Setting >> Outbound Email</a> to set the OutBound Email.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1'))));
         CRM_Core_Session::setStatus(ts('Outbound mail has been disabled. Click <a href=\'%1\'>Administer >> System Setting >> Outbound Email</a> to set the OutBound Email.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1'))));
       }
-      else{
+      else {
         CRM_Core_Error::debug_log_message(ts('There is no valid SMTP server Setting Or SendMail path setting. Click <a href=\'%1\'>Administer >> System Setting >> Outbound Email</a> to set the OutBound Email.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1'))));
         CRM_Core_Session::setStatus(ts('There is no valid SMTP server Setting Or sendMail path setting. Click <a href=\'%1\'>Administer >> System Setting >> Outbound Email</a> to set the OutBound Email.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1'))));
         CRM_Core_Error::debug_var('mailing_info', $mailingInfo);
@@ -584,14 +582,17 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
   }
 
   /**
+   * Create a new instance of a PEAR Mail driver
+   *
    * @param string $driver 'CRM_Mailing_BAO_Spool' or a name suitable for Mail::factory()
    * @param array $params
-   * @return Mail|NULL
+   * @return Mail (More specifically, a class which implements the "send()" function)
    */
   public static function _createMailer($driver, $params) {
     if ($driver == 'CRM_Mailing_BAO_Spool') {
       $mailer = new CRM_Mailing_BAO_Spool($params);
-    } else {
+    }
+    else {
       $mailer = Mail::factory($driver, $params);
     }
     CRM_Utils_Hook::alterMail($mailer, $driver, $params);
index c216b8190f41bfc74be5a5eee5ebca9bb6403583..198664f0d7364596fad85050fb1f3a4ad2fa6918 100644 (file)
@@ -1361,7 +1361,8 @@ abstract class CRM_Utils_Hook {
    * @see Mail::factory
    */
   static function alterMail(&$mailer, $driver, $params) {
-    return self::singleton()->invoke(3, $mailer, $driver, $params, self::$_nullObject, self::$_nullObject, 'civicrm_alterMailer');
+    return self::singleton()
+      ->invoke(3, $mailer, $driver, $params, self::$_nullObject, self::$_nullObject, 'civicrm_alterMailer');
   }
 
   /**
index 7365c3af0d12c2ed5a6e4b6da77b1bdbbf11a1c7..d53cc6cd46b6dad57682e141aa9a4e638beafe83 100644 (file)
@@ -1,4 +1,37 @@
 <?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.4                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ * @package CiviCRM
+ * @copyright CiviCRM LLC (c) 2004-2013
+ * $Id: $
+ *
+ */
 
 require_once 'CiviTest/CiviUnitTestCase.php';