INFRA-132 - CRM/Mailing - phpcbf
authorTim Otten <totten@civicrm.org>
Tue, 6 Jan 2015 21:21:22 +0000 (13:21 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 6 Jan 2015 23:07:43 +0000 (15:07 -0800)
30 files changed:
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/BAO/MailingJob.php
CRM/Mailing/BAO/Query.php
CRM/Mailing/BAO/Spool.php
CRM/Mailing/Event/BAO/Bounce.php
CRM/Mailing/Event/BAO/Confirm.php
CRM/Mailing/Event/BAO/Opened.php
CRM/Mailing/Event/BAO/Resubscribe.php
CRM/Mailing/Event/BAO/Subscribe.php
CRM/Mailing/Event/BAO/TrackableURLOpen.php
CRM/Mailing/Event/BAO/Unsubscribe.php
CRM/Mailing/Form/Approve.php
CRM/Mailing/Form/Component.php
CRM/Mailing/Form/Group.php
CRM/Mailing/Form/Schedule.php
CRM/Mailing/Form/Settings.php
CRM/Mailing/Form/Subscribe.php
CRM/Mailing/Form/Task.php
CRM/Mailing/Form/Test.php
CRM/Mailing/Form/Upload.php
CRM/Mailing/Info.php
CRM/Mailing/MailStore.php
CRM/Mailing/MailStore/Localdir.php
CRM/Mailing/Page/AJAX.php
CRM/Mailing/Page/Browse.php
CRM/Mailing/Page/Common.php
CRM/Mailing/Page/Confirm.php
CRM/Mailing/PseudoConstant.php
CRM/Mailing/Selector/Browse.php
CRM/Mailing/Selector/Search.php

index e453161ba147f677d42448c646d2499fc50c4d90..df9f779966e962b9e31aae0f5920afa8b4565e1a 100644 (file)
@@ -161,37 +161,40 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
     // INSERT'ing INTO a table with a primary id so that last record
     // over writes any previous record.
     switch($email_selection_method) {
-    case 'location-exclude':
-      $location_filter = "($email.location_type_id != $location_type_id)";
-      // If there is more than one email that doesn't match the location,
-      // prefer the one marked is_bulkmail, followed by is_primary.
-      $order_by = "ORDER BY $email.is_bulkmail, $email.is_primary";
-      break;
-    case 'location-only':
-      $location_filter = "($email.location_type_id = $location_type_id)";
-      // If there is more than one email of the desired location, prefer
-      // the one marked is_bulkmail, followed by is_primary.
-      $order_by = "ORDER BY $email.is_bulkmail, $email.is_primary";
-      break;
-    case 'location-prefer':
-      $location_filter = "($email.is_bulkmail = 1 OR $email.is_primary = 1 OR $email.location_type_id = $location_type_id)";
-
-      // ORDER BY is more complicated because we have to set an arbitrary
-      // order that prefers the location that we want. We do that using
-      // the FIELD function. For more info, see:
-      // https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_field
-      // We assign the location type we want the value "1" by putting it
-      // in the first position after we name the field. All other location
-      // types are left out, so they will be assigned the value 0. That
-      // means, they will all be equally tied for first place, with our
-      // location being last.
-      $order_by = "ORDER BY FIELD($email.location_type_id, $location_type_id), $email.is_bulkmail, $email.is_primary";
-      break;
-    case 'automatic':
-      // fall through to default
-    default:
-      $location_filter = "($email.is_bulkmail = 1 OR $email.is_primary = 1)";
-      $order_by = "ORDER BY $email.is_bulkmail";
+      case 'location-exclude':
+        $location_filter = "($email.location_type_id != $location_type_id)";
+        // If there is more than one email that doesn't match the location,
+        // prefer the one marked is_bulkmail, followed by is_primary.
+        $order_by = "ORDER BY $email.is_bulkmail, $email.is_primary";
+        break;
+
+      case 'location-only':
+        $location_filter = "($email.location_type_id = $location_type_id)";
+        // If there is more than one email of the desired location, prefer
+        // the one marked is_bulkmail, followed by is_primary.
+        $order_by = "ORDER BY $email.is_bulkmail, $email.is_primary";
+        break;
+
+      case 'location-prefer':
+        $location_filter = "($email.is_bulkmail = 1 OR $email.is_primary = 1 OR $email.location_type_id = $location_type_id)";
+
+        // ORDER BY is more complicated because we have to set an arbitrary
+        // order that prefers the location that we want. We do that using
+        // the FIELD function. For more info, see:
+        // https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_field
+        // We assign the location type we want the value "1" by putting it
+        // in the first position after we name the field. All other location
+        // types are left out, so they will be assigned the value 0. That
+        // means, they will all be equally tied for first place, with our
+        // location being last.
+        $order_by = "ORDER BY FIELD($email.location_type_id, $location_type_id), $email.is_bulkmail, $email.is_primary";
+        break;
+
+      case 'automatic':
+        // fall through to default
+      default:
+        $location_filter = "($email.is_bulkmail = 1 OR $email.is_primary = 1)";
+        $order_by = "ORDER BY $email.is_bulkmail";
     }
 
     /* Create a temp table for contact exclusion */
@@ -654,9 +657,9 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    *  returns an array that denotes the type of token that we are dealing with
    *  we use the type later on when we are doing a token replcement lookup
    *
-   *  @param string $token       The token for which we will be doing adata lookup
+   * @param string $token       The token for which we will be doing adata lookup
    *
-   *  @return array $funcStruct  An array that holds the token itself and the type.
+   * @return array $funcStruct  An array that holds the token itself and the type.
    *                             the type will tell us which function to use for the data lookup
    *                             if we need to do a lookup at all
    */
@@ -888,7 +891,7 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    *  structures to represent the order in which tokens were found from left to right, top to bottom.
    *
    *
-   * @param str $prop
+   * @param string $propName of the property that holds the text that we want to scan for tokens (html, text).
    *   Name of the property that holds the text that we want to scan for tokens (html, text).
    *
    * @return void
@@ -918,8 +921,8 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    */
   public function getTestRecipients($testParams) {
     if (array_key_exists($testParams['test_group'], CRM_Core_PseudoConstant::group())) {
-      $contacts = civicrm_api('contact','get', array(
-        'version' =>3,
+      $contacts = civicrm_api('contact', 'get', array(
+        'version' => 3,
         'group' => $testParams['test_group'],
          'return' => 'id',
            'options' => array('limit' => 100000000000,
@@ -1734,7 +1737,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       $values[] = array('entity_id' => $entityId);
     }
     civicrm_api3('mailing_group', 'replace', array(
-      'mailing_id' =>  $mailingId,
+      'mailing_id' => $mailingId,
       'group_type' => $type,
       'entity_table' => ($entity == 'groups') ? CRM_Contact_BAO_Group::getTableName() : CRM_Mailing_BAO_Mailing::getTableName(),
       'values' => $values,
@@ -1790,7 +1793,6 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       'spool' => CRM_Mailing_BAO_Spool::getTableName(),
     );
 
-
     $report = array();
     $additionalWhereClause = " AND ";
     if (!$isSMS) {
@@ -2151,7 +2153,6 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       ),
     );
 
-
     $actionLinks = array(CRM_Core_Action::VIEW => array('name' => ts('Report')));
     if (CRM_Core_Permission::check('view all contacts')) {
       $actionLinks[CRM_Core_Action::ADVANCED] =
@@ -2569,7 +2570,8 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
       $form->addWysiwyg('html_message',
         ts('HTML Format'),
         array(
-          'cols' => '80', 'rows' => '8',
+          'cols' => '80',
+      'rows' => '8',
           'onkeyup' => "return verify(this)",
         )
       );
@@ -2592,7 +2594,8 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
       }
       $form->add('textarea', $id, $label,
         array(
-          'cols' => '80', 'rows' => '8',
+          'cols' => '80',
+      'rows' => '8',
           'onkeyup' => "return verify(this, '{$prefix}')",
         )
       );
@@ -2663,11 +2666,11 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
     );
     $form->add('text', 'saveTemplateName', ts('Template Title'));
 
-
     $form->addWysiwyg('html_message',
       ts('Your Letter'),
       array(
-        'cols' => '80', 'rows' => '8',
+        'cols' => '80',
+    'rows' => '8',
         'onkeyup' => "return verify(this)",
       )
     );
@@ -2979,7 +2982,7 @@ AND        m.id = %1
 
       $contactMailings[$mailingId]['links'] = CRM_Core_Action::formLink(
         $actionLinks,
-        null,
+        NULL,
         array(
           'mid' => $values['mailing_id'],
           'cid' => $params['contact_id'],
index 4f98ac1e95d7702f69d73b7047948ab40e358725..f12e031ccf3bda6ba17747efc07350dc7de26e50 100644 (file)
@@ -130,7 +130,6 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
       $job->query($query);
     }
 
-
     while ($job->fetch()) {
       // still use job level lock for each child job
       $lockName = "civimail.job.{$job->id}";
@@ -308,7 +307,6 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
     $currentTime = date('YmdHis');
     $mailingACL = CRM_Mailing_BAO_Mailing::mailingACL('m');
 
-
     $workflowClause = CRM_Mailing_BAO_MailingJob::workflowClause();
 
     $domainID = CRM_Core_Config::domainID();
@@ -336,10 +334,8 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
     ORDER BY j.scheduled_date,
          j.start_date";
 
-
     $job->query($query);
 
-
     // For each of the "Parent Jobs" we find, we split them into
     // X Number of child jobs
     while ($job->fetch()) {
@@ -394,7 +390,6 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
 
     $jobTable = CRM_Mailing_DAO_MailingJob::getTableName();
 
-
     $dao = new CRM_Core_DAO();
 
     $sql = "
@@ -402,7 +397,8 @@ INSERT INTO civicrm_mailing_job
 (`mailing_id`, `scheduled_date`, `status`, `job_type`, `parent_id`, `job_offset`, `job_limit`)
 VALUES (%1, %2, %3, %4, %5, %6, %7)
 ";
-    $params = array(1 => array($this->mailing_id, 'Integer'),
+    $params = array(
+    1 => array($this->mailing_id, 'Integer'),
       2 => array($this->scheduled_date, 'String'),
       3 => array('Scheduled', 'String'),
       4 => array('child', 'String'),
@@ -639,9 +635,9 @@ VALUES (%1, %2, %3, %4, %5, %6, %7)
      * CRM-15702: Sending bulk sms to contacts without e-mail addres fails.
      * Solution is to skip checking for on hold
      */
-    $skipOnHold = true; //do include a statement to check wether e-mail address is on hold
+    $skipOnHold = TRUE; //do include a statement to check wether e-mail address is on hold
     if ($mailing->sms_provider_id) {
-      $skipOnHold = false; //do not include a statement to check wether e-mail address is on hold
+      $skipOnHold = FALSE; //do not include a statement to check wether e-mail address is on hold
     }
 
     foreach ($fields as $key => $field) {
@@ -854,7 +850,8 @@ AND    is_test = 0
 AND    job_type = 'child'
 AND    status IN ( 'Scheduled', 'Running', 'Paused' )
 ";
-      $params = array(1 => array($job->id, 'Integer'),
+      $params = array(
+      1 => array($job->id, 'Integer'),
         2 => array(date('YmdHis'), 'Timestamp'),
       );
       CRM_Core_DAO::executeQuery($sql, $params);
index e8cfc5bc12d02ee0a32465b7f6d74b895760552b..064260c1d2108cb833802e8c60e8a4722ee1daca 100644 (file)
@@ -427,7 +427,8 @@ class CRM_Mailing_BAO_Query {
    * @param $row
    * @param int $id
    */
-  public static function searchAction(&$row, $id) {}
+  public static function searchAction(&$row, $id) {
+  }
 
   /**
    * @param $tables
index 18907022d05cfda80c0a26d12d3a9ef56378c4ed..05b8a79e191112023b1db38b5f58e77ede385b04 100644 (file)
@@ -64,7 +64,7 @@ class CRM_Mailing_BAO_Spool extends CRM_Mailing_DAO_Spool {
    *               containing a descriptive error message on
    *               failure.
    */
-  public function send($recipient, $headers, $body, $job_id = null) {
+  public function send($recipient, $headers, $body, $job_id = NULL) {
     $headerStr = array();
     foreach ($headers as $name => $value) {
       $headerStr[] = "$name: $value";
index 1cc3dc27d10ec0ca65ca1a6933c90fb1a3a1beda..754f49ed3f15514a867319e778f001602c352a7c 100755 (executable)
@@ -266,7 +266,7 @@ class CRM_Mailing_Event_BAO_Bounce extends CRM_Mailing_Event_DAO_Bounce {
         'email' => $dao->email,
         // FIXME: translate this
         'type' => (empty($dao->bounce_type)
-           ? ts('Unknown') : $dao->bounce_type
+      ? ts('Unknown') : $dao->bounce_type
         ),
         'reason' => $dao->reason,
         'date' => CRM_Utils_Date::customFormat($dao->date),
index 608bb6c7f372dec276a2ef22b056c3bf04fdac4a..99479a200f871b2b23e79bdf169abe852cfeaae0 100644 (file)
@@ -143,7 +143,8 @@ class CRM_Mailing_Event_BAO_Confirm extends CRM_Mailing_Event_DAO_Confirm {
     $text = CRM_Utils_Token::replaceWelcomeTokens($text, $group->title, FALSE);
 
     $mailParams = array(
-      'groupName' => 'Mailing Event ' . $component->component_type, 'subject' => $component->subject,
+      'groupName' => 'Mailing Event ' . $component->component_type,
+    'subject' => $component->subject,
       'from' => "\"$domainEmailName\" <do-not-reply@$emailDomain>",
       'toEmail' => $email,
       'toName' => $display_name,
index 6a8338253cdf529da9281bd450901a294a24e30d..f0b53107d4feea457355a74353fa38d35d2c1fc2 100755 (executable)
@@ -229,7 +229,7 @@ class CRM_Mailing_Event_BAO_Opened extends CRM_Mailing_Event_DAO_Opened {
    * @static
    */
   public static function &getRows($mailing_id, $job_id = NULL,
-    $is_distinct = FALSE, $offset = NULL, $rowCount = NULL, $sort = NULL, $contact_id= NULL
+    $is_distinct = FALSE, $offset = NULL, $rowCount = NULL, $sort = NULL, $contact_id = NULL
   ) {
     $dao = new CRM_Core_Dao();
 
index 06d6ca1f038b02fee5482f924fb65043292f6305..2954c98e2bf71a86563ddd87e148b7129d99b0d1 100644 (file)
@@ -104,7 +104,6 @@ class CRM_Mailing_Event_BAO_Resubscribe {
     /* Make a list of groups and a list of prior mailings that received
          * this mailing */
 
-
     $groups = array();
     $mailings = array();
 
index 3454fad672391cdba9425136e08c44b2e6e5d0e3..7df9029bfc076bf21b7c01d1d8bf15b0da6a6e57 100644 (file)
@@ -137,7 +137,6 @@ LEFT JOIN civicrm_email      ON contact_a.id = civicrm_email.contact_id
       return $success;
     }
 
-
     /* Get the primary email id from the contact to use as a hash input */
 
     $dao = new CRM_Core_DAO();
@@ -147,7 +146,8 @@ SELECT     civicrm_email.id as email_id
   FROM     civicrm_email
      WHERE civicrm_email.email = %1
        AND civicrm_email.contact_id = %2";
-    $params = array(1 => array($email, 'String'),
+    $params = array(
+    1 => array($email, 'String'),
       2 => array($contact_id, 'Integer'),
     );
     $dao = CRM_Core_DAO::executeQuery($query, $params);
index 9b6ee328690858e6c879d111851cf6374f6a8093..8b1a0b21013cd73d1e13d085777c724de2edd512 100755 (executable)
@@ -60,7 +60,6 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
     /* To find the url, we also join on the queue and job tables.  This
          * prevents foreign key violations. */
 
-
     $job  = CRM_Mailing_BAO_MailingJob::getTableName();
     $eq   = CRM_Mailing_Event_BAO_Queue::getTableName();
     $turl = CRM_Mailing_BAO_TrackableURL::getTableName();
index 8da76798ce88e06693efed84edf2192f0230374a..0cc94106d700012990163246e9cf8bf54738bc97 100755 (executable)
@@ -79,7 +79,8 @@ SET    on_hold = 2,
        hold_date = %1
 WHERE  email = %2
 ";
-        $sqlParams = array(1 => array($now, 'Timestamp'),
+        $sqlParams = array(
+        1 => array($now, 'Timestamp'),
           2 => array($email->email, 'String'),
         );
         CRM_Core_DAO::executeQuery($sql, $sqlParams);
@@ -175,7 +176,6 @@ WHERE  email = %2
     /* Make a list of groups and a list of prior mailings that received
          * this mailing */
 
-
     $groups = array();
     $base_groups = array();
     $mailings = array();
index aeb1633d4963462b98dc9bd4b54b8b42efe62076..da4c76b49db3deffd56bfaaf25020743ff27bba3 100644 (file)
@@ -58,7 +58,6 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form {
       $this->redirectToListing();
     }
 
-
     // when user come from search context.
     $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
 
@@ -123,7 +122,8 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form {
     $this->addRadio('approval_status_id', ts('Approval Status'), $mailApprovalStatus, TRUE, NULL, TRUE);
 
     $buttons = array(
-      array('type' => 'next',
+      array(
+    'type' => 'next',
         'name' => ts('Save'),
         'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
         'isDefault' => TRUE,
@@ -208,7 +208,6 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form {
 
     CRM_Mailing_BAO_Mailing::create($params, $ids);
 
-
     //when user perform mailing from search context
     //redirect it to search result CRM-3711
     $ssID = $this->get('ssID');
index bf1aa5a5e7eff2806acf9b784890bffc597102b0..d2d3cae9aa160e56c89b0f4543089b83484d533b 100644 (file)
@@ -173,7 +173,8 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form {
         if ($params['body_' . $type]) {
           if (preg_match('/' . preg_quote('{' . $token . '}') . '/', $params['body_' . $type])) {
             $dataErrors[] = '<li>' . ts('This message is having a invalid token - %1: %2', array(
-              1 => $token, 2 => $desc)) . '</li>';
+              1 => $token,
+            2 => $desc)) . '</li>';
           }
         }
       }
index 8c15509dd9aae722af5c44c1e9904bb2a18fe704..cb381ab1bd453ac62a2aa5f1757b366f63423678 100644 (file)
@@ -127,8 +127,8 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
       $dao = new CRM_Mailing_DAO_MailingGroup();
 
       $mailingGroups = array(
-        'civicrm_group' => array( ),
-        'civicrm_mailing' => array( )
+        'civicrm_group' => array(),
+        'civicrm_mailing' => array()
       );
       $dao->mailing_id = $this->_mailingID;
       $dao->find();
@@ -283,7 +283,8 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
     $this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
 
     $buttons = array(
-      array('type' => 'next',
+      array(
+    'type' => 'next',
         'name' => ts('Next >>'),
         'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
         'isDefault' => TRUE,
@@ -352,7 +353,8 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
       else {
         //get the hidden smart group id.
         $ssId = $this->get('ssID');
-        $hiddenSmartParams = array('group_type' => array('2' => 1),
+        $hiddenSmartParams = array(
+        'group_type' => array('2' => 1),
           'form_values' => $this->get('formValues'),
           'saved_search_id' => $ssId,
           'search_custom_id' => $this->get('customSearchID'),
@@ -385,7 +387,6 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
       }
     }
 
-
     $qf_Group_submit = $this->controller->exportValue($this->_name, '_qf_Group_submit');
     $this->set('name', $params['name']);
 
index 1abc69f586541b3d74d744a765e5982a29584d1d..996028525caf6403550a0f6a999f1f8363147849 100644 (file)
@@ -53,7 +53,7 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form {
 
     //when user come from search context.
     $ssID = $this->get('ssID');
-    $this->assign('ssid',$ssID);
+    $this->assign('ssid', $ssID);
     $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
     if(CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){
       $params = array();
@@ -81,7 +81,7 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form {
     else {
       $count = $this->get('count');
     }
-     $this->assign('count', $count);
+    $this->assign('count', $count);
     $defaults['now'] = 1;
     return $defaults;
   }
@@ -107,7 +107,8 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form {
       );
       CRM_Utils_System::setTitle($title);
       $buttons = array(
-        array('type' => 'next',
+        array(
+      'type' => 'next',
           'name' => ts('Submit Mailing'),
           'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
           'isDefault' => TRUE,
@@ -123,7 +124,8 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form {
       //search base mailing, we should handle it when we fix CRM-3876
       if ($this->_searchBasedMailing) {
         $buttons = array(
-          array('type' => 'back',
+          array(
+        'type' => 'back',
             'name' => ts('<< Previous'),
           ),
           array(
@@ -136,7 +138,8 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form {
       }
       else {
         $buttons = array(
-          array('type' => 'back',
+          array(
+        'type' => 'back',
             'name' => ts('<< Previous'),
           ),
           array(
@@ -273,7 +276,6 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form {
       $params[$parameter] = $this->controller->exportValue($this->_name, $parameter);
     }
 
-
     // Previously, we checked if $mailing->is_template, and did *not*
     // schedule if it was set. Discussed with Lobo, removed that check
     // as it appeared to prevent mails being scheduled if they were
index 9d7879290cfb98b7ae2cb3328d9c4ea7182d5cdd..0d15ca5b47ce17c767a6b214be894999c283446d 100644 (file)
@@ -46,12 +46,12 @@ class CRM_Mailing_Form_Settings extends CRM_Core_Form {
   public function preProcess() {
     //when user come from search context.
     $ssID = $this->get('ssID');
-    $this->assign('ssid',$ssID);
+    $this->assign('ssid', $ssID);
     $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
     if(CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){
-    $params = array();
-    $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
-    $this->assign("value", $result);
+      $params = array();
+      $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
+      $this->assign("value", $result);
     }
   }
 
@@ -142,7 +142,8 @@ class CRM_Mailing_Form_Settings extends CRM_Core_Form {
     );
 
     $buttons = array(
-      array('type' => 'back',
+      array(
+    'type' => 'back',
         'name' => ts('<< Previous'),
       ),
       array(
index 6853b384c74263eb7b8003123bf8df965ffe99f8..6f51a9556a90ec4c04d5bc630dfee3089f40ce2d 100644 (file)
@@ -48,7 +48,6 @@ class CRM_Mailing_Form_Subscribe extends CRM_Core_Form {
       $this->controller->setDestination(NULL, TRUE);
     }
 
-
     if ($this->_groupID) {
       $groupTypeCondition = CRM_Contact_BAO_Group::groupTypeCondition('Mailing');
 
index 8dd0360d3c956397d453add9845a9b91b616438a..de298f6e8c9fb545f55bd873e17808470d78902d 100644 (file)
@@ -93,7 +93,7 @@ class CRM_Mailing_Form_Task extends CRM_Core_Form {
     }
     else {
       $queryParams = $form->get('queryParams');
-      $sortOrder = null;
+      $sortOrder = NULL;
       if ( $form->get( CRM_Utils_Sort::SORT_ORDER  ) ) {
         $sortOrder = $form->get( CRM_Utils_Sort::SORT_ORDER );
       }
@@ -110,7 +110,7 @@ class CRM_Mailing_Form_Task extends CRM_Core_Form {
     }
 
     if (!empty($ids)) {
-      $form->_componentClause =  ' civicrm_mailing_recipients.id IN ( ' . implode(',', $ids) . ' ) ';
+      $form->_componentClause = ' civicrm_mailing_recipients.id IN ( ' . implode(',', $ids) . ' ) ';
     }
 
     //set the context for redirection for any task actions
index 4370f960e4e0f33fa7c9043a1e188cb1cf034ca8..da8146db103df852f7f90913741b5ceeb9b61634 100644 (file)
@@ -46,7 +46,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form {
   public function preProcess() {
     //when user come from search context.
     $ssID = $this->get('ssID');
-    $this->assign('ssid',$ssID);
+    $this->assign('ssid', $ssID);
     $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
     if(CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){
       $params = array();
@@ -90,7 +90,8 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form {
     }
 
     $buttons = array(
-      array('type' => 'back',
+      array(
+    'type' => 'back',
         'name' => ts('<< Previous'),
       ),
       array(
@@ -319,7 +320,8 @@ ORDER BY   e.is_bulkmail DESC, e.is_primary DESC
           $params = array(
             'contact_type' => 'Individual',
             'email' => array(
-              1 => array('email' => $email,
+              1 => array(
+          'email' => $email,
                 'is_primary' => 1,
                 'location_type_id' => 1,
               )),
index 44257e2ab88cb128bf0a6025ca31a1bf15b1e577..9d0c91b1c6f979b1716b86081a39c076a075fdd8 100644 (file)
@@ -48,7 +48,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
 
     //when user come from search context.
     $ssID = $this->get('ssID');
-    $this->assign('ssid',$ssID);
+    $this->assign('ssid', $ssID);
     $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
     if(CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){
       $params = array();
@@ -295,7 +295,8 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
     $this->addFormRule(array('CRM_Mailing_Form_Upload', 'formRule'), $this);
 
     $buttons = array(
-      array('type' => 'back',
+      array(
+    'type' => 'back',
         'name' => ts('<< Previous'),
       ),
       array(
@@ -517,7 +518,6 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
     $errors = array();
     $template = CRM_Core_Smarty::singleton();
 
-
     if (isset($params['html_message'])) {
       $htmlMessage = str_replace(array("\n", "\r"), ' ', $params['html_message']);
       $htmlMessage = str_replace("'", "\'", $htmlMessage);
@@ -531,7 +531,8 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
     $mailing->find(TRUE);
 
     $session = CRM_Core_Session::singleton();
-    $values = array('contact_id' => $session->get('userID'),
+    $values = array(
+    'contact_id' => $session->get('userID'),
       'version' => 3,
     );
     require_once 'api/api.php';
@@ -550,7 +551,6 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
       $urls[$key]++;
     }
 
-
     // set $header and $footer
     foreach (array(
       'header', 'footer') as $part) {
@@ -569,7 +569,6 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
       }
     }
 
-
     $skipTextFile = $self->get('skipTextFile');
     $skipHtmlFile = $self->get('skipHtmlFile');
 
@@ -632,7 +631,6 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
       /* Do a full token replacement on a dummy verp, the current
              * contact and domain, and the first organization. */
 
-
       // here we make a dummy mailing object so that we
       // can retrieve the tokens that we need to replace
       // so that we do get an invalid token error
index 962e832229f385f7395dc95c63875301d83aedc9..cf73eff420240f1c71ea172468c0864d7d94333b 100644 (file)
@@ -77,7 +77,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
     $contactID = $session->get('userID');
     $civiMails = civicrm_api3('Mailing', 'get', array());
     $campNames = civicrm_api3('Campaign', 'get', array());
-    $mailingabNames = civicrm_api3('MailingAB','get',array());
+    $mailingabNames = civicrm_api3('MailingAB', 'get', array());
     $mailStatus = civicrm_api3('MailingJob', 'get', array());
     $groupNames = civicrm_api3('Group', 'get', array());
     $headerfooterList = civicrm_api3('MailingComponent', 'get', array());
@@ -88,7 +88,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
       $emailAdd = civicrm_api3('Email', 'get', array());
       $mesTemplate = civicrm_api3('MessageTemplate', 'get', array(
         'sequential' => 1,
-        'return' => array("msg_html", "id", "msg_title","msg_subject"),
+        'return' => array("msg_html", "id", "msg_title", "msg_subject"),
         'id' => array('>' => 58),
       ));
     } else {
@@ -98,12 +98,13 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
         'return' => "email",
         'contact_id' => $contactID,
       ));
-      $mesTemplate = civicrm_api3('MessageTemplate', 'get', array(  'sequential' => 1,
+      $mesTemplate = civicrm_api3('MessageTemplate', 'get', array(
+      'sequential' => 1,
         'return' => array("msg_html", "id", "msg_title", "msg_subject", "msg_text"),
         'workflow_id' => array('IS NULL' => ""),
       ));
     }
-    $mailGrp = civicrm_api3('MailingGroup','get', array());
+    $mailGrp = civicrm_api3('MailingGroup', 'get', array());
     $mailTokens = civicrm_api3('Mailing', 'get_token', array( 'usage' => 'Mailing'));
     $fromAddress = civicrm_api3('OptionGroup', 'get', array(
       'sequential' => 1,
@@ -112,7 +113,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
     ));
     CRM_Core_Resources::singleton()->addSetting(array(
       'crmMailing' => array(
-        'mailingabNames'=>array_values($mailingabNames['values']),
+        'mailingabNames' => array_values($mailingabNames['values']),
         'civiMails' => array_values($civiMails['values']),
         'campNames' => array_values($campNames['values']),
         'mailStatus' => array_values($mailStatus['values']),
@@ -223,7 +224,8 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
    * @return array
    */
   public function registerAdvancedSearchPane() {
-    return array('title' => ts('Mailings'),
+    return array(
+    'title' => ts('Mailings'),
       'weight' => 20,
     );
   }
@@ -240,5 +242,6 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
   /**
    * @param $shortCuts
    */
-  public function creatNewShortcut(&$shortCuts) {}
+  public function creatNewShortcut(&$shortCuts) {
+  }
 }
index 559bc2ff8c59a85d36fd687f7a853bb50366ad4a..0b8e9226cb82c935a3c5abdc29bed7268679fa61 100644 (file)
@@ -94,7 +94,8 @@ class CRM_Mailing_MailStore {
   /**
    * Expunge the messages marked for deletion; stub function to be redefined by IMAP store
    */
-  public function expunge() {}
+  public function expunge() {
+  }
 
   /**
    * Return the next X messages from the mail store
index ef82e672f6041e788f6fdf6a2652aad1b574f670..4aa8da061b4901b18a36eb0bcbef75843116654a 100644 (file)
@@ -80,8 +80,9 @@ class CRM_Mailing_MailStore_Localdir extends CRM_Mailing_MailStore {
       if ($entry->isDot()) {
         continue;
       }
-      if (count($mails) >= $count)
-      break;
+      if (count($mails) >= $count) {
+        break;
+      }
 
       $file = $path . DIRECTORY_SEPARATOR . $entry->getFilename();
       if ($this->_debug) {
index 13e78d4f5827637961aa630b9c80eff51836d9b5..f3d3487bbe3fbfa04f5a39a3c96ce099aecd7d20 100644 (file)
@@ -66,7 +66,12 @@ class CRM_Mailing_Page_AJAX {
     $contactID = CRM_Utils_Type::escape($_GET['contact_id'], 'Integer');
 
     $sortMapper = array(
-      0 => 'subject', 1 => 'creator_name', 2 => '', 3 => 'start_date', 4 => '', 5 => 'links',
+      0 => 'subject',
+    1 => 'creator_name',
+    2 => '',
+    3 => 'start_date',
+    4 => '',
+    5 => 'links',
     );
 
     $sEcho     = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
index 45cb19973d2f0bd98bcf8e306e2d855269adaf76..c2b8ce7affa61ec405a40e316285a7c6780a9d51 100644 (file)
@@ -135,11 +135,10 @@ class CRM_Mailing_Page_Browse extends CRM_Core_Page {
     $this->_sortByCharacter =
       CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
 
-
     // CRM-11920 all should set sortByCharacter to null, not empty string
     if (strtolower($this->_sortByCharacter) == 'all' || !empty($_POST)) {
-      $this->_sortByCharacter = null;
-      $this->set('sortByCharacter', null);
+      $this->_sortByCharacter = NULL;
+      $this->set('sortByCharacter', NULL);
     }
 
     if (CRM_Utils_Array::value(3, $newArgs) == 'unscheduled') {
@@ -232,7 +231,6 @@ class CRM_Mailing_Page_Browse extends CRM_Core_Page {
       CRM_Core_Selector_Controller::TEMPLATE
     );
 
-
     $controller->setEmbedded(TRUE);
     $controller->run();
 
@@ -288,8 +286,7 @@ class CRM_Mailing_Page_Browse extends CRM_Core_Page {
   }
 
   public function search() {
-    if ($this->_action &
-      (CRM_Core_Action::ADD |
+    if ($this->_action & (CRM_Core_Action::ADD |
         CRM_Core_Action::UPDATE
       )
     ) {
index 1fd680c354797f11faab95039e19674ae09917d9..402e65f543808f248d683e5bc144bdb542837b69 100644 (file)
@@ -51,7 +51,6 @@ class CRM_Mailing_Page_Common extends CRM_Core_Page {
       CRM_Core_Error::fatal(ts("Missing input parameters"));
     }
 
-
     // verify that the three numbers above match
     $q = CRM_Mailing_Event_BAO_Queue::verify($job_id, $queue_id, $hash);
     if (!$q) {
index 1c59f3ba8509c05dea2b1b38816f1cbb3a9f83e2..ad97c254f9d2259b589f6db0cc74c45b4488faa7 100644 (file)
@@ -39,7 +39,7 @@ class CRM_Mailing_Page_Confirm extends CRM_Core_Page {
    */
   public function run() {
     CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');
-    
+
     $contact_id   = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
     $subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer', CRM_Core_DAO::$_nullObject);
     $hash         = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
index 40cf04595fd19e0fabc065568cff28d5e9a629c5..4b732911055592298ea9ac4a337fe4128eb35056 100644 (file)
@@ -89,7 +89,6 @@ class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant {
         // we need to add an additional filter for $type
         self::$component[$name] = array();
 
-
         $object = new CRM_Mailing_DAO_Component();
         $object->component_type = $type;
         $object->selectAdd();
@@ -186,19 +185,24 @@ class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant {
     if (!$options) {
       $options = array(
         'bounce' => array(
-          'N' => ts('Successful '), 'Y' => ts('Bounced '),
+          'N' => ts('Successful '),
+      'Y' => ts('Bounced '),
         ),
         'delivered' => array(
-          'Y' => ts('Successful '), 'N' => ts('Bounced '),
+          'Y' => ts('Successful '),
+      'N' => ts('Bounced '),
         ),
         'open' => array(
-          'Y' => ts('Opened '), 'N' => ts('Unopened/Hidden '),
+          'Y' => ts('Opened '),
+      'N' => ts('Unopened/Hidden '),
         ),
         'click' => array(
-          'Y' => ts('Clicked '), 'N' => ts('Not Clicked '),
+          'Y' => ts('Clicked '),
+      'N' => ts('Not Clicked '),
         ),
         'reply' => array(
-          'Y' => ts('Replied '), 'N' => ts('No Reply '),
+          'Y' => ts('Replied '),
+      'N' => ts('No Reply '),
         ),
       );
     }
@@ -214,7 +218,7 @@ class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant {
    * @param bool|string $name pseudoconstant to be flushed
    */
   public static function flush($name = 'template') {
-   if (isset(self::$$name)) {
+    if (isset(self::$$name)) {
       self::$$name = NULL;
     }
   }
index 92b4705783385e0ed2530c9908179879876c0cfa..2ca4af7abc4b5d2f03e33bfc5af1d0144da04c45 100644 (file)
@@ -166,7 +166,8 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
       );
 
       if (CRM_Campaign_BAO_Campaign::isCampaignEnable()) {
-        self::$_columnHeaders[] = array('name' => ts('Campaign'),
+        self::$_columnHeaders[] = array(
+        'name' => ts('Campaign'),
           'sort' => 'campaign_id',
           'direction' => CRM_Utils_Sort::DONTCARE,
         );
index f073d6ae742eb729b8f8782dd34dc095c6f2bdbd..393149939aeee9927a359773bf616f01287a8c10 100644 (file)
@@ -194,11 +194,11 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_
    */
   public static function &links() {
     if (!(self::$_links)) {
-    list($context, $key) = func_get_args();
-    $extraParams = ($key) ? "&key={$key}" : NULL;
-    $searchContext = ($context) ? "&context=$context" : NULL;
+      list($context, $key) = func_get_args();
+      $extraParams = ($key) ? "&key={$key}" : NULL;
+      $searchContext = ($context) ? "&context=$context" : NULL;
 
-    self::$_links = array(
+      self::$_links = array(
       CRM_Core_Action::VIEW => array(
         'name' => ts('View'),
         'url' => 'civicrm/contact/view',
@@ -217,7 +217,7 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_
         'qs' => "reset=1&delete=1&cid=%%cid%%{$searchContext}{$extraParams}",
         'title' => ts('Delete Contact'),
       ),
-    );
+      );
     }
     return self::$_links;
   }
@@ -292,7 +292,7 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_
     $mask = CRM_Core_Action::mask($permissions);
     $qfKey = $this->_key;
 
-    While ($result->fetch()) {
+    while ($result->fetch()) {
       $row = array();
       // the columns we are interested in
       foreach (self::$_properties as $property) {
@@ -318,8 +318,7 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_
         'Contact',
         $result->contact_id
       );
-      $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ?
-        $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
+      $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
       );
 
       $rows[] = $row;