From 35f7561f9aab01bf11d3c21f90474f977cf546fe Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 13:21:22 -0800 Subject: [PATCH 1/1] INFRA-132 - CRM/Mailing - phpcbf --- CRM/Mailing/BAO/Mailing.php | 91 +++++++++++----------- CRM/Mailing/BAO/MailingJob.php | 15 ++-- CRM/Mailing/BAO/Query.php | 3 +- CRM/Mailing/BAO/Spool.php | 2 +- CRM/Mailing/Event/BAO/Bounce.php | 2 +- CRM/Mailing/Event/BAO/Confirm.php | 3 +- CRM/Mailing/Event/BAO/Opened.php | 2 +- CRM/Mailing/Event/BAO/Resubscribe.php | 1 - CRM/Mailing/Event/BAO/Subscribe.php | 4 +- CRM/Mailing/Event/BAO/TrackableURLOpen.php | 1 - CRM/Mailing/Event/BAO/Unsubscribe.php | 4 +- CRM/Mailing/Form/Approve.php | 5 +- CRM/Mailing/Form/Component.php | 3 +- CRM/Mailing/Form/Group.php | 11 +-- CRM/Mailing/Form/Schedule.php | 14 ++-- CRM/Mailing/Form/Settings.php | 11 +-- CRM/Mailing/Form/Subscribe.php | 1 - CRM/Mailing/Form/Task.php | 4 +- CRM/Mailing/Form/Test.php | 8 +- CRM/Mailing/Form/Upload.php | 12 ++- CRM/Mailing/Info.php | 17 ++-- CRM/Mailing/MailStore.php | 3 +- CRM/Mailing/MailStore/Localdir.php | 5 +- CRM/Mailing/Page/AJAX.php | 7 +- CRM/Mailing/Page/Browse.php | 9 +-- CRM/Mailing/Page/Common.php | 1 - CRM/Mailing/Page/Confirm.php | 2 +- CRM/Mailing/PseudoConstant.php | 18 +++-- CRM/Mailing/Selector/Browse.php | 3 +- CRM/Mailing/Selector/Search.php | 15 ++-- 30 files changed, 145 insertions(+), 132 deletions(-) diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index e453161ba1..df9f779966 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -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'], diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 4f98ac1e95..f12e031ccf 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -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); diff --git a/CRM/Mailing/BAO/Query.php b/CRM/Mailing/BAO/Query.php index e8cfc5bc12..064260c1d2 100644 --- a/CRM/Mailing/BAO/Query.php +++ b/CRM/Mailing/BAO/Query.php @@ -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 diff --git a/CRM/Mailing/BAO/Spool.php b/CRM/Mailing/BAO/Spool.php index 18907022d0..05b8a79e19 100644 --- a/CRM/Mailing/BAO/Spool.php +++ b/CRM/Mailing/BAO/Spool.php @@ -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"; diff --git a/CRM/Mailing/Event/BAO/Bounce.php b/CRM/Mailing/Event/BAO/Bounce.php index 1cc3dc27d1..754f49ed3f 100755 --- a/CRM/Mailing/Event/BAO/Bounce.php +++ b/CRM/Mailing/Event/BAO/Bounce.php @@ -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), diff --git a/CRM/Mailing/Event/BAO/Confirm.php b/CRM/Mailing/Event/BAO/Confirm.php index 608bb6c7f3..99479a200f 100644 --- a/CRM/Mailing/Event/BAO/Confirm.php +++ b/CRM/Mailing/Event/BAO/Confirm.php @@ -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\" ", 'toEmail' => $email, 'toName' => $display_name, diff --git a/CRM/Mailing/Event/BAO/Opened.php b/CRM/Mailing/Event/BAO/Opened.php index 6a8338253c..f0b53107d4 100755 --- a/CRM/Mailing/Event/BAO/Opened.php +++ b/CRM/Mailing/Event/BAO/Opened.php @@ -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(); diff --git a/CRM/Mailing/Event/BAO/Resubscribe.php b/CRM/Mailing/Event/BAO/Resubscribe.php index 06d6ca1f03..2954c98e2b 100644 --- a/CRM/Mailing/Event/BAO/Resubscribe.php +++ b/CRM/Mailing/Event/BAO/Resubscribe.php @@ -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(); diff --git a/CRM/Mailing/Event/BAO/Subscribe.php b/CRM/Mailing/Event/BAO/Subscribe.php index 3454fad672..7df9029bfc 100644 --- a/CRM/Mailing/Event/BAO/Subscribe.php +++ b/CRM/Mailing/Event/BAO/Subscribe.php @@ -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); diff --git a/CRM/Mailing/Event/BAO/TrackableURLOpen.php b/CRM/Mailing/Event/BAO/TrackableURLOpen.php index 9b6ee32869..8b1a0b2101 100755 --- a/CRM/Mailing/Event/BAO/TrackableURLOpen.php +++ b/CRM/Mailing/Event/BAO/TrackableURLOpen.php @@ -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(); diff --git a/CRM/Mailing/Event/BAO/Unsubscribe.php b/CRM/Mailing/Event/BAO/Unsubscribe.php index 8da76798ce..0cc94106d7 100755 --- a/CRM/Mailing/Event/BAO/Unsubscribe.php +++ b/CRM/Mailing/Event/BAO/Unsubscribe.php @@ -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(); diff --git a/CRM/Mailing/Form/Approve.php b/CRM/Mailing/Form/Approve.php index aeb1633d49..da4c76b49d 100644 --- a/CRM/Mailing/Form/Approve.php +++ b/CRM/Mailing/Form/Approve.php @@ -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' => '                 ', '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'); diff --git a/CRM/Mailing/Form/Component.php b/CRM/Mailing/Form/Component.php index bf1aa5a5e7..d2d3cae9aa 100644 --- a/CRM/Mailing/Form/Component.php +++ b/CRM/Mailing/Form/Component.php @@ -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[] = '
  • ' . ts('This message is having a invalid token - %1: %2', array( - 1 => $token, 2 => $desc)) . '
  • '; + 1 => $token, + 2 => $desc)) . ''; } } } diff --git a/CRM/Mailing/Form/Group.php b/CRM/Mailing/Form/Group.php index 8c15509dd9..cb381ab1bd 100644 --- a/CRM/Mailing/Form/Group.php +++ b/CRM/Mailing/Form/Group.php @@ -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' => '                 ', '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']); diff --git a/CRM/Mailing/Form/Schedule.php b/CRM/Mailing/Form/Schedule.php index 1abc69f586..996028525c 100644 --- a/CRM/Mailing/Form/Schedule.php +++ b/CRM/Mailing/Form/Schedule.php @@ -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' => '                 ', '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 diff --git a/CRM/Mailing/Form/Settings.php b/CRM/Mailing/Form/Settings.php index 9d7879290c..0d15ca5b47 100644 --- a/CRM/Mailing/Form/Settings.php +++ b/CRM/Mailing/Form/Settings.php @@ -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( diff --git a/CRM/Mailing/Form/Subscribe.php b/CRM/Mailing/Form/Subscribe.php index 6853b384c7..6f51a9556a 100644 --- a/CRM/Mailing/Form/Subscribe.php +++ b/CRM/Mailing/Form/Subscribe.php @@ -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'); diff --git a/CRM/Mailing/Form/Task.php b/CRM/Mailing/Form/Task.php index 8dd0360d3c..de298f6e8c 100644 --- a/CRM/Mailing/Form/Task.php +++ b/CRM/Mailing/Form/Task.php @@ -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 diff --git a/CRM/Mailing/Form/Test.php b/CRM/Mailing/Form/Test.php index 4370f960e4..da8146db10 100644 --- a/CRM/Mailing/Form/Test.php +++ b/CRM/Mailing/Form/Test.php @@ -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, )), diff --git a/CRM/Mailing/Form/Upload.php b/CRM/Mailing/Form/Upload.php index 44257e2ab8..9d0c91b1c6 100644 --- a/CRM/Mailing/Form/Upload.php +++ b/CRM/Mailing/Form/Upload.php @@ -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 diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index 962e832229..cf73eff420 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -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) { + } } diff --git a/CRM/Mailing/MailStore.php b/CRM/Mailing/MailStore.php index 559bc2ff8c..0b8e9226cb 100644 --- a/CRM/Mailing/MailStore.php +++ b/CRM/Mailing/MailStore.php @@ -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 diff --git a/CRM/Mailing/MailStore/Localdir.php b/CRM/Mailing/MailStore/Localdir.php index ef82e672f6..4aa8da061b 100644 --- a/CRM/Mailing/MailStore/Localdir.php +++ b/CRM/Mailing/MailStore/Localdir.php @@ -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) { diff --git a/CRM/Mailing/Page/AJAX.php b/CRM/Mailing/Page/AJAX.php index 13e78d4f58..f3d3487bbe 100644 --- a/CRM/Mailing/Page/AJAX.php +++ b/CRM/Mailing/Page/AJAX.php @@ -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'); diff --git a/CRM/Mailing/Page/Browse.php b/CRM/Mailing/Page/Browse.php index 45cb19973d..c2b8ce7aff 100644 --- a/CRM/Mailing/Page/Browse.php +++ b/CRM/Mailing/Page/Browse.php @@ -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 ) ) { diff --git a/CRM/Mailing/Page/Common.php b/CRM/Mailing/Page/Common.php index 1fd680c354..402e65f543 100644 --- a/CRM/Mailing/Page/Common.php +++ b/CRM/Mailing/Page/Common.php @@ -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) { diff --git a/CRM/Mailing/Page/Confirm.php b/CRM/Mailing/Page/Confirm.php index 1c59f3ba85..ad97c254f9 100644 --- a/CRM/Mailing/Page/Confirm.php +++ b/CRM/Mailing/Page/Confirm.php @@ -39,7 +39,7 @@ class CRM_Mailing_Page_Confirm extends CRM_Core_Page { */ public function run() { CRM_Utils_System::addHTMLHead(''); - + $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); diff --git a/CRM/Mailing/PseudoConstant.php b/CRM/Mailing/PseudoConstant.php index 40cf04595f..4b73291105 100644 --- a/CRM/Mailing/PseudoConstant.php +++ b/CRM/Mailing/PseudoConstant.php @@ -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; } } diff --git a/CRM/Mailing/Selector/Browse.php b/CRM/Mailing/Selector/Browse.php index 92b4705783..2ca4af7abc 100644 --- a/CRM/Mailing/Selector/Browse.php +++ b/CRM/Mailing/Selector/Browse.php @@ -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, ); diff --git a/CRM/Mailing/Selector/Search.php b/CRM/Mailing/Selector/Search.php index f073d6ae74..393149939a 100644 --- a/CRM/Mailing/Selector/Search.php +++ b/CRM/Mailing/Selector/Search.php @@ -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; -- 2.25.1