INFRA-132 - Put space after flow-control (if/switch/for/foreach/while)
authorTim Otten <totten@civicrm.org>
Wed, 7 Jan 2015 03:44:33 +0000 (19:44 -0800)
committerTim Otten <totten@civicrm.org>
Wed, 7 Jan 2015 03:44:33 +0000 (19:44 -0800)
186 files changed:
CRM/Activity/BAO/Query.php
CRM/Activity/Form/Task.php
CRM/Activity/Form/Task/Batch.php
CRM/Activity/Page/AJAX.php
CRM/Admin/Form/PaymentProcessor.php
CRM/Admin/Form/Setting.php
CRM/Admin/Form/Setting/UpdateConfigBackend.php
CRM/Admin/Page/Access.php
CRM/Admin/Page/Extensions.php
CRM/Badge/BAO/Layout.php
CRM/Campaign/BAO/Query.php
CRM/Campaign/BAO/Survey.php
CRM/Case/Page/DashBoard.php
CRM/Contact/BAO/Group.php
CRM/Contact/BAO/Relationship.php
CRM/Contact/Form/CustomData.php
CRM/Contact/Form/Edit/Address.php
CRM/Contact/Form/Edit/CustomData.php
CRM/Contact/Form/ProfileContact.php
CRM/Contact/Form/Relationship.php
CRM/Contact/Form/Search/Advanced.php
CRM/Contact/Form/Search/Custom/ContributionAggregate.php
CRM/Contact/Form/Task/AlterPreferences.php
CRM/Contact/Form/Task/EmailCommon.php
CRM/Contact/Import/Form/MapField.php
CRM/Contact/Page/AJAX.php
CRM/Contact/Selector.php
CRM/Contribute/BAO/Contribution/Utils.php
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/BAO/ContributionSoft.php
CRM/Contribute/BAO/Query.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/ContributionPage/AddProduct.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Contribute/Form/ManagePremiums.php
CRM/Contribute/Form/Search.php
CRM/Contribute/Form/SearchContribution.php
CRM/Contribute/Form/Task/PDFLetter.php
CRM/Contribute/Form/Task/PDFLetterCommon.php
CRM/Contribute/Import/Form/MapField.php
CRM/Contribute/Import/Parser.php
CRM/Contribute/Import/Parser/Contribution.php
CRM/Contribute/Page/ManagePremiums.php
CRM/Contribute/Task.php
CRM/Core/BAO/ActionSchedule.php
CRM/Core/BAO/Address.php
CRM/Core/BAO/Block.php
CRM/Core/BAO/CustomValueTable.php
CRM/Core/BAO/Dashboard.php
CRM/Core/BAO/Email.php
CRM/Core/BAO/FinancialTrxn.php
CRM/Core/BAO/MailSettings.php
CRM/Core/BAO/Mapping.php
CRM/Core/BAO/OptionGroup.php
CRM/Core/BAO/OptionValue.php
CRM/Core/BAO/RecurringEntity.php
CRM/Core/BAO/SchemaHandler.php
CRM/Core/BAO/Setting.php
CRM/Core/BAO/UFField.php
CRM/Core/BAO/UFMatch.php
CRM/Core/BAO/WordReplacement.php
CRM/Core/CodeGen/Specification.php
CRM/Core/DAO.php
CRM/Core/Form.php
CRM/Core/Form/RecurringEntity.php
CRM/Core/Payment/AuthorizeNet.php
CRM/Core/Payment/AuthorizeNetIPN.php
CRM/Core/Payment/BaseIPN.php
CRM/Core/Payment/PayPalProIPN.php
CRM/Core/Permission.php
CRM/Core/Permission/Joomla.php
CRM/Core/PseudoConstant.php
CRM/Core/Region.php
CRM/Custom/Import/Parser/Api.php
CRM/Dedupe/BAO/QueryBuilder.php
CRM/Dedupe/Merger.php
CRM/Event/BAO/ParticipantPayment.php
CRM/Event/BAO/Query.php
CRM/Event/Form/EventFees.php
CRM/Event/Form/ManageEvent/Fee.php
CRM/Event/Form/ManageEvent/Registration.php
CRM/Event/Form/ManageEvent/Repeat.php
CRM/Event/Form/Participant.php
CRM/Event/Form/ParticipantFeeSelection.php
CRM/Event/Form/Registration/Confirm.php
CRM/Event/Form/Registration/Register.php
CRM/Event/Import/Parser/Participant.php
CRM/Event/Task.php
CRM/Extension/Downloader.php
CRM/Extension/System.php
CRM/Financial/BAO/ExportFormat/IIF.php
CRM/Financial/BAO/FinancialAccount.php
CRM/Financial/BAO/FinancialType.php
CRM/Financial/Form/Export.php
CRM/Financial/Page/FinancialType.php
CRM/Grant/BAO/Grant.php
CRM/Grant/BAO/Query.php
CRM/Group/Page/AJAX.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/BAO/TrackableURL.php
CRM/Mailing/Form/Group.php
CRM/Mailing/Form/Schedule.php
CRM/Mailing/Form/Settings.php
CRM/Mailing/Form/Test.php
CRM/Mailing/Form/Upload.php
CRM/Member/BAO/MembershipStatus.php
CRM/Member/BAO/Query.php
CRM/Member/Form/Membership.php
CRM/Member/Form/MembershipBlock.php
CRM/Member/Form/MembershipRenewal.php
CRM/Member/Form/Task/Label.php
CRM/Member/Import/Parser/Membership.php
CRM/Member/Page/DashBoard.php
CRM/Member/Task.php
CRM/PCP/BAO/PCP.php
CRM/Price/BAO/LineItem.php
CRM/Price/BAO/PriceField.php
CRM/Price/BAO/PriceFieldValue.php
CRM/Price/BAO/PriceSet.php
CRM/Report/Form/Contribute/Recur.php
CRM/Report/Utils/Report.php
CRM/UF/Form/Inline/Preview.php
CRM/Upgrade/Incremental/php/FourThree.php
CRM/Upgrade/Incremental/php/FourTwo.php
CRM/Utils/API/MatchOption.php
CRM/Utils/Array.php
CRM/Utils/Date.php
CRM/Utils/DeprecatedUtils.php
CRM/Utils/REST.php
CRM/Utils/System/Base.php
CRM/Utils/System/Drupal.php
CRM/Utils/System/Drupal6.php
CRM/Utils/System/DrupalBase.php
CRM/Utils/System/Joomla.php
CRM/Utils/System/WordPress.php
CRM/Utils/SystemLogger.php
CRM/Utils/Token.php
api/api.php
api/v3/Activity.php
api/v3/Constant.php
api/v3/Contact.php
api/v3/Contribution.php
api/v3/Domain.php
api/v3/EntityTag.php
api/v3/Event.php
api/v3/Generic.php
api/v3/Generic/Update.php
api/v3/Group.php
api/v3/MailingContact.php
api/v3/Membership.php
api/v3/MembershipStatus.php
api/v3/OptionValue.php
api/v3/Participant.php
api/v3/PledgePayment.php
api/v3/PriceFieldValue.php
api/v3/PriceSet.php
api/v3/Profile.php
api/v3/Relationship.php
api/v3/ReportTemplate.php
api/v3/Setting.php
api/v3/System.php
api/v3/utils.php
bin/cli.class.php
install/index.php
tests/phpunit/CRM/Batch/Form/EntryTest.php
tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php
tests/phpunit/CRM/Group/Page/AjaxTest.php
tests/phpunit/Utils.php
tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php
tests/phpunit/WebTest/Contact/MergeContactsTest.php
tests/phpunit/WebTest/Contribute/ContactContextAddTest.php
tests/phpunit/WebTest/Contribute/StandaloneAddTest.php
tests/phpunit/WebTest/Event/AddParticipationTest.php
tests/phpunit/WebTest/Financial/FinancialAccountTest.php
tests/phpunit/WebTest/Import/AddressImportTest.php
tests/phpunit/WebTest/Mailing/MailingTest.php
tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php
tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php
tests/phpunit/WebTest/Member/StandaloneAddTest.php
tests/phpunit/WebTest/Profile/ProfileCountryState.php
tests/phpunit/api/v3/APIStandardsTest.php
tests/phpunit/api/v3/EventTest.php
tests/phpunit/api/v3/JobProcessMailingTest.php
tests/phpunit/api/v3/ProfileTest.php
tests/phpunit/api/v3/ReportTemplateTest.php
tests/phpunit/api/v3/SyntaxConformanceTest.php

index e5ff26e68f0125ce9c0f9f41c458e5d391d992fe..6276199b6a843cf5c8c5ada86defd0788460b378 100644 (file)
@@ -357,9 +357,9 @@ class CRM_Activity_BAO_Query {
         CRM_Campaign_BAO_Query::componentSearchClause($campParams, $query);
         break;
       case 'activity_result':
-        if(is_array($value)) {
+        if (is_array($value)) {
           $safe = NULL;
-          while(list(,$k) = each($value)) {
+          while (list(,$k) = each($value)) {
             $safe[] = "'" . CRM_Utils_Type::escape($k, 'String') . "'";
           }
           $query->_where[$grouping][] = "civicrm_activity.result IN (" . implode(',', $safe) . ")";
@@ -551,7 +551,7 @@ class CRM_Activity_BAO_Query {
           $value = array();
           $value = CRM_Core_OptionGroup::values($name);
           if (!empty($value)) {
-            while(list($k,$v) = each($value)) {
+            while (list($k,$v) = each($value)) {
               $resultOptions[$v] = $v;
             }
           }
@@ -559,7 +559,7 @@ class CRM_Activity_BAO_Query {
       }
       // If no survey result options have been created, don't build
       // the field to avoid clutter.
-      if(count($resultOptions) > 0) {
+      if (count($resultOptions) > 0) {
         $buildSurveyResult = TRUE;
         asort($resultOptions);
         $form->add('select', 'activity_result', ts("Survey Result"),
index cc3efb0e7f91a14d94815605ab459e72c7c6595e..f748a9bf40ac0578c076184f152192d00049d003 100644 (file)
@@ -116,7 +116,7 @@ class CRM_Activity_Form_Task extends CRM_Core_Form {
       $result = $query->searchQuery(0, 0, NULL);
 
       while ($result->fetch()) {
-        if(!empty($result->activity_id)) {
+        if (!empty($result->activity_id)) {
           $ids[] = $result->activity_id;
         }
       }
index 0a3f41f1cbda7f2fb2bbc8b32a0586b4acfd30cb..1f8c6278eb461c0a2162072e50ffc90a699c8f4f 100755 (executable)
@@ -83,10 +83,10 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task {
       'Activity', $returnProperties
     );
     $readOnlyFields['assignee_display_name'] = ts('Assigned to');
-    if(!empty($contactDetails)) {
-      foreach($contactDetails as $key => $value){
+    if (!empty($contactDetails)) {
+      foreach ($contactDetails as $key => $value){
         $assignee = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId($key);
-        foreach($assignee as $keys => $values) {
+        foreach ($assignee as $keys => $values) {
           $assigneeContact[] = CRM_Contact_BAO_Contact::displayname($values);
         }
         $contactDetails[$key]['assignee_display_name'] = !empty($assigneeContact) ? implode(';', $assigneeContact) : NULL;
index 28d2a41f2509d598732830f99128e0d09effe1cc..0720178e598f1702485e802c8ce990a33ad850d0 100644 (file)
@@ -161,7 +161,7 @@ class CRM_Activity_Page_AJAX {
     $clientRelationships = array_slice($allClientRelationships, $offset, $rowCount, TRUE);
 
     // after sort we can update username fields to be a url
-    foreach($clientRelationships as $key => $value) {
+    foreach ($clientRelationships as $key => $value) {
       $clientRelationships[$key]['name'] = '<a href='.CRM_Utils_System::url('civicrm/contact/view',
        'action=view&reset=1&cid='.$clientRelationships[$key]['cid']).'>'.$clientRelationships[$key]['name'].'</a>';
     }
@@ -225,7 +225,7 @@ class CRM_Activity_Page_AJAX {
     // move/transform caseRoles array data to caseRelationships
     // for sorting and display
     // CRM-14466 added cid to the non-client array to avoid php notice
-    foreach($caseRoles as $id => $value) {
+    foreach ($caseRoles as $id => $value) {
       if ($id != "client") {
         $rel = array();
         $rel['relation'] = $value;
@@ -237,7 +237,7 @@ class CRM_Activity_Page_AJAX {
         $caseRelationships[] = $rel;
       }
       else {
-        foreach($value as $clientRole) {
+        foreach ($value as $clientRole) {
           $relClient = array();
           $relClient['relation'] = 'Client';
           $relClient['name'] = $clientRole['sort_name'];
@@ -282,7 +282,7 @@ class CRM_Activity_Page_AJAX {
       if ($hasAccessToAllCases) {
         $contactType = empty($row['relation_type']) ? '' : (string) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $row['relation_type'], 'contact_type_b');
         $contactType = $contactType == 'Contact' ? '' : $contactType;
-        switch($row['source']) {
+        switch ($row['source']) {
           case 'caseRel':
             $row['actions'] =
             '<a href="#editCaseRoleDialog" title="'. ts('Reassign %1', array(1 => $typeLabel)) .'" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="'. $row['relation_type'] .'" data-rel_id="'. $row['rel_id'] .'"data-key="'. CRM_Core_Key::get('civicrm/ajax/relation') .'">'.
index 5f44eca512cfe6651b669ed531195da7849bb73f..90ab5b80e8329d7aae792d281cbf1222a4e6d72b 100644 (file)
@@ -47,7 +47,7 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form {
   protected $_ppDAO;
 
   public function preProcess() {
-    if(!CRM_Core_Permission::check('administer payment processors')) {
+    if (!CRM_Core_Permission::check('administer payment processors')) {
       CRM_Core_Error::statusBounce('The \'administer payment processors\' permission is required to add or edit a payment processor.');
     }
     parent::preProcess();
index 14455159a74f9c2142aac2f721a4916328e93a35..fdbf570755747cfeb491d3452d2a33561eb221ec 100644 (file)
@@ -138,9 +138,9 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
     foreach ($this->_settings as $setting => $group){
       $settingMetaData = civicrm_api('setting', 'getfields', array('version' => 3, 'name' => $setting));
       $props = $settingMetaData['values'][$setting];
-      if(isset($props['quick_form_type'])){
+      if (isset($props['quick_form_type'])){
         $add = 'add' . $props['quick_form_type'];
-        if($add == 'addElement'){
+        if ($add == 'addElement'){
           $this->$add(
             $props['html_type'],
             $setting,
@@ -153,11 +153,11 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
           $this->$add($setting, ts($props['title']));
         }
         $this->assign("{$setting}_description", ts($props['description']));
-        if($setting == 'max_attachments'){
+        if ($setting == 'max_attachments'){
           //temp hack @todo fix to get from metadata
           $this->addRule('max_attachments', ts('Value should be a positive number'), 'positiveInteger');
         }
-        if($setting == 'maxFileSize'){
+        if ($setting == 'maxFileSize'){
           //temp hack
           $this->addRule('maxFileSize', ts('Value should be a positive number'), 'positiveInteger');
         }
index ad18055e9ee5000850e6a3dda87270fb0d08ead0..d9eaea95c174680cbc18b0cbb4ba9e6c30132a66 100644 (file)
@@ -99,7 +99,7 @@ class CRM_Admin_Form_Setting_UpdateConfigBackend extends CRM_Admin_Form_Setting
     $tmpDir = trim($fields['newBaseDir']);
 
     $errors = array();
-    if (!is_writeable($tmpDir)) {
+    if (!is_writable($tmpDir)) {
       $errors['newBaseDir'] = ts('%1 directory does not exist or cannot be written by webserver',
         array(1 => $tmpDir)
       );
index b6a3dd5720ba5a1a13f05794a748c272000530e2..dfee8dff41ad0b94607f075afb6449b84bdce4fd 100644 (file)
@@ -55,7 +55,7 @@ class CRM_Admin_Page_Access extends CRM_Core_Page {
 
       case 'Joomla':
         //condition based on Joomla version; <= 2.5 uses modal window; >= 3.0 uses full page with return value
-        ifversion_compare(JVERSION, '3.0', 'lt') ) {
+        if (version_compare(JVERSION, '3.0', 'lt') ) {
           JHTML::_('behavior.modal');
           $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&tmpl=component';
           $jparams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"';
index 0dbb4a2b44a1cec8cded87d603f929f1d8a181ce..5109f9c73dad73d33ff0fad61301ead46d611608 100644 (file)
@@ -157,7 +157,7 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
     $localExtensionRows = array(); // array($pseudo_id => extended_CRM_Extension_Info)
     $keys = array_keys($manager->getStatuses());
     sort($keys);
-    foreach($keys as $key) {
+    foreach ($keys as $key) {
       try {
         $obj = $mapper->keyToInfo($key);
       }
index 2f9a8372a14eab2f456da2a10465a51b033c562d..1f6a867c6ad25f13372550e108d719d7eae9934c 100644 (file)
@@ -147,7 +147,7 @@ class CRM_Badge_BAO_Layout extends CRM_Core_DAO_PrintLabel {
     $printLabel->find();
 
     $labels = array();
-    while($printLabel->fetch()) {
+    while ($printLabel->fetch()) {
       $labels[$printLabel->id] = $printLabel->title;
     }
     return $labels;
index 7510457a59d05ab29eb33e665adcca3a8a0c255d..feae5e93af02f9bfa92d3de41dc481b9144f5270 100755 (executable)
@@ -90,7 +90,7 @@ class CRM_Campaign_BAO_Query {
     // CRM-14238 Only translate when we are in contact mode
     // Other modes need the untranslated data for export and other functions
     if (is_array($query->_select)  && $query->_mode == CRM_Contact_BAO_Query::MODE_CONTACTS) {
-      foreach($query->_select as $field => $queryString) {
+      foreach ($query->_select as $field => $queryString) {
         if (substr($field, -11) == 'campaign_id') {
           $query->_pseudoConstantsSelect[$field] = array(
             'pseudoField' => 'campaign_id',
index ad2fe8d3478bf05507078c0f3c37ae0cdb587e41..fc12cb4a12d0433cf9cfd0730e04cb4dfdfc65a4 100644 (file)
@@ -409,7 +409,7 @@ SELECT  survey.id    as id,
       return NULL;
     }
     $reportId = CRM_Campaign_BAO_Survey::getReportID($id);
-    if($reportId){
+    if ($reportId){
       CRM_Report_BAO_ReportInstance::del($reportId);
     }
     $dao = new CRM_Campaign_DAO_Survey();
@@ -552,7 +552,7 @@ INNER JOIN  civicrm_activity_contact activityAssignment
   ON ( activityAssignment.activity_id = activity.id AND activityAssignment.record_type_id = $assigneeID )
      WHERE  activity.source_record_id = %1
      AND  ( activity.is_deleted IS NULL OR activity.is_deleted = 0 ) ";
-    if(!empty($interviewerId)) {
+    if (!empty($interviewerId)) {
       $query .= "AND activityAssignment.contact_id = %2 ";
       $params[2] = array($interviewerId, 'Integer');
     }
index 9d9ac409aa7c39c77f079482908ebf3dfbaa7fa1..c0a18394850f30391d4c55d7fa3e0336b3236929 100644 (file)
@@ -90,8 +90,8 @@ class CRM_Case_Page_DashBoard extends CRM_Core_Page {
     $upcoming = CRM_Case_BAO_Case::getCases($allCases, $userID, 'upcoming');
     $recent   = CRM_Case_BAO_Case::getCases($allCases, $userID, 'recent');
 
-    foreach($upcoming as $key => $value) {
-      if(strtotime($value['case_scheduled_activity_date']) < time()) {
+    foreach ($upcoming as $key => $value) {
+      if (strtotime($value['case_scheduled_activity_date']) < time()) {
         $upcoming[$key]['activity_status'] = 'status-overdue';
       }
     }
index 8b27b05ac9eaac3fd51364b04cac0c9cb297f7c6..ab2bf906c1d0227964bb8232bb4d169aa5b06866 100644 (file)
@@ -396,7 +396,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
     // use metadata to translate the array to the appropriate DB type or altering the param in the api layer,
     // or at least altering the param in same section as 'group_type' rather than repeating here. However, further down
     // we need the $params one to be in it's original form & we are not sure what test coverage we have on that
-    if(isset($group->parents) && is_array($group->parents)) {
+    if (isset($group->parents) && is_array($group->parents)) {
       $group->parents = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
         array_keys($group->parents)
       ) . CRM_Core_DAO::VALUE_SEPARATOR;
@@ -753,7 +753,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
         if (empty($params['parent_id']) && !empty($value['parents'])) {
           $groupIds = explode(',', $value['parents']);
           $title = array();
-          foreach($groupIds as $gId) {
+          foreach ($groupIds as $gId) {
             $title[] = $allGroups[$gId];
           }
           $groupList[$id]['group_name'] .= '<div class="crm-row-parent-name"><em>'.ts('Child of').'</em>: ' . implode(', ', $title) . '</div>';
@@ -975,7 +975,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
         $where .= " AND status = 'Added'";
       }
       $dao = CRM_Core_DAO::executeQuery("SELECT group_id, COUNT(id) as `count` FROM $table WHERE $where GROUP BY group_id");
-      while($dao->fetch()) {
+      while ($dao->fetch()) {
         $values[$dao->group_id]['count'] = $dao->count;
       }
     }
index 19021ce59e03fa4a731c316eb8c52632d274187e..ebc7a081d584f7cd48b148b277840c3fa9c61516 100644 (file)
@@ -89,7 +89,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
     $relationshipId = CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params));
     //CRM-9015 - the hooks are called here & in add (since add doesn't call create)
     // but in future should be tidied per ticket
-    if(empty($relationshipId)){
+    if (empty($relationshipId)){
       $hook = 'create';
       $action = CRM_Core_Action::ADD;
     }
@@ -202,7 +202,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
       CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params));
 
     $hook = 'create';
-    if($relationshipId) {
+    if ($relationshipId) {
       $hook = 'edit';
     }
     //@todo hook are called from create and add - remove one
@@ -233,10 +233,10 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
     $dateFields = array('end_date', 'start_date');
 
     foreach (self::getdefaults() as $defaultField => $defaultValue){
-      if(isset($params[$defaultField])){
-        if(in_array($defaultField, $dateFields)){
+      if (isset($params[$defaultField])){
+        if (in_array($defaultField, $dateFields)){
           $relationship->$defaultField = CRM_Utils_Date::format(CRM_Utils_Array::value($defaultField, $params));
-          if(!$relationship->$defaultField){
+          if (!$relationship->$defaultField){
             $relationship->$defaultField = 'NULL';
           }
         }
@@ -767,7 +767,7 @@ WHERE  relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer');
 
     $dateFields = array('end_date', 'start_date');
     foreach ($dateFields as $dateField){
-      if(array_key_exists($dateField, $params)) {
+      if (array_key_exists($dateField, $params)) {
         if (empty($params[$dateField]) || $params[$dateField] == 'null'){
           //this is most likely coming from an api call & probably loaded
           // from the DB to deal with some of the
@@ -1005,11 +1005,11 @@ LEFT JOIN  civicrm_country ON (civicrm_address.country_id = civicrm_country.id)
 
     // CRM-6181
     $where .= ' AND civicrm_contact.is_deleted = 0';
-    if(!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) {
+    if (!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) {
       $where .= self::membershipTypeToRelationshipTypes($params, $direction);
     }
-    if(!empty($params['relationship_type_id'])) {
-      if(is_array($params['relationship_type_id'])) {
+    if (!empty($params['relationship_type_id'])) {
+      if (is_array($params['relationship_type_id'])) {
         $where .=  " AND " . CRM_Core_DAO::createSQLFilter('relationship_type_id', $params['relationship_type_id'], 'Integer');
       }
       else {
@@ -1712,11 +1712,11 @@ AND cc.sort_name LIKE '%$name%'";
   public static function membershipTypeToRelationshipTypes(&$params, $direction = NULL) {
     $membershipType = civicrm_api3('membership_type', 'getsingle', array('id' => $params['membership_type_id'], 'return' => 'relationship_type_id, relationship_direction'));
     $relationshipTypes = $membershipType['relationship_type_id'];
-    if(empty($relationshipTypes)) {
+    if (empty($relationshipTypes)) {
       return;
     }
     // if we don't have any contact data we can only filter on type
-    if(empty($params['contact_id']) && empty($params['contact_id_a']) && empty($params['contact_id_a'])) {
+    if (empty($params['contact_id']) && empty($params['contact_id_a']) && empty($params['contact_id_a'])) {
       $params['relationship_type_id'] = array('IN' => $relationshipTypes);
       return;
     }
@@ -1725,14 +1725,14 @@ AND cc.sort_name LIKE '%$name%'";
       // if we have contact_id_a OR contact_id_b we can make a call here
       // if we have contact??
       foreach ($relationshipDirections as $index => $mtdirection) {
-        if(isset($params['contact_id_a']) && $mtdirection == 'a_b'  || $direction == 'a_b') {
+        if (isset($params['contact_id_a']) && $mtdirection == 'a_b'  || $direction == 'a_b') {
           $types[] = $relationshipTypes[$index];
         }
-        if(isset($params['contact_id_b']) && $mtdirection == 'b_a'  || $direction == 'b_a') {
+        if (isset($params['contact_id_b']) && $mtdirection == 'b_a'  || $direction == 'b_a') {
           $types[] = $relationshipTypes[$index];
         }
       }
-      if(!empty($types)) {
+      if (!empty($types)) {
         $params['relationship_type_id'] = array('IN' => $types);
       }
       elseif(!empty($clauses)) {
index 022534ea151568443f4524745f970f583b3b65f8..d863505cb0a28d072aef3678db69bb15b812d758 100644 (file)
@@ -125,7 +125,7 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
       // this is due to some condition inside it which restricts it from saving in session
       // so doing this for multi record edit action
       $entityId = CRM_Utils_Request::retrieve('entityID', 'Positive', $this);
-      if(!empty($entityId)) {
+      if (!empty($entityId)) {
         $subType = CRM_Contact_BAO_Contact::getContactSubType($entityId, ',');
       }
       CRM_Custom_Form_CustomData::preProcess($this, NULL, $subType, NULL, NULL, $entityId);
index e79f564500f40887106d4031826062cfc123f361..cdfaeef9c731bda5eb2032917f7ca26af49a6390 100644 (file)
@@ -280,7 +280,7 @@ class CRM_Contact_Form_Edit_Address {
           // DETACH 'required' form rule error to
           // custom data only if address data not exists upon submission
           if (!empty($customDataRequiredFields)) {
-            foreach($customDataRequiredFields as $customElementName) {
+            foreach ($customDataRequiredFields as $customElementName) {
               $elementName = "address[$instance][$customElementName]";
               if ($self->getElementError($elementName)) {
                 // set element error to none
@@ -294,7 +294,7 @@ class CRM_Contact_Form_Edit_Address {
         // DETACH 'required' form rule error to
         // custom data only if address data not exists upon submission
         if (!empty($customDataRequiredFields) && !CRM_Core_BAO_Address::dataExists($addressValues)) {
-          foreach($customDataRequiredFields as $customElementName) {
+          foreach ($customDataRequiredFields as $customElementName) {
             $elementName = "address[$instance][$customElementName]";
             if ($self->getElementError($elementName)) {
               // set element error to none
index 282d4dc1e3304528249b1581aa38da0787077234..265958ba17beea0afbfeefaf249866e95e999313 100644 (file)
@@ -75,7 +75,7 @@ class CRM_Contact_Form_Edit_CustomData {
    * @static
    */
   public static function buildQuickForm(&$form) {
-    if(!empty($form->_submitValues)) {
+    if (!empty($form->_submitValues)) {
       if ($customValueCount = CRM_Utils_Array::value('hidden_custom_group_count', $form->_submitValues)) {
         if (is_array($customValueCount)) {
           if (array_key_exists(0, $customValueCount)) {
index 27533c439ed700244e439dd4f3a56f7be2adee1b..9344c55744d9e6db170e6083b6f57f36253232a9 100644 (file)
@@ -120,7 +120,7 @@ class CRM_Contact_Form_ProfileContact {
       $dedupeParams = CRM_Dedupe_Finder::formatParams($params['honor'], $profileContactType);
       $dedupeParams['check_permission'] = FALSE;
       $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $profileContactType);
-      if(count($ids)) {
+      if (count($ids)) {
         $honorId = CRM_Utils_Array::value(0, $ids);
       }
 
index 561f3d164b2d48ead193299c206df6d1967ada7b..2ec068edb5f587e7cd5a75381c851f08b2dc48a5 100644 (file)
@@ -326,7 +326,7 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
     $jsData = array();
     // Get just what we need to keep the dom small
     $whatWeWant = array_flip(array('contact_type_a', 'contact_type_b', 'contact_sub_type_a', 'contact_sub_type_b'));
-    foreach($this->_allRelationshipNames as $id => $vals) {
+    foreach ($this->_allRelationshipNames as $id => $vals) {
       if ($vals['name_a_b'] === 'Employee of') {
         $this->assign('employmentRelationship', $id);
       }
index d3d298332fcdfea30f3b8e6a7bcb376e13b6ab2d..4f452ddce02263b558445f186dbe16c91b5d75e3 100644 (file)
@@ -361,7 +361,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
     $financialType = CRM_Utils_Array::value('financial_type_id', $this->_formValues);
     if ($financialType && is_array($financialType)) {
       unset($this->_formValues['financial_type_id']);
-      foreach($financialType as $notImportant => $typeID) {
+      foreach ($financialType as $notImportant => $typeID) {
         $this->_formValues['financial_type_id'][$typeID] = 1;
       }
     }
index 559e2f36a337498861cedac4699fce2cc4790276..8a0422d77a3b1b8202e676937e05b77081f0e783 100644 (file)
@@ -86,7 +86,7 @@ class CRM_Contact_Form_Search_Custom_ContributionAggregate implements CRM_Contac
     $form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
 
     $financial_types = CRM_Contribute_PseudoConstant::financialType();
-    foreach($financial_types as $financial_type_id => $financial_type) {
+    foreach ($financial_types as $financial_type_id => $financial_type) {
       $form->addElement('checkbox', "financial_type_id[{$financial_type_id}]", 'Financial Type', $financial_type);
     }
 
index 8cabc53bf333129c9643f7730e3b9bfc8c42bb31..c634632410868d1618de7d71a2f8d303fb9c3d93 100644 (file)
@@ -110,11 +110,11 @@ class CRM_Contact_Form_Task_AlterPreferences extends CRM_Contact_Form_Task {
     if (!empty($params['pref'])) {
       $privacyValues = $params['pref'];
       $count = 0;
-      foreach($this->_contactIds as $contact_id) {
+      foreach ($this->_contactIds as $contact_id) {
         $contact = new CRM_Contact_BAO_Contact();
         $contact->id = $contact_id;
 
-        foreach($privacyValues as $privacy_key => $privacy_value) {
+        foreach ($privacyValues as $privacy_key => $privacy_value) {
           $contact->$privacy_key = $privacyValueNew;
         }
         $contact->save();
@@ -123,7 +123,7 @@ class CRM_Contact_Form_Task_AlterPreferences extends CRM_Contact_Form_Task {
       // Status message
       $privacyOptions = CRM_Core_SelectValues::privacy();
       $status = array();
-      foreach($privacyValues as $privacy_key => $privacy_value) {
+      foreach ($privacyValues as $privacy_key => $privacy_value) {
         $label = $privacyOptions[$privacy_key];
         $status[] = $privacyValueNew ? ts("Added '%1'", array(1 => $label)) : ts("Removed '%1'", array(1 => $label));
       }
index ee9ffebb447f3fd668e243df386b247349b52f86..e715b320f98c3f7e62a01bed9fca20d469558a82 100644 (file)
@@ -499,7 +499,7 @@ class CRM_Contact_Form_Task_EmailCommon {
     if (isset($form->_caseId)) {
       // if case-id is found in the url, create case activity record
       $cases = explode(',', $form->_caseId);
-      foreach($cases as $key => $val) {
+      foreach ($cases as $key => $val) {
         if (is_numeric($val)) {
           $caseParams = array(
             'activity_id' => $activityId,
index a6e0823133275194645c437e6b98362225bb3912..33f86c8a96cd42b8ffad7da61460ff035896f0cb 100644 (file)
@@ -153,7 +153,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
     // retrieve and highlight required custom fields
     $formattedFieldNames = $this->formatCustomFieldName($this->_mapperFields);
     self::$customFields = CRM_Core_BAO_CustomField::getFields($this->_contactType);
-    foreach(self::$customFields as $key => $attr) {
+    foreach (self::$customFields as $key => $attr) {
       if (!empty($attr['is_required'])) {
         $highlightedFields[] = "custom_$key";
       }
index 998f63e84b3ba0ae86a01d41ddb2134a8a397f8a..3f659e3755a2a1f9000dada23482b5d9285cd2d8 100644 (file)
@@ -268,7 +268,7 @@ class CRM_Contact_Page_AJAX {
 
     $ret = array('is_error' => 0);
 
-    foreach($clientList as $sourceContactID) {
+    foreach ($clientList as $sourceContactID) {
       $relationParams = array(
         'relationship_type_id' => $relType . '_a_b',
         'contact_check' => array($relContactID => 1),
@@ -288,7 +288,7 @@ class CRM_Contact_Page_AJAX {
         $caseRelationships->contact_id_a = $sourceContactID;
         $caseRelationships->find();
 
-        while($caseRelationships->fetch()) {
+        while ($caseRelationships->fetch()) {
           $relationIds['relationship'] = $caseRelationships->id;
           $relationIds['contactTarget'] = $relContactID;
         }
index 11c927f94dadf20ce23b890de79b7b54f4e9195b..461dc334c4f6f9353f17ad8562375db444d5cbb0 100644 (file)
@@ -1059,7 +1059,7 @@ SELECT DISTINCT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', cont
 
     // build insert query, note that currently we build cache for 500 contact records at a time, hence below approach
     $insertValues = array();
-    while($dao->fetch()) {
+    while ($dao->fetch()) {
       $insertValues[] = "('civicrm_contact', {$dao->contact_id}, {$dao->contact_id}, '{$cacheKey}', '" . CRM_Core_DAO::escapeString($dao->sort_name) . "')";
     }
 
index e50a02fbd377c41639434b5a7863733e27d20226..c4f75a232d27abc11f2b641ef3f38b452c671172 100644 (file)
@@ -367,7 +367,7 @@ class CRM_Contribute_BAO_Contribution_Utils {
    * @return bool
    */
   static protected function isPaymentTransaction($form) {
-    if(!empty($form->_values['is_monetary']) && $form->_amount >= 0.0) {
+    if (!empty($form->_values['is_monetary']) && $form->_amount >= 0.0) {
       return TRUE;
     }
     return FALSE;
index 468fe9c1d256fb7f1bb3eb597698fcf6174b4fac..372f8fcc2cbc304c6d2d686983ec74f8922fc849 100644 (file)
@@ -935,7 +935,7 @@ LEFT JOIN  civicrm_premiums            ON ( civicrm_premiums.entity_id = civicrm
    */
   public static function getIsMembershipPayment($id) {
     $membershipBlocks = civicrm_api3('membership_block', 'get', array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $id, 'sequential' => TRUE));
-    if(!$membershipBlocks['count']) {
+    if (!$membershipBlocks['count']) {
       return FALSE;
     }
     return $membershipBlocks['values'][0]['is_separate_payment'];
index e0453133093a8af44de6bbd70bdb2486ef0a80ce..a08dbaf5bcf692c152bc8957729d80bbd71966a0 100644 (file)
@@ -93,7 +93,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio
   public static function del($params) {
     //delete from contribution soft table
     $contributionSoft = new CRM_Contribute_DAO_ContributionSoft();
-    foreach($params as $column => $value) {
+    foreach ($params as $column => $value) {
       $contributionSoft->$column = $value;
     }
     $contributionSoft->delete();
index 26c360547d5acc6d85534f704dc182d9f90d74af..288059850079c28d116515a5bf39a1cf9a3dd07b 100644 (file)
@@ -253,7 +253,7 @@ class CRM_Contribute_BAO_Query {
 
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     foreach (self::getRecurringFields() as $dateField => $dateFieldTitle) {
-      if(self::buildDateWhere($values, $query, $name, $dateField, $dateFieldTitle)) {
+      if (self::buildDateWhere($values, $query, $name, $dateField, $dateFieldTitle)) {
         return;
       }
     }
@@ -343,7 +343,7 @@ class CRM_Contribute_BAO_Query {
         // Ensure we have a sensible string to display to the user.
         $names = array();
         if (isset($val) && is_array($val)) {
-          foreach($val as $id) {
+          foreach ($val as $id) {
             $names[] = CRM_Utils_Array::value($id, $types);
           }
         }
@@ -1146,7 +1146,7 @@ class CRM_Contribute_BAO_Query {
    */
   public static function buildDateWhere(&$values, $query, $name, $field, $title) {
     $fieldPart = strpos($name, $field);
-    if($fieldPart === FALSE) {
+    if ($fieldPart === FALSE) {
       return;
     }
     // we only have recurring dates using this ATM so lets' short cut to find the table name
index e88a5219be21e9e9e075e4423e13c6bde7b1b873..e0b67865628a8972293577dbf8e11c02df5843f3 100644 (file)
@@ -421,7 +421,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     $onlinePaymentProcessorEnabled = FALSE;
     if (!empty($this->_paymentProcessors)) {
       foreach ($this->_paymentProcessors as $key => $name) {
-        if($name['billing_mode'] == 1) {
+        if ($name['billing_mode'] == 1) {
           $onlinePaymentProcessorEnabled = TRUE;
         }
         $pps[$key] = $name['name'];
@@ -447,7 +447,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     }
 
     $contactID = $this->getContactID();
-    if($this->getContactID() === '0') {
+    if ($this->getContactID() === '0') {
       $this->addCidZeroOptions($onlinePaymentProcessorEnabled);
     }
     //build pledge block.
@@ -563,7 +563,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
         $pcp_supporter_text = ts('This contribution is being made thanks to the effort of <strong>%1</strong>, who supports our campaign.', array(1 => $pcpSupporter));
         // Only tell people that can also create a PCP if the contribution page has a non-empty value in the "Create Personal Campaign Page link" field.
         $text = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->_id, 'contribute');
-        if(!empty($text)) {
+        if (!empty($text)) {
           $pcp_supporter_text .= ts("You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!");
         }
         $this->assign('pcpSupporterText', $pcp_supporter_text);
@@ -681,7 +681,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     $unitVals = explode(CRM_Core_DAO::VALUE_SEPARATOR, $frUnits);
 
     // CRM 10860, display text instead of a dropdown if there's only 1 frequency unit
-    if(sizeof($unitVals) == 1) {
+    if (sizeof($unitVals) == 1) {
       $form->assign('one_frequency_unit', TRUE);
       $unit = $unitVals[0];
       $form->add('hidden', 'frequency_unit', $unit);
@@ -870,7 +870,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
           $errors['_qf_default'] = ts('Select at least one option from Contribution(s).');
         }
       }
-      if($otherAmount && !empty($check)) {
+      if ($otherAmount && !empty($check)) {
         $errors["price_{$otherAmount}"] = ts('Amount is required field.');
       }
 
index 0ee679cb2282922dc329b4fe630c9d08fa95b5bf..c4694e42c551586d12bf86bfffdbc34d87f8a554 100644 (file)
@@ -189,12 +189,12 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For
       'account_relationship = 7'
     );
     $productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
-    foreach$financialType as $key => $financialTypeName ){
-      if(!in_array( $key, $productFinancialType)) {
+    foreach ($financialType as $key => $financialTypeName ){
+      if (!in_array( $key, $productFinancialType)) {
         unset( $financialType[$key] );
       }
     }
-    ifcount( $financialType ) ){
+    if (count( $financialType ) ){
       $this->assign( 'financialType', $financialType );
     }
     $this->add(
index 6b885032da7bdb9460b3a3608f3c2b6a3e236cc8..438125c44d1a66a8a71781b5c2449127f0f9f434 100644 (file)
@@ -383,7 +383,7 @@ SELECT id
     }
 
     if (!empty($fields['is_recur_interval'])) {
-      foreach(array_keys($fields['payment_processor']) as $paymentProcessorID) {
+      foreach (array_keys($fields['payment_processor']) as $paymentProcessorID) {
         $paymentProcessorTypeId = CRM_Core_DAO::getFieldValue(
           'CRM_Financial_DAO_PaymentProcessor',
           $paymentProcessorID,
index 82a45b20146f76c7ba47788ba764ca654761052b..0a135e6d0056ad00e8578f4e169571e169ee4a02 100644 (file)
@@ -167,12 +167,12 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
       'account_relationship = 7'
     );
     $productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
-    foreach$financialType as $key => $financialTypeName ){
-      if(!in_array( $key, $productFinancialType)) {
+    foreach ($financialType as $key => $financialTypeName ){
+      if (!in_array( $key, $productFinancialType)) {
         unset( $financialType[$key] );
       }
     }
-    ifcount( $financialType ) ){
+    if (count( $financialType ) ){
       $this->assign( 'financialType', $financialType );
     }
     $this->add(
@@ -301,8 +301,8 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
 
           // to check wether GD is installed or not
           $gdSupport = CRM_Utils_System::getModuleSetting('gd', 'GD Support');
-          if($gdSupport) {
-            if($imageFile) {
+          if ($gdSupport) {
+            if ($imageFile) {
               $error = FALSE;
               $params['image'] = $this->_resizeImage($imageFile, "_full", 200, 200);
               $params['thumbnail'] = $this->_resizeImage($imageFile, "_thumb", 50, 50);
@@ -370,7 +370,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
     $widthOrig = $imageInfo[0];
     $heightOrig = $imageInfo[1];
     $image = imagecreatetruecolor($width, $height);
-    if($imageInfo['mime'] == 'image/gif') {
+    if ($imageInfo['mime'] == 'image/gif') {
       $source = imagecreatefromgif($filename);
     }
     elseif($imageInfo['mime'] == 'image/png') {
index 69267ac13b9953ee3e1f0256c80565dd91148068..cc38b5821dc6d1ac2c0ab81063c5b68777dcfbba 100644 (file)
@@ -272,7 +272,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
       $financialType = CRM_Utils_Array::value('financial_type_id', $this->_formValues);
       if ($financialType && is_array($financialType)) {
         unset($this->_formValues['financial_type_id']);
-        foreach($financialType as $notImportant => $typeID) {
+        foreach ($financialType as $notImportant => $typeID) {
           $this->_formValues['financial_type_id'][$typeID] = 1;
         }
       }
@@ -285,7 +285,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
 
       if ($tags && is_array($tags)) {
         unset($this->_formValues['contact_tags']);
-        foreach($tags as $notImportant => $tagID) {
+        foreach ($tags as $notImportant => $tagID) {
           $this->_formValues['contact_tags'][$tagID] = 1;
         }
       }
@@ -299,7 +299,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
 
         if ($group && is_array($group)) {
           unset($this->_formValues['group']);
-          foreach($group as $notImportant => $groupID) {
+          foreach ($group as $notImportant => $groupID) {
             $this->_formValues['group'][$groupID] = 1;
           }
         }
index a92ce45128bae1485e404dd31270eee4c0cab738..df72a0e2b7191e18293dc7a4fbefa3d833a826ab 100644 (file)
@@ -47,7 +47,7 @@ class CRM_Contribute_Form_SearchContribution extends CRM_Core_Form {
     $this->add('text', 'title', ts('Find'), $attributes);
 
     $financial_account = CRM_Contribute_PseudoConstant::financialType( );
-    foreach($financial_account as $contributionId => $contributionName) {
+    foreach ($financial_account as $contributionId => $contributionName) {
       $this->addElement('checkbox', "financial_type_id[$contributionId]", 'Financial Type', $contributionName);
     }
 
index be570821979970212bdce5561162c78aa598c9ba..08ceac1d9f8c230434362af4ba2749247fc2dfd2 100644 (file)
@@ -139,7 +139,7 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task {
       'email' => ts('Send emails where possible. Generate printable PDFs for contacts who cannot receive email.'),
       'both' => ts('Send emails where possible. Generate printable PDFs for all contacts.'),
     );
-    if(CRM_Core_Config::singleton()->doNotAttachPDFReceipt)  {
+    if (CRM_Core_Config::singleton()->doNotAttachPDFReceipt)  {
       $emailOptions['pdfemail'] = ts('Send emails with an attached PDF where possible. Generate printable PDFs for contacts who cannot receive email.');
       $emailOptions['pdfemail_both'] = ts('Send emails with an attached PDF where possible. Generate printable PDFs for all contacts.');
     }
index d98f7eb8d925c7164925b122673eef1d622cb8a4..7d2e6e99a328f250aaa1697b45a12aa1a4306353 100644 (file)
@@ -18,14 +18,14 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
     list($formValues, $categories, $html_message, $messageToken, $returnProperties) = self::processMessageTemplate($form);
     $isPDF = FALSE;
     $emailParams = array();
-    if(!empty($formValues['email_options'])) {
+    if (!empty($formValues['email_options'])) {
       $returnProperties['email'] = $returnProperties['on_hold'] = $returnProperties['is_deceased'] = $returnProperties['do_not_email'] = 1;
       $emailParams = array(
         'subject'   => $formValues['subject']
       );
       // We need display_name for emailLetter() so add to returnProperties here
       $returnProperties['display_name'] = 1;
-      if(stristr($formValues['email_options'], 'pdfemail')) {
+      if (stristr($formValues['email_options'], 'pdfemail')) {
         $isPDF = TRUE;
       }
     }
@@ -39,8 +39,8 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
     $realSeparator = ', ';
     //the original thinking was mutliple options - but we are going with only 2 (comma & td) for now in case
     // there are security (& UI) issues we need to think through
-    if(isset($formValues['group_by_separator'])) {
-      if($formValues['group_by_separator'] == 'td') {
+    if (isset($formValues['group_by_separator'])) {
+      if ($formValues['group_by_separator'] == 'td') {
         $realSeparator = "</td><td>";
       }
     }
@@ -58,7 +58,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
     foreach ($contributions as $contributionId => $contribution) {
       $contact = &$contacts[$contribution['contact_id']];
       $grouped = $groupByID = 0;
-      if($groupBy) {
+      if ($groupBy) {
         $groupByID = empty($contribution[$groupBy]) ? 0 : $contribution[$groupBy];
         $contribution = $contact['combined'][$groupBy][$groupByID];
         $grouped = TRUE;
@@ -66,18 +66,18 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
 
       self::assignCombinedContributionValues($contact, $contributions, $groupBy, $groupByID);
 
-      if(empty($groupBy) || empty($contact['is_sent'][$groupBy][$groupByID])) {
-        if(!$validated && $realSeparator == '</td><td>' && !self::isValidHTMLWithTableSeparator($messageToken, $html_message)) {
+      if (empty($groupBy) || empty($contact['is_sent'][$groupBy][$groupByID])) {
+        if (!$validated && $realSeparator == '</td><td>' && !self::isValidHTMLWithTableSeparator($messageToken, $html_message)) {
           $realSeparator = ', ';
           CRM_Core_Session::setStatus(ts('You have selected the table cell separator, but one or more token fields are not placed inside a table cell. This would result in invalid HTML, so comma separators have been used instead.'));
         }
         $validated = TRUE;
         $html[$contributionId] = str_replace($separator, $realSeparator, self::resolveTokens($html_message, $contact, $contribution, $messageToken, $categories, $grouped, $separator));
         $contact['is_sent'][$groupBy][$groupByID] = TRUE;
-        if(!empty($formValues['email_options'])) {
-          if(self::emailLetter($contact, $html[$contributionId], $isPDF, $formValues, $emailParams)) {
+        if (!empty($formValues['email_options'])) {
+          if (self::emailLetter($contact, $html[$contributionId], $isPDF, $formValues, $emailParams)) {
             $emailed ++;
-            if(!stristr($formValues['email_options'], 'both')) {
+            if (!stristr($formValues['email_options'], 'both')) {
               unset($html[$contributionId]);
             }
           }
@@ -103,7 +103,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
     //@todo - figure out why
     $form->_contactIds = array_keys($contacts);
     self::createActivities($form, $html_message, $form->_contactIds);
-    if(!empty($html)) {
+    if (!empty($html)) {
       CRM_Utils_PDF_Utils::html2pdf($html, "CiviLetter.pdf", FALSE, $formValues);
     }
 
@@ -122,7 +122,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
     if ($updateStatus) {
       CRM_Core_Session::setStatus($updateStatus);
     }
-    if(!empty($html)) {
+    if (!empty($html)) {
       // ie. we have only sent emails - lets no show a white screen
       CRM_Utils_System::civiExit(1);
     }
@@ -143,7 +143,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
     foreach ($relevantEntities as $entity) {
       if (isset($tokens[$entity]) && is_array($tokens[$entity])) {
         foreach ($tokens[$entity] as $token) {
-          if(!self::isHtmlTokenInTableCell($token, $entity, $html)) {;
+          if (!self::isHtmlTokenInTableCell($token, $entity, $html)) {;
             return FALSE;
           }
         }
@@ -185,7 +185,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
    */
   private static function resolveTokens($html_message, $contact, $contribution, $messageToken, $categories, $grouped, $separator) {
     $tokenHtml = CRM_Utils_Token::replaceContactTokens($html_message, $contact, TRUE, $messageToken);
-    if($grouped) {
+    if ($grouped) {
       $tokenHtml = CRM_Utils_Token::replaceMultipleContributionTokens($separator, $tokenHtml, $contribution, TRUE, $messageToken);
     }
     else {
@@ -241,7 +241,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
       else {
         $contactID = $contribution['contact_id'];
       }
-      if(!isset($contacts[$contactID])) {
+      if (!isset($contacts[$contactID])) {
         list($contact) = CRM_Utils_Token::getTokenDetails(array('contact_id' => $contactID),
           $returnProperties,
           $skipOnHold,
@@ -259,7 +259,7 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
       $groupByID = empty($contribution[$groupBy]) ? 0 : $contribution[$groupBy];
 
       $contacts[$contactID]['contribution_ids'][$groupBy][$groupByID][$contributionId] = TRUE;
-      if(!isset($contacts[$contactID]['combined'][$groupBy]) || !isset($contacts[$contactID]['combined'][$groupBy][$groupByID])) {
+      if (!isset($contacts[$contactID]['combined'][$groupBy]) || !isset($contacts[$contactID]['combined'][$groupBy][$groupByID])) {
         $contacts[$contactID]['combined'][$groupBy][$groupByID] = $contribution;
         $contacts[$contactID]['aggregates'][$groupBy][$groupByID] = $contribution['total_amount'];
       }
@@ -323,12 +323,12 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
    */
   public static function emailLetter($contact, $html, $is_pdf, $format = array(), $params = array()) {
     try {
-      if(empty($contact['email'])) {
+      if (empty($contact['email'])) {
         return FALSE;
       }
       $mustBeEmpty = array('do_not_email', 'is_deceased', 'on_hold');
       foreach ($mustBeEmpty as $emptyField) {
-        if(!empty($contact[$emptyField])) {
+        if (!empty($contact[$emptyField])) {
           return FALSE;
         }
       }
@@ -340,12 +340,12 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF
         'text' => '',
         'html' => $html,
       );
-      if(empty($params['from'])) {
+      if (empty($params['from'])) {
         $emails = CRM_Core_BAO_Email::getFromEmail();
         $emails = array_keys($emails);
         $defaults['from'] = array_pop($emails);
       }
-      if($is_pdf) {
+      if ($is_pdf) {
         $defaults['html'] = ts('Please see attached');
         $defaults['attachments'] = array(CRM_Utils_Mail::appendPDF('ThankYou.pdf', $html, $format));
       }
index 516708f6ba6bdfbb49763a8f09d23797bec99243..445dc45ba1e7d6065fe843676bb5e7fa6a4c43b9 100644 (file)
@@ -288,7 +288,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
             0,
           );
         }
-        if(!empty($mapperKeysValues) && $mapperKeysValues[$i][0] == 'soft_credit') {
+        if (!empty($mapperKeysValues) && $mapperKeysValues[$i][0] == 'soft_credit') {
           $js .= "cj('#mapper_".$i."_1').val($mapperKeysValues[$i][1]);\n";
           $js .= "cj('#mapper_".$i."_2').val($mapperKeysValues[$i][2]);\n";
         }
index e1a0c73238a96fccacb5f57d31dd893d7bdb98f4..1787bb1da06e97d68dde1817a60024c202f7240e 100644 (file)
@@ -451,7 +451,7 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser {
             $params[$this->_activeFields[$i]->_name] = array();
           }
           $params[$this->_activeFields[$i]->_name][$i][$this->_activeFields[$i]->_softCreditField] = $this->_activeFields[$i]->_value;
-          if(isset($this->_activeFields[$i]->_softCreditType)){
+          if (isset($this->_activeFields[$i]->_softCreditType)){
             $params[$this->_activeFields[$i]->_name][$i]['soft_credit_type_id'] = $this->_activeFields[$i]->_softCreditType;
           }
         }
index 73b182370196d13c0d0f2342e168299ee4b52dac..5f0acf6264378c6cc95a855db90a6b6e246ef3b8 100644 (file)
@@ -399,8 +399,8 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa
 
             //Delete all existing soft Contribution from contribution_soft table for pcp_id is_null
             $existingSoftCredit = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($dupeSoftCredit['contribution_id']);
-            if(isset($existingSoftCredit['soft_credit']) && !empty($existingSoftCredit['soft_credit'])){
-              foreach($existingSoftCredit['soft_credit'] as $key => $existingSoftCreditValues){
+            if (isset($existingSoftCredit['soft_credit']) && !empty($existingSoftCredit['soft_credit'])){
+              foreach ($existingSoftCredit['soft_credit'] as $key => $existingSoftCreditValues){
                 if (!empty($existingSoftCreditValues['soft_credit_id'])) {
                   $deleteParams = array(
                     'id' => $existingSoftCreditValues['soft_credit_id'],
index ac7a93c5a780a2ac1e42cc14018f04c9fcfe456e..9e3a6832b18cc376615055a02640a6e02fa77644 100644 (file)
@@ -170,7 +170,7 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic {
         $dao->id
       );
       //Financial Type
-      if!empty( $dao->financial_type_id )  ){
+      if (!empty( $dao->financial_type_id )  ){
         require_once 'CRM/Core/DAO.php';
         $premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name' );
       }
index 6f997a815e750064fd0e5470c1d49d676718ae79..47904af7d0e564120c9b25f00101b5d4df4561c1 100644 (file)
@@ -125,7 +125,7 @@ class CRM_Contribute_Task {
         unset(self::$_tasks[1]);
       }
       //CRM-12920 - check for edit permission
-      if!CRM_Core_Permission::check('edit contributions') ){
+      if (!CRM_Core_Permission::check('edit contributions') ){
         unset(self::$_tasks[4], self::$_tasks[6]);
       }
 
index 587ef5922cf26ed4ad4f5769193b95a3f1b79630..5f3c281023bb000cce27c6a7a36ab2c809b827df 100644 (file)
@@ -929,7 +929,7 @@ WHERE reminder.action_schedule_id = %1 AND reminder.action_date_time IS NULL
     $actionSchedule = new CRM_Core_DAO_ActionSchedule();
     $actionSchedule->mapping_id = $mappingID;
     $actionSchedule->is_active = 1;
-    if(!empty($params)) {
+    if (!empty($params)) {
       _civicrm_api3_dao_set_filter($actionSchedule, $params, FALSE, 'ActionSchedule');
     }
     $actionSchedule->find();
index d7af70f01396cd0fa0d6678e3604360213044655..fa1262af5a20ca5d78eff8f79a36616deece043d 100644 (file)
@@ -821,7 +821,7 @@ ORDER BY civicrm_address.is_primary DESC, civicrm_address.location_type_id DESC,
     // the DB to fatal
     $fields = CRM_Core_BAO_Address::fields();
     foreach ($fields as $fieldname => $field) {
-      if(!empty($field['maxlength']) && strlen(CRM_Utils_Array::value($fieldname, $parseFields)) > $field['maxlength']) {
+      if (!empty($field['maxlength']) && strlen(CRM_Utils_Array::value($fieldname, $parseFields)) > $field['maxlength']) {
         return $emptyParseFields;
       }
     }
@@ -1025,7 +1025,7 @@ SELECT is_primary,
         if ($count > 2) {
           break;
         }
-        if(count($first_names) == 1){
+        if (count($first_names) == 1){
           $family = $first_names[current(array_keys($first_names))]['addressee_display'];
         }
         else {
index 4d45db3347f574c0fa5f60ff561c250ebaa32a68..93ac3a3d9831786fc6746497a71cb3af5c61cff0 100644 (file)
@@ -468,7 +468,7 @@ class CRM_Core_BAO_Block {
       $sql = "UPDATE $table SET is_primary = 0 WHERE contact_id = %1";
       $sqlParams = array(1 => array($contactId, 'Integer'));
       // we don't want to create unecessary entries in the log_ tables so exclude the one we are working on
-      if(!empty($params['id'])){
+      if (!empty($params['id'])){
         $sql .= " AND id <> %2";
         $sqlParams[2] = array($params['id'], 'Integer');
       }
index 2b1ca78553d8561261625b7961854f552990c884..e5d0334885dba6b2e17d9e79be95da35f1a365bc 100644 (file)
@@ -456,8 +456,8 @@ AND    $cond
           $fieldName = "custom_{$fieldID}";
           if ($isMultiple[$tableName]) {
             if ($formatMultiRecordField) {
-              if($file[$tableName][$fieldID] == 'File') {
-                if($fileid = $dao->$fieldName) {
+              if ($file[$tableName][$fieldID] == 'File') {
+                if ($fileid = $dao->$fieldName) {
                   $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName, $entityID);
                   $result["{$dao->id}"]["{$fieldID}"] = $fileurl[$dao->$fieldName];
                 }
@@ -471,8 +471,8 @@ AND    $cond
             }
           }
           else {
-            if($file[$tableName][$fieldID] == 'File') {
-              if($fileid = $dao->$fieldName) {
+            if ($file[$tableName][$fieldID] == 'File') {
+              if ($fileid = $dao->$fieldName) {
                 $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName, $entityID);
                 $result[$fieldID] = $fileurl[$dao->$fieldName];
               }
index d100387e2da6b85150d29c276de7593011c2e0b7..7df895acbcafe4e0dbef18536e75aea3f05302ce 100644 (file)
@@ -499,7 +499,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
       //Get the id of Logged in User
       $session = CRM_Core_Session::singleton();
       $contactID = $session->get('userID');
-      if(!empty($contactID)) {
+      if (!empty($contactID)) {
         $contactIDs[] = $session->get('userID');
       }
     }
index e5ee11cb204d3aff96aa0ba6f2caeb25cc1df2b7..b009369d38a1567ca3d3b1e9e4022384b4d80bde 100644 (file)
@@ -90,7 +90,7 @@ UPDATE civicrm_email
 SET    is_bulkmail = 0
 WHERE  contact_id = {$params['contact_id']}
 ";
-      if($hook == 'edit'){
+      if ($hook == 'edit'){
         $sql .= " AND id <> {$params['id']}";
       }
       CRM_Core_DAO::executeQuery($sql);
index ac43f72462af8992a75a1320228e4f4173567a49..bcb0c089c7843173bdad5c1a5a3e9d764f40f8f3 100644 (file)
@@ -111,7 +111,7 @@ class CRM_Core_BAO_FinancialTrxn extends CRM_Financial_DAO_FinancialTrxn {
 
     $balanceAmtDAO = CRM_Core_DAO::executeQuery($q, $p);
     $ret = array();
-    while($balanceAmtDAO->fetch()) {
+    while ($balanceAmtDAO->fetch()) {
       $ret['trxn_id'] = $balanceAmtDAO->id;
       $ret['total_amount'] = $balanceAmtDAO->total_amount;
     }
@@ -281,7 +281,7 @@ WHERE lt.entity_id = %1 ";
 
     $sqlParams = array(1 => array($entity_id, 'Integer'), 2 => array($entity_table, 'String'));
     $dao =  CRM_Core_DAO::executeQuery($query, $sqlParams);
-    while($dao->fetch()){
+    while ($dao->fetch()){
       $result[$dao->financial_trxn_id][$dao->id] = $dao->amount;
     }
     if (!empty($result)) {
index 83e73fb3f76c6ce4bfdf477c285c1dcc36e8d805..93b5ab351b912eb258af98c8ef2f3ab3b05f4122 100644 (file)
@@ -145,7 +145,7 @@ class CRM_Core_BAO_MailSettings extends CRM_Core_DAO_MailSettings {
       return $result;
     }
 
-    if(empty($params['id'])) {
+    if (empty($params['id'])) {
       $params['is_ssl'] = CRM_Utils_Array::value('is_ssl', $params, FALSE);
       $params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
     }
index 1b1c0bbbf7285b9f304ce6b52069b193b9a13d36..9670fd100c4782b74e126d6eafa7cf147cf3d5de 100644 (file)
@@ -871,7 +871,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
       $js .= implode(', ', $elements);
       $js .= "]";
       $js .= "
-                for(var i=0;i<nullArray.length;i++) {
+                for (var i=0;i<nullArray.length;i++) {
                     if ( {$formName}['mapper['+nullArray[i][0]+']['+nullArray[i][1]+']['+nullArray[i][2]+']'] ) {
                         {$formName}['mapper['+nullArray[i][0]+']['+nullArray[i][1]+']['+nullArray[i][2]+']'].style.display = '';
                     }
@@ -892,7 +892,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
       $js .= implode(', ', $elements);
       $js .= "]";
       $js .= "
-                for(var i=0;i<noneArray.length;i++) {
+                for (var i=0;i<noneArray.length;i++) {
                     if ( {$formName}['mapper['+noneArray[i][0]+']['+noneArray[i][1]+']['+noneArray[i][2]+']'] ) {
   {$formName}['mapper['+noneArray[i][0]+']['+noneArray[i][1]+']['+noneArray[i][2]+']'].style.display = 'none';
                     }
index eb526146054479c522f14483719a42ddb1b78706..a6db9f9887a13240f318acf1a417fa9d79e24c7d 100644 (file)
@@ -90,7 +90,7 @@ class CRM_Core_BAO_OptionGroup extends CRM_Core_DAO_OptionGroup {
    * @return object
    */
   public static function add(&$params, $ids = array()) {
-    if(empty($params['id'])){
+    if (empty($params['id'])){
       $params['id'] = CRM_Utils_Array::value('optionGroup', $ids);
     }
 
index 8e320c1944641374254cbefb8b8a54330af66696..21dedd8b4ad83914dc0f92eecaefb748ca8f6498 100644 (file)
@@ -74,13 +74,13 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
    * @param array $params
    */
   public static function setDefaults(&$params){
-    if(CRM_Utils_Array::value('label', $params, NULL) === NULL){
+    if (CRM_Utils_Array::value('label', $params, NULL) === NULL){
       $params['label'] = $params['name'];
     }
-    if(CRM_Utils_Array::value('name', $params, NULL) === NULL){
+    if (CRM_Utils_Array::value('name', $params, NULL) === NULL){
       $params['name'] = $params['label'];
     }
-    if(CRM_Utils_Array::value('weight', $params, NULL) === NULL){
+    if (CRM_Utils_Array::value('weight', $params, NULL) === NULL){
       $params['weight'] = self::getDefaultWeight($params);
     }
     if (CRM_Utils_Array::value('value', $params, NULL) === NULL){
@@ -113,7 +113,7 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
   public static function getDefaultValue($params){
      $bao = new CRM_Core_BAO_OptionValue();
      $bao->option_group_id = $params['option_group_id'];
-     if(isset($params['domain_id'])){
+     if (isset($params['domain_id'])){
        $bao->domain_id = $params['domain_id'];
      }
      $bao->selectAdd();
index 685ffda698456b40d3cb4eb2df9c2001ce61e53e..42b043e4c320cc834b770771a88c8d22e2795e22 100644 (file)
@@ -597,7 +597,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
     // to make sure we not copying to source itself\r
     unset($repeatingEntities[$key]);\r
 \r
-    foreach($repeatingEntities as $key => $val) {\r
+    foreach ($repeatingEntities as $key => $val) {\r
       $entityID = $val['id'];\r
       $entityTable = $val['table'];\r
 \r
@@ -693,7 +693,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
             // for each parent entity in the set, find out a similar linked entity,\r
             // if doesn't exist create one, and also create entries in recurring_entity table\r
 \r
-            foreach($pRepeatingEntities as $key => $val) {\r
+            foreach ($pRepeatingEntities as $key => $val) {\r
               if (array_key_exists($key, $processedEntities)) {\r
                 // this graph is already being processed\r
                 return NULL;\r
@@ -704,7 +704,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
             // start with first entry with just itself\r
             CRM_Core_BAO_RecurringEntity::quickAdd($obj->id, $obj->id, $obj->__table);\r
 \r
-            foreach($pRepeatingEntities as $key => $val) {\r
+            foreach ($pRepeatingEntities as $key => $val) {\r
               $rlinkedDAO = new self::$_tableDAOMapper[$obj->__table]();\r
               $rlinkedDAO->$idCol = $val['id'];\r
               $rlinkedDAO->$tableCol = $val['table'];\r
@@ -987,7 +987,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
           $startActionCondition = $scheduleReminderDetails['start_action_condition'];\r
           $explodeStartActionCondition = explode(',', $startActionCondition);\r
           $buildRuleArray = array();\r
-          foreach($explodeStartActionCondition as $key => $val) {\r
+          foreach ($explodeStartActionCondition as $key => $val) {\r
             $buildRuleArray[] = strtoupper(substr($val, 0, 2));\r
           }\r
           $r->wkst('MO')->byday($buildRuleArray);\r
index 2d04ed022f3e136584d07191b1c60f0dc2106fd1..0ebe06e59788f32b6f8b7aff82ddd5da0289c849 100644 (file)
@@ -353,7 +353,7 @@ ALTER TABLE {$tableName}
       }
     }
 
-    if($triggerRebuild) {
+    if ($triggerRebuild) {
       CRM_Core_DAO::triggerRebuild($params['table_name']);
     }
 
index 6a38775c53ab30924ebdd5cd8f262a9d0fe0681f..0071309590e78c6bea9b9552c60180f4a8560974 100644 (file)
@@ -283,22 +283,22 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
     $fields = $result = array();
     $fieldsToGet = self::validateSettingsInput(array_flip($settingsToReturn), $fields, FALSE);
     foreach ($domains as $domainID) {
-      if($domainID != CRM_Core_Config::domainID()){
+      if ($domainID != CRM_Core_Config::domainID()){
         $reloadConfig = TRUE;
         CRM_Core_BAO_Domain::setDomain($domainID);
       }
       $config = CRM_Core_Config::singleton($reloadConfig, $reloadConfig);
       $result[$domainID] = array();
       foreach ($fieldsToGet as $name => $value) {
-        if(!empty($fields['values'][$name]['prefetch'])){
-          if(isset($params['filters']) && isset($params['filters']['prefetch'])
+        if (!empty($fields['values'][$name]['prefetch'])){
+          if (isset($params['filters']) && isset($params['filters']['prefetch'])
             && $params['filters']['prefetch'] == 0){
             // we are filtering out the prefetches from the return array
             // so we will skip
             continue;
           }
           $configKey = CRM_Utils_Array::value('config_key', $fields['values'][$name],  $name);
-          if(isset($config->$configKey)){
+          if (isset($config->$configKey)){
             $setting = $config->$configKey;
           }
         }
@@ -476,13 +476,13 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
     }
 
     foreach ($domains as $domainID) {
-      if($domainID != CRM_Core_Config::domainID()){
+      if ($domainID != CRM_Core_Config::domainID()){
         $reloadConfig = TRUE;
         CRM_Core_BAO_Domain::setDomain($domainID);
       }
       $result[$domainID] = array();
       foreach ($fieldsToSet as $name => $value) {
-        if(empty($fields['values'][$name]['config_only'])){
+        if (empty($fields['values'][$name]['config_only'])){
           CRM_Core_BAO_Setting::_setItem(
             $fields['values'][$name],
             $value,
@@ -494,22 +494,22 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
             $domainID
           );
         }
-        if(!empty($fields['values'][$name]['prefetch'])){
-          if(!empty($fields['values'][$name]['config_key'])){
+        if (!empty($fields['values'][$name]['prefetch'])){
+          if (!empty($fields['values'][$name]['config_key'])){
             $name = $fields['values'][$name]['config_key'];
           }
           $config_keys[$name] = $value;
         }
         $result[$domainID][$name] = $value;
       }
-      if($reloadConfig){
+      if ($reloadConfig){
         CRM_Core_Config::singleton($reloadConfig, $reloadConfig);
       }
 
-      if(!empty($config_keys)){
+      if (!empty($config_keys)){
         CRM_Core_BAO_ConfigSetting::create($config_keys);
       }
-      if($reloadConfig){
+      if ($reloadConfig){
         CRM_Core_BAO_Domain::resetDomain();
       }
     }
@@ -582,7 +582,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
    * @fieldSpec array Metadata for given field (drawn from the xml)
    */
   public static function validateSetting(&$value, $fieldSpec) {
-    if($fieldSpec['type'] == 'String' && is_array($value)){
+    if ($fieldSpec['type'] == 'String' && is_array($value)){
       $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,$value) . CRM_Core_DAO::VALUE_SEPARATOR;
     }
     if (empty($fieldSpec['validate_callback'])) {
@@ -802,7 +802,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
     $spec = self::getSettingSpecification(NULL, array('name' => $name), $domainID);
     $configKey = CRM_Utils_Array::value('config_key', $spec[$name], CRM_Utils_Array::value('legacy_key', $spec[$name], $name));
     //if the key is set to config_only we don't need to do anything
-    if(empty($spec[$name]['config_only'])){
+    if (empty($spec[$name]['config_only'])){
       if (!empty($values[$configKey])) {
         civicrm_api('setting', 'create', array('version' => 3, $name => $values[$configKey], 'domain_id' => $domainID));
       }
index 8bd5e6137e6052fa0e66737ef4c3ff550f695b27..94fcc27910e8500b7be26bfa6d0ef23f10fa7eff 100644 (file)
@@ -832,7 +832,7 @@ SELECT  id
     $requiredProfileFields = array();
 
     foreach ($profileFields['values'] as $field) {
-      if(in_array($field['field_name'], $validBillingFields)) {
+      if (in_array($field['field_name'], $validBillingFields)) {
         $validProfileFields[] = $field['field_name'];
       }
       if ($field['is_required']) {
index 0e8d7ed47c9d98083fd19dd62cde40b06867695d..38cc161e94003723e3336b6834c3e6f76ef6dcfb 100644 (file)
@@ -53,7 +53,7 @@ class CRM_Core_BAO_UFMatch extends CRM_Core_DAO_UFMatch {
   public static function create($params) {
     $hook = empty($params['id']) ? 'create' : 'edit';
     CRM_Utils_Hook::pre($hook, 'UFMatch', CRM_Utils_Array::value('id', $params), $params);
-    if(empty($params['domain_id'])) {
+    if (empty($params['domain_id'])) {
       $params['domain_id'] = CRM_Core_Config::domainID();
     }
     $dao = new CRM_Core_DAO_UFMatch();
index 3fdc7fec2f88e776635ba8a8589fc9d097264e56..10a8e4bbd2e6e35ccfe0d4c0b8c9b10b59ed5c26 100644 (file)
@@ -114,7 +114,7 @@ class CRM_Core_BAO_WordReplacement extends CRM_Core_DAO_WordReplacement {
    * @return WordReplacement array
    */
   public static function create($params) {
-    if(array_key_exists("domain_id", $params) === FALSE) {
+    if (array_key_exists("domain_id", $params) === FALSE) {
       $params["domain_id"] = CRM_Core_Config::domainID();
     }
     $wordReplacement = new CRM_Core_DAO_WordReplacement();
index 433b6d64a4f4a42ff09eb5068133649d05ab0eff..1e5e18af319c1c62e1dddffc91b82a9dfc0a29a7 100644 (file)
@@ -377,13 +377,13 @@ class CRM_Core_CodeGen_Specification {
       );
       $field['html'] = array();
       foreach ($validOptions as $htmlOption) {
-        if(!empty($fieldXML->html->$htmlOption)){
+        if (!empty($fieldXML->html->$htmlOption)){
           $field['html'][$htmlOption] = $this->value($htmlOption, $fieldXML->html);
         }
       }
     }
     $field['pseudoconstant'] = $this->value('pseudoconstant', $fieldXML);
-    if(!empty($field['pseudoconstant'])){
+    if (!empty($field['pseudoconstant'])){
       //ok this is a bit long-winded but it gets there & is consistent with above approach
       $field['pseudoconstant'] = array();
       $validOptions = array(
@@ -402,7 +402,7 @@ class CRM_Core_CodeGen_Specification {
         'callback',
       );
       foreach ($validOptions as $pseudoOption) {
-        if(!empty($fieldXML->pseudoconstant->$pseudoOption)){
+        if (!empty($fieldXML->pseudoconstant->$pseudoOption)){
           $field['pseudoconstant'][$pseudoOption] = $this->value($pseudoOption, $fieldXML->pseudoconstant);
         }
       }
index ec2073ae976fe23b8fecdb9817014126e590161b..f40baf78263870b04213047ad722e2a628ac532f 100644 (file)
@@ -814,7 +814,7 @@ LIKE %1
    */
   public static function schemaRequiresRebuilding($tables = array("civicrm_contact")) {
     $show = array();
-    foreach($tables as $tableName){
+    foreach ($tables as $tableName){
       if (!array_key_exists($tableName, $show)) {
         $query = "SHOW CREATE TABLE $tableName";
         $dao = CRM_Core_DAO::executeQuery($query);
index 084b5450ed7c5cccd60f2b071189f15d2cfe083d..c74529baca70d3f741da17abac8aa642a657a675 100644 (file)
@@ -1051,7 +1051,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     // Core field
     else {
       $info = civicrm_api3($props['entity'], 'getfields');
-      foreach($info['values'] as $uniqueName => $fieldSpec) {
+      foreach ($info['values'] as $uniqueName => $fieldSpec) {
         if (
           $uniqueName === $props['field'] ||
           CRM_Utils_Array::value('name', $fieldSpec) === $props['field'] ||
@@ -1488,7 +1488,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    */
   public function convertDateFieldsToMySQL(&$params){
     foreach ($this->_dateFields as $fieldName => $specs){
-      if(!empty($params[$fieldName])){
+      if (!empty($params[$fieldName])){
         $params[$fieldName] = CRM_Utils_Date::isoToMysql(
           CRM_Utils_Date::processDate(
           $params[$fieldName],
@@ -1496,7 +1496,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         );
       }
       else{
-        if(isset($specs['default'])){
+        if (isset($specs['default'])){
           $params[$fieldName] = date('YmdHis', strtotime($specs['default']));
         }
       }
@@ -1553,10 +1553,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    */
   public function getContactID() {
     $tempID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
-    if(isset($this->_params) && isset($this->_params['select_contact_id'])) {
+    if (isset($this->_params) && isset($this->_params['select_contact_id'])) {
       $tempID = $this->_params['select_contact_id'];
     }
-    if(isset($this->_params, $this->_params[0]) && !empty($this->_params[0]['select_contact_id'])) {
+    if (isset($this->_params, $this->_params[0]) && !empty($this->_params[0]['select_contact_id'])) {
       // event form stores as an indexed array, contribution form not so much...
       $tempID = $this->_params[0]['select_contact_id'];
     }
@@ -1634,7 +1634,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         'api' => array('params' => array('contact_type' => 'Individual'))
       ), $autoCompleteField);
 
-    if($this->canUseAjaxContactLookups()) {
+    if ($this->canUseAjaxContactLookups()) {
       $this->assign('selectable', $autoCompleteField['id_field']);
       $this->addEntityRef($autoCompleteField['id_field'], NULL, array('placeholder' => $autoCompleteField['placeholder'], 'api' => $autoCompleteField['api']));
 
@@ -1667,16 +1667,16 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   public function addCIDZeroOptions($onlinePaymentProcessorEnabled) {
     $this->assign('nocid', TRUE);
     $profiles = array();
-    if($this->_values['custom_pre_id']) {
+    if ($this->_values['custom_pre_id']) {
       $profiles[] = $this->_values['custom_pre_id'];
     }
-    if($this->_values['custom_post_id']) {
+    if ($this->_values['custom_post_id']) {
       $profiles = array_merge($profiles, (array) $this->_values['custom_post_id']);
     }
-    if($onlinePaymentProcessorEnabled) {
+    if ($onlinePaymentProcessorEnabled) {
       $profiles[] = 'billing';
     }
-    if(!empty($this->_values)) {
+    if (!empty($this->_values)) {
       $this->addAutoSelector($profiles);
     }
   }
index e9b481427e1e94b8e2703dacf75e5540e872166b..04a078e3821a755e4e7c561f6bee57904ce48ac8 100644 (file)
@@ -96,7 +96,7 @@ class CRM_Core_Form_RecurringEntity {
       CRM_Core_OptionValue::getValues(array('name' => $entityTable.'_repeat_exclude_dates_'.self::$_parentEntityId), $optionValue);
       $excludeOptionValues = array();
       if (!empty($optionValue)) {
-        foreach($optionValue as $key => $val) {
+        foreach ($optionValue as $key => $val) {
           $excludeOptionValues[$val['value']] = date('m/d/Y', strtotime($val['value']));
         }
         self::$_excludeDateInfo = $excludeOptionValues;
@@ -117,7 +117,7 @@ class CRM_Core_Form_RecurringEntity {
       $defaults['repetition_frequency_unit'] = self::$_scheduleReminderDetails->repetition_frequency_unit;
       $defaults['repetition_frequency_interval'] = self::$_scheduleReminderDetails->repetition_frequency_interval;
       $defaults['start_action_condition'] = array_flip(explode(",", self::$_scheduleReminderDetails->start_action_condition));
-      foreach($defaults['start_action_condition'] as $key => $val) {
+      foreach ($defaults['start_action_condition'] as $key => $val) {
         $val = 1;
         $defaults['start_action_condition'][$key] = $val;
       }
@@ -179,7 +179,7 @@ class CRM_Core_Form_RecurringEntity {
     $numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30);
     $form->add('select', 'repetition_frequency_interval', ts('Repeats every:'), $numericOptions, '', array('style' => 'width:55px;'));
     $form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime'));
-    foreach($dayOfTheWeek as $key => $val) {
+    foreach ($dayOfTheWeek as $key => $val) {
       $startActionCondition[] = $form->createElement('checkbox', $key, NULL, substr($val."&nbsp;", 0, 3));
     }
     $form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on'));
@@ -376,7 +376,7 @@ class CRM_Core_Form_RecurringEntity {
           if ($opGroup->id) {
             $oldWeight = 0;
             $fieldValues = array('option_group_id' => $opGroup->id);
-            foreach($excludeDates as $val) {
+            foreach ($excludeDates as $val) {
               $optionGroupValue =
                   array(
                     'option_group_id' => $opGroup->id,
@@ -449,7 +449,7 @@ class CRM_Core_Form_RecurringEntity {
           // find all entities from the recurring set. At this point we 'll get entities which were not deleted
           // for e.g due to participants being present. We need to delete them from recurring tables anyway.
           $pRepeatingEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['entity_id'], $params['entity_table']);
-          foreach($pRepeatingEntities as $val) {
+          foreach ($pRepeatingEntities as $val) {
             CRM_Core_BAO_RecurringEntity::delEntity($val['id'], $val['table'], TRUE);
           }
         }
index 7e891d9b96261c3b62074f77dc0fe40c207e316c..4719890b32e81ac2ee60645a42707c20825950c0 100644 (file)
@@ -285,7 +285,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment {
      * the date we entered to be respected
      */
     $minDate = date_create('now', new DateTimeZone(self::TIMEZONE));
-    if(strtotime($startDate->format('Y-m-d')) < strtotime($minDate->format('Y-m-d'))){
+    if (strtotime($startDate->format('Y-m-d')) < strtotime($minDate->format('Y-m-d'))){
       $startDate->setTimezone(new DateTimeZone(self::TIMEZONE));
     }
 
@@ -360,7 +360,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment {
    */
   public function _getAuthorizeNetFields() {
     $amount = $this->_getParam('total_amount');//Total amount is from the form contribution field
-    if(empty($amount)){//CRM-9894 would this ever be the case??
+    if (empty($amount)){//CRM-9894 would this ever be the case??
       $amount = $this->_getParam('amount');
     }
     $fields = array();
index 6257cc4d6af274b53b56691ffe06ed7f1b76d561..adac3ac24daa3302a58bcbd16773bfb31fa22bf3 100644 (file)
@@ -263,7 +263,7 @@ INNER JOIN civicrm_contribution co ON co.contribution_recur_id = cr.id
     $contRecur = CRM_Core_DAO::executeQuery($sql);
     $contRecur->fetch();
     $ids['contributionRecur'] = $contRecur->id;
-    if($ids['contact'] != $contRecur->contact_id){
+    if ($ids['contact'] != $contRecur->contact_id){
       CRM_Core_Error::debug_log_message("Recurring contribution appears to have been re-assigned from id {$ids['contact']} to {$contRecur->contact_id}
         Continuing with {$contRecur->contact_id}
       ");
index 55056becfb1ef01979cd435634b364f68a11ea14..c46a36783352356c427040c6e3064724f1ea7de2 100644 (file)
@@ -61,7 +61,7 @@ class CRM_Core_Payment_BaseIPN {
    * @throws CRM_Core_Exception
    */
   public function setInputParameters($parameters) {
-    if(!is_array($parameters)) {
+    if (!is_array($parameters)) {
       throw new CRM_Core_Exception('Invalid input parameters');
     }
     $this->_inputParameters = $parameters;
@@ -380,7 +380,7 @@ class CRM_Core_Payment_BaseIPN {
         $values['receipt_from_name'] = $domainValues[0];
         $values['receipt_from_email'] = $domainValues[1];
       }
-      if($recurContrib && $recurContrib->id){
+      if ($recurContrib && $recurContrib->id){
         //CRM-13273 - is_email_receipt setting on recurring contribution should take precedence over contribution page setting
         $values['is_email_receipt'] = $recurContrib->is_email_receipt;
       }
@@ -924,7 +924,7 @@ LIMIT 1;";
 
       // we have a pledge now we need to get the oldest unpaid payment
       $paymentDetails = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeId);
-      if(empty($paymentDetails['id'])){
+      if (empty($paymentDetails['id'])){
         // we can assume this pledge is now completed
         // return now so we don't create a core error & roll back
         return;
index e2736d9d6bc0671d73113786853e863665e3513b..ac937ea4e728c0c75b026ec606ba91d82dd9cd6f 100644 (file)
@@ -98,7 +98,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
    * Set $this->_invoiceData from the input array
    */
   public function setInvoiceData() {
-    if(empty($this->_inputParameters['rp_invoice_id'])) {
+    if (empty($this->_inputParameters['rp_invoice_id'])) {
       $this->_isPaymentExpress = TRUE;
       return;
     }
@@ -121,11 +121,11 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
       // p has been overloaded & could mean contribution page or participant id. Clearly we need an
       // alphabet with more letters.
       // the mode will always be resolved before the mystery p is reached
-      if($rpValueArray[1] == 'contribute') {
+      if ($rpValueArray[1] == 'contribute') {
         $mapping['p'] = 'contribution_page_id';
       }
     }
-    if(empty($this->_inputParameters['component'])) {
+    if (empty($this->_inputParameters['component'])) {
       $this->_isPaymentExpress = TRUE;
     }
   }
@@ -225,7 +225,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
     $contributionStatuses = $contributionStatuses['values'];
     switch ($txnType) {
       case 'recurring_payment_profile_created':
-        if(in_array($recur->contribution_status_id, array(array_search('Pending', $contributionStatuses), array_search('In Progress', $contributionStatuses)))
+        if (in_array($recur->contribution_status_id, array(array_search('Pending', $contributionStatuses), array_search('In Progress', $contributionStatuses)))
         && !empty($recur->processor_id)) {
           echo "already handled";
           return;
@@ -248,7 +248,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
 
         //contribution installment is completed
         if ($this->retrieve('profile_status', 'String') == 'Expired') {
-          if(!empty($recur->end_date)) {
+          if (!empty($recur->end_date)) {
             echo "already handled";
             return;
           }
@@ -390,7 +390,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
   public function main() {
     CRM_Core_Error::debug_var('GET', $_GET, TRUE, TRUE);
     CRM_Core_Error::debug_var('POST', $_POST, TRUE, TRUE);
-    if($this->_isPaymentExpress) {
+    if ($this->_isPaymentExpress) {
       $this->handlePaymentExpress();
       return;
     }
@@ -526,12 +526,12 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr
     $objects = $ids = $input = array();
     $isFirst = FALSE;
     $input['txnType']  = $this->retrieve('txn_type', 'String');
-    if($input['txnType'] != 'recurring_payment') {
+    if ($input['txnType'] != 'recurring_payment') {
       throw new CRM_Core_Exception('Paypal IPNS not handled other than recurring_payments');
     }
     $input['invoice'] = self::getValue('i', FALSE);
     $this->getInput($input, $ids);
-    if($this-> transactionExists($input['trxn_id'])) {
+    if ($this-> transactionExists($input['trxn_id'])) {
       throw new CRM_Core_Exception('This transaction has already been processed');
     }
 
@@ -542,7 +542,7 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr
 
     $ids['contribution'] = $result['id'];
     //@todo hard - coding 'pending' for now
-    if($result['contribution_status_id'] == 2) {
+    if ($result['contribution_status_id'] == 2) {
       $isFirst = TRUE;
     }
     // arg api won't get this - fix it
@@ -567,7 +567,7 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr
    * @param string $trxn_id
    */
   public function transactionExists($trxn_id) {
-    if(CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_contribution WHERE trxn_id = %1",
+    if (CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_contribution WHERE trxn_id = %1",
       array(
         1 => array($trxn_id, 'String')
       ))) {
index 29a58e381c6a08f3d96069f085da1177acca21a7..05cdc7d335ae52db7fdd77712b078edb0f692f89 100644 (file)
@@ -120,9 +120,9 @@ class CRM_Core_Permission {
     $permissions = (array) $permissions;
 
     foreach ($permissions as $permission) {
-      if(is_array($permission)) {
+      if (is_array($permission)) {
         foreach ($permission as $orPerm) {
-          if(self::check($orPerm)) {
+          if (self::check($orPerm)) {
             //one of our 'or' permissions has succeeded - stop checking this permission
             return TRUE;;
           }
@@ -131,7 +131,7 @@ class CRM_Core_Permission {
         return FALSE;
       }
       else {
-        if(!CRM_Core_Config::singleton()->userPermissionClass->check($permission)) {
+        if (!CRM_Core_Config::singleton()->userPermissionClass->check($permission)) {
           //one of our 'and' conditions has not been met
           return FALSE;
         }
@@ -357,8 +357,8 @@ class CRM_Core_Permission {
    * @return array|null
    */
   public static function event($type = CRM_Core_Permission::VIEW, $eventID = NULL, $context = '') {
-    if(!empty($context)) {
-      if(CRM_Core_Permission::check($context)) {
+    if (!empty($context)) {
+      if (CRM_Core_Permission::check($context)) {
         return TRUE;
       }
     }
index b98112281c56e273363f488419ed9d83342e84da..0c87db1fe0c52b954b2fdd106870c62df8c556eb 100644 (file)
@@ -81,7 +81,7 @@ class CRM_Core_Permission_Joomla extends CRM_Core_Permission_Base {
     }
 
     list ($civiPrefix, $name) = CRM_Utils_String::parsePrefix(':', $perm, NULL);
-    switch($civiPrefix) {
+    switch ($civiPrefix) {
       case 'Joomla':
         return explode(':', $name);
 
index 26000e203b02138b5663afd2d08a17cbedd8dfae..cf9ca258a6a20edfd9e72d1d05db4fac193b14e0 100644 (file)
@@ -295,7 +295,7 @@ class CRM_Core_PseudoConstant {
       $pseudoconstant = $fieldSpec['pseudoconstant'];
 
       // if callback is specified..
-      if(!empty($pseudoconstant['callback'])) {
+      if (!empty($pseudoconstant['callback'])) {
         list($className, $fnName) = explode('::', $pseudoconstant['callback']);
         if (method_exists($className, $fnName)) {
           return call_user_func(array($className, $fnName));
@@ -310,7 +310,7 @@ class CRM_Core_PseudoConstant {
       );
 
       // Fetch option group from option_value table
-      if(!empty($pseudoconstant['optionGroupName'])) {
+      if (!empty($pseudoconstant['optionGroupName'])) {
         if ($context == 'validate') {
           $params['labelColumn'] = 'name';
         }
index 25d37829e44c8d21eff87492ef2d61030168d38d..8ba4f7faa2fed5a124fdd4aa8e69bd6de547aba4 100644 (file)
@@ -173,7 +173,7 @@ class CRM_Core_Region {
       if ($snippet['disabled']) {
         continue;
       }
-      switch($snippet['type']) {
+      switch ($snippet['type']) {
         case 'markup':
           $html .= $snippet['markup'];
           break;
index e638069085b7d5878c326c12fa9aa5c0cbe43082..603a472980fa471af444fc1ab64265e3db8c9b20 100644 (file)
@@ -156,7 +156,7 @@ class CRM_Custom_Import_Parser_Api extends CRM_Custom_Import_Parser {
     $setDateFields = array_intersect_key($this->_params, array_flip($this->_dateFields));
 
     CRM_Contact_Import_Parser_Contact::formatCommonData($this->_params, $formatted, $formatted);
-    foreach($formatted['custom'] as $key => $val) {
+    foreach ($formatted['custom'] as $key => $val) {
       $this->_params['custom_'.$key] = $val[-1]['value'];
     }
     $this->_params['skipRecentView'] = TRUE;
index 5607c5d4dfe6784c05ea203657a4b2a510f1fd11..ee56688353131cab8a96dbecbed304b96a39c54b 100644 (file)
@@ -14,7 +14,7 @@ class CRM_Dedupe_BAO_QueryBuilder {
   public static function internalFilters($rg, $strID1 = 'contact1.id', $strID2 = 'contact2.id') {
     // Add a contact id filter for dedupe by group requests and add logic
     // to remove duplicate results with opposing orders, i.e. 1,2 and 2,1
-    if!empty($rg->contactIds) ) {
+    if (!empty($rg->contactIds) ) {
       $cids = implode(',', $rg->contactIds);
       return "($strID1 IN ($cids) AND ( $strID2 NOT IN ($cids) OR ($strID2 IN ($cids) AND $strID1 < $strID2) ))";
     }
index 2934f8a20f2b2a2f2f59007ad06978d89fd277ec..565c685cff935d7051d0935eb869ea78e25030a2 100644 (file)
@@ -274,7 +274,7 @@ WHERE
         'extends' => array('IN' => array('Individual', 'Organization', 'Household', 'Contact')),
         'return' => array('id', 'title', 'table_name', 'style'),
       ));
-      foreach($result['values'] as $custom) {
+      foreach ($result['values'] as $custom) {
         $data['cidRefs'][$custom['table_name']] = array('entity_id');
         $urlSuffix = $custom['style'] == 'Tab' ? '&selectedChild=custom_' . $custom['id'] : '';
         $data['relTables']['rel_table_custom_' . $custom['id']] = array(
index 8e8c59682d8cef78054d1efd51c65d6d9b1764e6..4a2008823b2db4605dfb90cc405140cd154ec13c 100644 (file)
@@ -74,7 +74,7 @@ class CRM_Event_BAO_ParticipantPayment extends CRM_Event_DAO_ParticipantPayment
     //generally if people are creating participant_payments via the api they won't be setting the line item correctly - we can't help them if they are doing complex transactions
     // but if they have a single line item for the contribution we can assume it should refer to the participant line
     $lineItemCount = CRM_Core_DAO::singleValueQuery("select count(*) FROM civicrm_line_item WHERE contribution_id = %1", array(1 => array($participantPayment->contribution_id, 'Integer')));
-    if($lineItemCount == 1) {
+    if ($lineItemCount == 1) {
       $sql = "UPDATE civicrm_line_item li
       SET entity_table = 'civicrm_participant', entity_id = %1
       WHERE contribution_id = %2 AND entity_table = 'civicrm_contribution'";
index a40e68ec84a33a7d8320c8a97d9f2d888ea21d30..79fd0198b5df3dd4d7a7b2e524bfa10fc4759c7b 100644 (file)
@@ -263,7 +263,7 @@ class CRM_Event_BAO_Query {
         //Get parent of this event
         $exEventId = '';
         if ($query->_where[$grouping]) {
-          foreach($query->_where[$grouping] as $key => $val) {
+          foreach ($query->_where[$grouping] as $key => $val) {
             if (strstr($val, 'civicrm_event.id =')) {
               $exEventId = $val;
               $extractEventId = explode(" ", $val);
@@ -279,7 +279,7 @@ class CRM_Event_BAO_Query {
         if ($thisEventHasParent) {
           $getAllConnections = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($thisEventHasParent, 'civicrm_event');
           $allEventIds = array();
-          foreach($getAllConnections as $key => $val) {
+          foreach ($getAllConnections as $key => $val) {
             $allEventIds[] = $val['id'];
           }
           if (!empty($allEventIds)) {
index f0cf91d1ed4e528931c4f26d7a0cc7720c472707..c5fe459e518976d74f7b844ecda4f22a24206a80 100644 (file)
@@ -234,7 +234,7 @@ class CRM_Event_Form_EventFees {
       $contribution = new CRM_Contribute_DAO_Contribution();
       $contribution->id = $contriId;
       $contribution->find( TRUE );
-      foreacharray('financial_type_id', 'payment_instrument_id', 'contribution_status_id', 'receive_date', 'total_amount' ) as $f ) {
+      foreach (array('financial_type_id', 'payment_instrument_id', 'contribution_status_id', 'receive_date', 'total_amount' ) as $f ) {
         if ($f == 'receive_date') {
           list($defaults[$form->_pId]['receive_date']) = CRM_Utils_Date::setDateDefaults($contribution->$f);
         }
index 8437c35669b993b3d8164186cc199ff35bba612a..b2513a9c6e1236f056bc9fd178255eef0eb78b3f 100644 (file)
@@ -761,7 +761,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
                 //create discount priceset
                 $priceField = CRM_Price_BAO_PriceField::create($fieldParams);
                 if (!empty($discountFieldIDs[$j])) {
-                  foreach($discountFieldIDs[$j] as $fID){
+                  foreach ($discountFieldIDs[$j] as $fID){
                     CRM_Price_BAO_PriceFieldValue::setIsActive($fID, '0');
                   }
                 }
index 707c2d5f65d8ca655db47b4295001b71fbfa35e2..92bb3c205daf9369b845a00577396f59ae6ba362 100644 (file)
@@ -764,7 +764,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent
 
           // check each of the fields in the index against the profile field
           foreach ($index as $ifield => $icombos) {
-            if(strpos($field['name'], $ifield) !== FALSE) {
+            if (strpos($field['name'], $ifield) !== FALSE) {
 
               // we found the field in the profile, now record it in the index
               foreach ($icombos as $icombo => $dontcare) {
@@ -982,7 +982,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent
         $cantDedupe = ts("The selected profiles can collect enough information to match registrations with existing contacts, but not all of the relevant fields are required.  Anonymous registrations may result in duplicate contacts.");
     }
     if (!empty($params['is_multiple_registrations'])) {
-      switch(self::canProfilesDedupe($additionalProfileIds, $rgId)) {
+      switch (self::canProfilesDedupe($additionalProfileIds, $rgId)) {
         case 0:
           $dedupeTitle = 'Duplicate Matching Impossible';
           if ($cantDedupe) {
index 18add1a8e75661175d1437fc238b291d3281c22a..767cc0b35cfb58416d628b1f0438cdafe8cdcf11 100644 (file)
@@ -39,7 +39,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent {
       $allEventIdsArray = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($checkParentExistsForThisId, 'civicrm_event');
       $allEventIds = array();
       if (!empty($allEventIdsArray)) {
-        foreach($allEventIdsArray as $key => $val) {
+        foreach ($allEventIdsArray as $key => $val) {
           $allEventIds[] = $val['id'];
         }
         if (!empty($allEventIds)) {
@@ -53,7 +53,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent {
 
           $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');
           $permissions = CRM_Event_BAO_Event::checkPermission();
-          while($dao->fetch()) {
+          while ($dao->fetch()) {
             if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
               $manageEvent[$dao->id] = array();
               CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
@@ -183,7 +183,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent {
           GROUP BY p.event_id";
         $dao = CRM_Core_DAO::executeQuery($query);
         $participantDetails = array();
-        while($dao->fetch()) {
+        while ($dao->fetch()) {
           $participantDetails['countByID'][$dao->event_id] = $dao->participant_count;
           $participantDetails['countByName'][$dao->event_id][$dao->event_data] = $dao->participant_count;
         }
index 5a800e35964f5dc543db02dad4ec25b4e1cf10e6..24e5b742b453b8fcc98c589e29398246672d7781 100644 (file)
@@ -543,7 +543,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
       $eventID = $_POST['event_id'];
     }
 
-    if($this->_eID) {
+    if ($this->_eID) {
       $eventID = $this->_eID;
       //@todo - rationalise the $this->_eID with $POST['event_id'],  $this->_eid is set when eid=x is in the url
       $roleID = CRM_Core_DAO::getFieldValue(
@@ -551,7 +551,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
         $this->_eID,
         'default_role_id'
       );
-      if(empty($roleIDs)) {
+      if (empty($roleIDs)) {
         $roleIDs = (array) $defaults[$this->_id]['participant_role_id'] = $roleID;
       }
       $defaults[$this->_id]['event_id'] = $eventID;
@@ -561,7 +561,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
     }
     //these should take precedence so we state them last
     $urlRoleIDS = CRM_Utils_Request::retrieve('roles', 'String');
-    if($urlRoleIDS) {
+    if ($urlRoleIDS) {
       $roleIDs = explode(',', $urlRoleIDS);
     }
     if (isset($roleIDs)) {
@@ -844,15 +844,15 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
     }
     // For single additions - show validation error if the contact has already been registered
     // for this event with the same role.
-    if($self->_single && ($self->_action & CRM_Core_Action::ADD)) {
+    if ($self->_single && ($self->_action & CRM_Core_Action::ADD)) {
       $contactId = $self->_contactId;
       $eventId = CRM_Utils_Array::value('event_id', $values);
-      if(!empty($contactId) && !empty($eventId)) {
+      if (!empty($contactId) && !empty($eventId)) {
         $dupeCheck = new CRM_Event_BAO_Participant;
         $dupeCheck->contact_id = $contactId;
         $dupeCheck->event_id = $eventId;
         $dupeCheck->find(TRUE);
-        if(!empty($dupeCheck->id)) {
+        if (!empty($dupeCheck->id)) {
           $errorMsg['event_id'] = ts("This contact has already been assigned to this event.");
         }
       }
@@ -892,30 +892,30 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
     // removed automatically and the user receives one notification.
     if ($this->_action & CRM_Core_Action::ADD) {
       $event_id = $this->_eventId;
-      if(empty($event_id) && !empty($params['event_id'])) {
+      if (empty($event_id) && !empty($params['event_id'])) {
         $event_id = $params['event_id'];
       }
-      if(!$this->_single && !empty($event_id)) {
+      if (!$this->_single && !empty($event_id)) {
         $duplicateContacts = 0;
-        while(list($k, $dupeCheckContactId) = each($this->_contactIds)) {
+        while (list($k, $dupeCheckContactId) = each($this->_contactIds)) {
           // Eliminate contacts that have already been assigned to this event.
           $dupeCheck = new CRM_Event_BAO_Participant;
           $dupeCheck->contact_id = $dupeCheckContactId;
           $dupeCheck->event_id = $event_id;
           $dupeCheck->find(TRUE);
-          if(!empty($dupeCheck->id)) {
+          if (!empty($dupeCheck->id)) {
             $duplicateContacts++;
             unset($this->_contactIds[$k]);
           }
         }
-        if($duplicateContacts > 0) {
+        if ($duplicateContacts > 0) {
           $msg = ts(
             "%1 contacts have already been assigned to this event. They were not added a second time.",
             array(1 => $duplicateContacts)
           );
           CRM_Core_Session::setStatus($msg);
         }
-        if(count($this->_contactIds) == 0) {
+        if (count($this->_contactIds) == 0) {
           CRM_Core_Session::setStatus(ts("No participants were added."));
           return;
         }
index a80d8f7d32ab0ff462a28345c5c6e677f90f334d..a88596a293d4fba4f5485c4c2cfc538e74b0a7fe 100644 (file)
@@ -134,7 +134,7 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form {
       $defaults[$this->_participantId] = array_merge($defaults[$this->_participantId], $priceSetValues);
     }
     else {
-      foreach($priceFieldId as $key => $value) {
+      foreach ($priceFieldId as $key => $value) {
         if (!empty($value) && ($this->_values['fee'][$value]['html_type'] == 'Radio' || $this->_values['fee'][$value]['html_type'] == 'Select') && !$this->_values['fee'][$value]['is_required']) {
           $defaults[$this->_participantId]['price_'.array_keys($this->_values['fee'])[$key]] = 0;
         }
@@ -249,7 +249,7 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form {
 
     // update participant
     CRM_Core_DAO::setFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'status_id', $params['status_id']);
-    if(!empty($params['note'])) {
+    if (!empty($params['note'])) {
       $noteParams = array(
         'entity_table' => 'civicrm_participant',
         'note' => $params['note'],
index 031f6709238d1b1652e9002d984ed9f113f763a7..406cce15c4fdc87118fb17fe46bc9092315daa45 100644 (file)
@@ -1159,7 +1159,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
         'contact_type'
       );
 
-      if(array_key_exists('contact_id', $params) && empty($params['contact_id'])) {
+      if (array_key_exists('contact_id', $params) && empty($params['contact_id'])) {
         // we unset this here because the downstream function ignores the contactID we give it
         // if it is set & it is difficult to understand the implications of 'fixing' this downstream
         // but if we are passing a contact id into this function it's reasonable to assume we don't
index 0a397fafb6a2b10dc095fa2958677300fc0b525b..2f910888e0af9d01e75ee8683289d9e758c6a70a 100644 (file)
@@ -410,13 +410,13 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     $onlinePaymentProcessorEnabled = FALSE;
     if (!empty($this->_paymentProcessors)) {
       foreach ($this->_paymentProcessors as $key => $name) {
-        if($name['billing_mode'] == 1) {
+        if ($name['billing_mode'] == 1) {
           $onlinePaymentProcessorEnabled = TRUE;
         }
         $pps[$key] = $name['name'];
       }
     }
-    if($this->getContactID() === '0' && !$this->_values['event']['is_multiple_registrations']) {
+    if ($this->getContactID() === '0' && !$this->_values['event']['is_multiple_registrations']) {
       //@todo we are blocking for multiple registrations because we haven't tested
       $this->addCidZeroOptions($onlinePaymentProcessorEnabled);
     }
index f0b8a96840b2be2234d5d78547795e80b3954fb4..ca9037a79d1f95c74d80cc1792e37a5448286765 100644 (file)
@@ -299,7 +299,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser {
             $params[$key] = CRM_Utils_String::strtoboolstr($val);
           }
         }
-        if($key == 'participant_register_date') {
+        if ($key == 'participant_register_date') {
           CRM_Utils_Date::convertToDefaultDate($params, $dateType, 'participant_register_date');
           $formatted['participant_register_date'] = CRM_Utils_Date::processDate($params['participant_register_date']);
         }
index c704ca3a8e812ab7053c1f19bc15435867fac9f9..cd0ac30fcfe313476b53d88a9c58dc14d1b2033e 100644 (file)
@@ -139,7 +139,7 @@ class CRM_Event_Task {
         unset(self::$_tasks[1]);
       }
       //CRM-12920 - check for edit permission
-      if!CRM_Core_Permission::check('edit event participants') ){
+      if (!CRM_Core_Permission::check('edit event participants') ){
         unset(self::$_tasks[4], self::$_tasks[5], self::$_tasks[15]);
       }
     }
index 26d6b1557c26afefdb9578a66ee31154be370ae7..a9698a52877283f5f9c27602a2b7382f54842261 100644 (file)
@@ -64,7 +64,7 @@ class CRM_Extension_Downloader {
   public function checkRequirements() {
     $errors = array();
 
-    if (!$this->containerDir || !is_dir($this->containerDir) || !is_writeable($this->containerDir)) {
+    if (!$this->containerDir || !is_dir($this->containerDir) || !is_writable($this->containerDir)) {
       $civicrmDestination = urlencode(CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1'));
       $url = CRM_Utils_System::url('civicrm/admin/setting/path', "reset=1&civicrmDestination=${civicrmDestination}");
       $errors[] = array(
index 021b3a6e625a9cd76aaf54505cb96fcc2b395d3d..bdc93a0ae3ad0feb781ea674654ff6f7e61d67a1 100644 (file)
@@ -238,7 +238,7 @@ class CRM_Extension_System {
 
       // boolean false means don't try to check extensions
       // http://issues.civicrm.org/jira/browse/CRM-10575
-      if($url === FALSE) {
+      if ($url === FALSE) {
         $this->_repoUrl = FALSE;
       }
       else {
index 93142945a32ce6be2b79e3565e1ebb5390d96de5..bbb82aa04e08263badb0c309ee53368ec6166d13 100644 (file)
@@ -64,7 +64,7 @@ class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat
   public function export($exportParams) {
     parent::export( $exportParams );
 
-    foreachself::$complementaryTables as $rct ) {
+    foreach (self::$complementaryTables as $rct ) {
       $func = "export{$rct}";
       $this->$func();
     }
@@ -348,7 +348,7 @@ class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat
     // In all cases need to do something with tabs in the input.
 
     $s1 = str_replace( self::$SEPARATOR, '\t', $s );
-    switch$type ) {
+    switch ($type ) {
       case 'date':
         $sout = date( 'Y/m/d', strtotime( $s1 ) );
         break;
index a48a31233aa04aa9e6855ffe502f6922b5ac865d..a8a15e9fde2085f975ba63b479fb854f4563f63b 100644 (file)
@@ -96,7 +96,7 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco
    * @return object
    */
   public static function add(&$params, &$ids = array()) {
-    if(empty($params['id'])) {
+    if (empty($params['id'])) {
       $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
       $params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, FALSE);
       $params['is_tax'] = CRM_Utils_Array::value('is_tax', $params, FALSE);
index f8d4e9fdad1665f57f002d6b80a6ee47a64c321d..d0fcc8179b071d4e03d61e46c05e3586df2661fc 100644 (file)
@@ -96,7 +96,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
    * @return object
    */
   public static function add(&$params, &$ids = array()) {
-    if(empty($params['id'])) {
+    if (empty($params['id'])) {
       $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
       $params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, FALSE);
       $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
index 4a9ddc5708ead484c7ed062e01c8af7c69856061..efa2bbc468087ea5b08b0c5dc5d0882f52b09598 100644 (file)
@@ -75,7 +75,7 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
       if (!empty($_GET['batch_id'])) {
         //validate batch ids
         $batchIds = explode(',', $_GET['batch_id']);
-        foreach($batchIds as $batchId) {
+        foreach ($batchIds as $batchId) {
           CRM_Utils_Type::validate($batchId, 'Positive');
         }
 
@@ -99,7 +99,7 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
     //check if batch status is valid, do not allow exported batches to export again
     $batchStatus = CRM_Batch_BAO_Batch::getBatchStatuses($this->_batchIds);
 
-    foreach$batchStatus as $batchStatusId ) {
+    foreach ($batchStatus as $batchStatusId ) {
       if ($batchStatusId == $this->_exportStatusId) {
         CRM_Core_Error::fatal(ts('You cannot exported the batches which were exported earlier.'));
       }
@@ -176,7 +176,7 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
     $batchParams['status_id'] = $this->_exportStatusId;
 
     $ids = array();
-    foreach($batchIds as $batchId) {
+    foreach ($batchIds as $batchId) {
       $batchParams['id'] = $ids['batchID'] = $batchId;
       // Update totals
       $batchParams = array_merge($batchParams, $totals[$batchId]);
index 0fb7a49d733d555d26de6a89c39a2282c5223225..a7add5d1172ca09457ca6b7254a3cd5d405cbef2 100644 (file)
@@ -149,7 +149,7 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic {
       $params['entity_table'] = 'civicrm_financial_type';
       CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, CRM_Core_DAO::$_nullArray, $financialAccountIds);
 
-      foreach$financialAccountIds as $key => $values){
+      foreach ($financialAccountIds as $key => $values){
         if (!empty($financialAccounts[$values['financial_account_id']])) {
           $financialAccountId[$values['financial_account_id']] = CRM_Utils_Array::value(
             $values['financial_account_id'], $financialAccounts );
index b3b33763e755cb6c67b3d2da173245886b627f30..7873796c1804a214343c8592bb4c4d62f81793e9 100644 (file)
@@ -208,7 +208,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
 
     $grantTypes = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id');
     if (empty($params['skipRecentView'])) {
-      if(!isset($grant->contact_id) || !isset($grant->grant_type_id)){
+      if (!isset($grant->contact_id) || !isset($grant->grant_type_id)){
         $grant->find(TRUE);
       }
       $title = CRM_Contact_BAO_Contact::displayName($grant->contact_id) . ' - ' . ts('Grant') . ': ' . $grantTypes[$grant->grant_type_id];
index 0f265f2e80e0603bc9406e5e3b0a6243952d1b0d..cf29d36424dadc13a47f497e99349f964424e2df 100644 (file)
@@ -199,7 +199,7 @@ class CRM_Grant_BAO_Query {
           }
         }
         if (!empty($val)) {
-          foreach($val as $id) {
+          foreach ($val as $id) {
             $names[] = CRM_Utils_Array::value($id, $grantTypes);
           }
         }
@@ -232,7 +232,7 @@ class CRM_Grant_BAO_Query {
           }
         }
         if (!empty($val)) {
-          foreach($val as $id) {
+          foreach ($val as $id) {
             $names[] = CRM_Utils_Array::value($id, $grantStatus);
           }
         }
index 86aa51b19677089229749fb9a5d3efd48caa0d62..a5ed2d72b14d6bf51301fbe4e86317df68118d27 100644 (file)
@@ -97,7 +97,7 @@ class CRM_Group_Page_AJAX {
       //add setting so this can be tested by unit test
       //@todo - ideally the portion of this that retrieves the groups should be extracted into a function separate
       // from the one which deals with web inputs & outputs so we have a properly testable & re-usable function
-      if(!empty($params['is_unit_test'])) {
+      if (!empty($params['is_unit_test'])) {
         return array($groups, $iFilteredTotal);
       }
       echo CRM_Utils_JSON::encodeDataTableSelector($groups, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
index fb921c9d62b43e9c0703b3ffd2d9fe426dfc156d..94a4c3f8c0c270c12839326d0f608669ec47ec6f 100644 (file)
@@ -160,7 +160,7 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
     // the record that comes last that counts. That's because we are
     // INSERT'ing INTO a table with a primary id so that last record
     // over writes any previous record.
-    switch($email_selection_method) {
+    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,
@@ -2645,7 +2645,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
       $tokens = array_merge(CRM_Core_SelectValues::contributionTokens(), $tokens);
     }
 
-    if(method_exists($form, 'listTokens')) {
+    if (method_exists($form, 'listTokens')) {
       $tokens = array_merge($form->listTokens(), $tokens);
     }
 
index 0d6458d1defe05514012f4baeb91abc648ba1b1e..473fc84c954c4b31c06870c7c05080a95085d359 100644 (file)
@@ -85,7 +85,7 @@ class CRM_Mailing_BAO_TrackableURL extends CRM_Mailing_DAO_TrackableURL {
 
       $tracker->url = $url;
       $tracker->mailing_id = $mailing_id;
-      if(strlen($tracker->url) > 254) {
+      if (strlen($tracker->url) > 254) {
         return $url;
       }
       if (!$tracker->find(TRUE)) {
index cb381ab1bd453ac62a2aa5f1757b366f63423678..e2d6e9a76d42166c52ed187fd88d67d7a7ec5e2f 100644 (file)
@@ -303,7 +303,7 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
 
     $this->assign('groupCount', count($groups));
     $this->assign('mailingCount', count($mailings));
-    if(count($groups) == 0 && count($mailings) == 0 && !$this->_searchBasedMailing) {
+    if (count($groups) == 0 && count($mailings) == 0 && !$this->_searchBasedMailing) {
       CRM_Core_Error::statusBounce("To send a mailing, you must have a valid group of recipients - either at least one group that's a Mailing List or at least one previous mailing or start from a search");
     }
   }
index 996028525caf6403550a0f6a999f1f8363147849..b59b388657842dab9cf45dc7a2da172513f9505b 100644 (file)
@@ -55,7 +55,7 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form {
     $ssID = $this->get('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){
+    if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){
       $params = array();
       $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
       $this->assign("value", $result);
index 0d15ca5b47ce17c767a6b214be894999c283446d..824284858aa68f85c9625b5f5117d7b6918f685e 100644 (file)
@@ -48,7 +48,7 @@ class CRM_Mailing_Form_Settings extends CRM_Core_Form {
     $ssID = $this->get('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){
+    if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){
       $params = array();
       $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
       $this->assign("value", $result);
index da8146db103df852f7f90913741b5ceeb9b61634..30bb49ab5f3b3e943b0a81c712fb68baa59d97c0 100644 (file)
@@ -48,7 +48,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form {
     $ssID = $this->get('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){
+    if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){
       $params = array();
       $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
       $this->assign("value", $result);
index 9d0c91b1c6f979b1716b86081a39c076a075fdd8..ee11d3a02c767c503539cb4f552993108659848b 100644 (file)
@@ -50,7 +50,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
     $ssID = $this->get('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){
+    if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){
       $params = array();
       $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
       $this->assign("value", $result);
index d875889f40bab7ae7a3182b4d24e7431e34179b7..a679e9a8ce2f68e82ee53c71229d4a812061528b 100644 (file)
@@ -95,7 +95,7 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus {
    */
   public static function create($params){
     $ids = array();
-    if(!empty($params['id'])){
+    if (!empty($params['id'])){
       $ids['membershipStatus']  = $params['id'];
     }
     else{
index 8583da38ce925a6ef978cbb0ee6b252e2c03d7e0..753a4f8172beda5913289713c9a5d3bac7ba47ef 100644 (file)
@@ -304,7 +304,7 @@ class CRM_Member_BAO_Query {
         $names = array();
         $membershipTypes = CRM_Member_PseudoConstant::membershipType();
         foreach ($value as $id => $dontCare) {
-          if(!empty($membershipTypes[$id])) {
+          if (!empty($membershipTypes[$id])) {
             $names[] = $membershipTypes[$id];
           }
         }
index 7a46b74d10c0e83c198f483b9305febbafe86994..33b33294944d301e544cb58e5c3e49199b5dee54 100644 (file)
@@ -884,7 +884,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
             ));
             $tmp_statuses = $result['values'];
             $status_ids = array();
-            foreach($tmp_statuses as $cur_stat) {
+            foreach ($tmp_statuses as $cur_stat) {
               $status_ids[] = $cur_stat['id'];
             }
             if (empty($params['status_id']) || in_array( $params['status_id'], $status_ids) == FALSE) {
index 264692408f1f91cb5e6dbce5860504c80bf5bd9f..43884b48f137082272abfc123f162d6cb3bfadf1 100644 (file)
@@ -154,7 +154,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
             $autoRenewOptions = array(ts('Not offered'), ts('Give option'), ts('Required'));
             $this->addElement('select', "auto_renew_$k", ts('Auto-renew'), $autoRenewOptions);
             //CRM-15573
-            if($autoRenew == 2) {
+            if ($autoRenew == 2) {
               $this->freeze("auto_renew_$k");
               $params['id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipBlock', $this->_id, 'id', 'entity_id');
             }
@@ -239,7 +239,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
 
         if (!empty($paymentProcessorId)) {
           $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, NULL, 'name');
-          foreach($paymentProcessorId as $pid) {
+          foreach ($paymentProcessorId as $pid) {
             if ($pid) {
               $paymentProcessorTypeId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor',
                 $pid, 'payment_processor_type_id'
index b54420d99ab76aafb9fc69b9cee78e7f21c4ea52..c5ca5d063cab5cf2ebcce6b08a86173bdd61ba93 100644 (file)
@@ -267,7 +267,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
     // auto renew options if enabled for the membership
     $options = CRM_Core_SelectValues::memberAutoRenew();
 
-    foreach$allMemberships as $key => $values ) {
+    foreach ($allMemberships as $key => $values ) {
       if (!empty($values['is_active'])) {
         $membershipType[$key] = CRM_Utils_Array::value('name', $values);
         if ($this->_mode && empty($values['minimum_fee'])) {
@@ -698,7 +698,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
       }
 
       //assign contribution contact id to the field expected by recordMembershipContribution
-      if($this->_contributorContactID != $this->_contactID){
+      if ($this->_contributorContactID != $this->_contactID){
         $formValues['contribution_contact_id'] = $this->_contributorContactID;
         if (!empty($this->_params['soft_credit_type_id'])){
           $formValues['soft_credit'] = array(
index 32d19a21a3852d05ff88a6228d43e212d46defc8..179685e37d2b89f0e6a7eeabea553283bc61e60c 100644 (file)
@@ -92,7 +92,7 @@ class CRM_Member_Form_Task_Label extends CRM_Member_Form_Task {
     $mergeSameAddress = CRM_Utils_Array::value('merge_same_address', $formValues);
     $mergeSameHousehold = CRM_Utils_Array::value('merge_same_household', $formValues);
     $isPerMembership = CRM_Utils_Array::value('per_membership', $formValues);
-    if($isPerMembership && ($mergeSameAddress || $mergeSameHousehold)) {
+    if ($isPerMembership && ($mergeSameAddress || $mergeSameHousehold)) {
       // this shouldn't happen  - perhaps is could if JS is disabled
       CRM_Core_Session::setStatus(ts('As you are printing one label per membership your merge settings are being ignored'));
       $mergeSameAddress = $mergeSameHousehold = FALSE;
@@ -127,7 +127,7 @@ class CRM_Member_Form_Task_Label extends CRM_Member_Form_Task {
       $rows[$id] = array($formatted);
     }
 
-    if($isPerMembership) {
+    if ($isPerMembership) {
       $labelRows = array();
       $memberships = civicrm_api3('membership', 'get', array('id' => array('IN' => $this->_memberIds), 'return' => 'contact_id'));
       foreach ($memberships['values'] as $id => $membership) {
index b5eb6244a1beb7e070e4fb909559f47aa3435762..25185a91d0e3652102bd7112c8cfd5859865afca 100644 (file)
@@ -648,12 +648,12 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser {
       if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
         $values[$key] = $value;
         $type = $customFields[$customFieldID]['html_type'];
-        if$type == 'CheckBox' || $type == 'Multi-Select' || $type == 'AdvMulti-Select') {
+        if ($type == 'CheckBox' || $type == 'Multi-Select' || $type == 'AdvMulti-Select') {
           $mulValues = explode( ',', $value );
           $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE);
           $values[$key] = array();
-          foreach$mulValues as $v1 ) {
-            foreach($customOption as $customValueID => $customLabel) {
+          foreach ($mulValues as $v1 ) {
+            foreach ($customOption as $customValueID => $customLabel) {
               $customValue = $customLabel['value'];
               if (( strtolower($customLabel['label']) == strtolower(trim($v1)) ) ||
                 ( strtolower($customValue) == strtolower(trim($v1)) )) {
index f96d8a09f9258880a21c1ddd851bcfd4cb54ac99..f578c4c6f98292dd16b0164938164f709a0a0497 100644 (file)
@@ -50,7 +50,7 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page {
     //CRM-13901 don't show dashboard to contacts with limited view writes & it does not relect
     //what they have access to
     //@todo implement acls on dashboard querys (preferably via api to enhance that at the same time)
-    if(!CRM_Core_Permission::check(array('view all contacts', 'edit all contacts'))) {
+    if (!CRM_Core_Permission::check(array('view all contacts', 'edit all contacts'))) {
       $this->showMembershipSummary = FALSE;
       $this->assign('membershipSummary', FALSE);
       return;
index bb28abbe3ce55798123bc2fd7e2e228fab136ded..2509e040e5cac0f031c007884eb354e9a7011e05 100644 (file)
@@ -118,7 +118,7 @@ class CRM_Member_Task {
         unset(self::$_tasks[1]);
       }
       //CRM-12920 - check for edit permission
-      if!CRM_Core_Permission::check('edit memberships') ){
+      if (!CRM_Core_Permission::check('edit memberships') ){
         unset(self::$_tasks[5]);
       }
     }
index b03aa3ee6fa077b090eb6a6cb2f8d331012b20b3..66b74e8e9d46533e4fcd2adae1592ce8785c57bf 100644 (file)
@@ -442,14 +442,14 @@ WHERE pcp.id = %1 AND cc.contribution_status_id =1 AND cc.is_test = 0";
       if ($pcpInfo['page_type'] == 'event') {
         $pcp_supporter_text = ts('This event registration is being made thanks to effort of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
         $text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'event');
-        if(!empty($text)) {
+        if (!empty($text)) {
           $pcp_supporter_text .= "You can support it as well - once you complete the registration, you will be able to create your own Personal Campaign Page!";
         }
       }
       else {
         $pcp_supporter_text = ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
         $text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'contribute');
-        if(!empty($text)) {
+        if (!empty($text)) {
           $pcp_supporter_text .= "You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!";
         }
       }
index 1a7f49975dbc6637c67014b8dc3ce7466c01c99b..e62eacbdfde11f2a4f1bd57796b3de01b96b2d85 100644 (file)
@@ -387,7 +387,7 @@ AND li.entity_id = {$entityId}
         if (empty($line['entity_id'])) {
           $line['entity_id'] = $entityId;
         }
-        if(!empty($line['membership_type_id'])) {
+        if (!empty($line['membership_type_id'])) {
           $line['entity_table'] = 'civicrm_membership';
         }
         if (!empty($contributionDetails->id)) {
index 710a7b3ab04588436e463b116d3c633adc472cd6..27cfdf9974c30d551c8a5e119ce06e4009ad5a06 100644 (file)
@@ -79,7 +79,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField {
    * @static
    */
   public static function create(&$params) {
-    if(empty($params['id']) && empty($params['name'])) {
+    if (empty($params['id']) && empty($params['name'])) {
       $params['name'] = strtolower(CRM_Utils_String::munge($params['label'], '_', 242));
     }
     $transaction = new CRM_Core_Transaction();
@@ -315,7 +315,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField {
 
         $extra = array();
         if (!empty($qf->_quickConfig) && !empty($qf->_contributionAmount)) {
-          foreach($fieldOptions as &$fieldOption) {
+          foreach ($fieldOptions as &$fieldOption) {
             if ($fieldOption['name'] == 'other_amount') {
               $fieldOption['label'] = $fieldOption['label'] . '  ' . $currencySymbol;
             }
index 8f9f8e92aaa69f7844614150224ed373d9562dc7..05404c1f18b9d6f1feb8ab83fe0085eebd4d5ad1 100644 (file)
@@ -84,7 +84,7 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue {
     if (!is_array($params) || empty($params)) {
       return;
     }
-    if(!$id && empty($params['name'])) {
+    if (!$id && empty($params['name'])) {
       $params['name'] = strtolower(CRM_Utils_String::munge($params['label'], '_', 242));
     }
 
index d7c974aa402c5b072e9d11a9062a6aac60291ca7..2ce05eb47b7fd4614f7e1003c9968bc0a59bbc88 100644 (file)
@@ -64,7 +64,7 @@ class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet {
    * @static
    */
   public static function create(&$params) {
-    if(empty($params['id']) && empty($params['name'])) {
+    if (empty($params['id']) && empty($params['name'])) {
       $params['name'] = CRM_Utils_String::munge($params['title'], '_', 242);
     }
     if (!empty($params['extends']) && is_array($params['extends'])) {
@@ -587,7 +587,7 @@ WHERE  id = %1";
    * @return int
    */
   public static function getOnlyPriceFieldID(array $priceSet) {
-    if(count($priceSet['fields']) > 1) {
+    if (count($priceSet['fields']) > 1) {
       throw new CRM_Core_Exception(ts('expected only one price field to be in priceset but multiple are present'));
     }
     return (int) implode('_', array_keys($priceSet['fields']));
@@ -603,7 +603,7 @@ WHERE  id = %1";
    */
   public static function getOnlyPriceFieldValueID(array $priceSet) {
     $priceFieldID = self::getOnlyPriceFieldID($priceSet);
-    if(count($priceSet['fields'][$priceFieldID]['options']) > 1) {
+    if (count($priceSet['fields'][$priceFieldID]['options']) > 1) {
       throw new CRM_Core_Exception(ts('expected only one price field to be in priceset but multiple are present'));
     }
     return (int) implode('_', array_keys($priceSet['fields'][$priceFieldID]['options']));
@@ -1043,7 +1043,7 @@ WHERE  id = %1";
    *   Name of entity - e.g event.
    */
   public static function setPriceSets(&$params, $entity, $entityName) {
-    if(empty($params['price_set_id']) || !is_array($params['price_set_id'])) {
+    if (empty($params['price_set_id']) || !is_array($params['price_set_id'])) {
       return;
     }
     // CRM-14069 note that we may as well start by assuming more than one.
@@ -1058,7 +1058,7 @@ WHERE  id = %1";
     $pse->entity_table = 'civicrm_' . $entityName;
     $pse->entity_id = $entity->id;
     while ($pse->fetch()) {
-      if(!in_array($pse->price_set_id, $params['price_set_id'])) {
+      if (!in_array($pse->price_set_id, $params['price_set_id'])) {
         // note an even more aggressive form of this deletion currently happens in event form
         // past price sets discounts are made inaccessible by this as the discount_id is set to NULL
         // on the participant record
@@ -1375,7 +1375,7 @@ WHERE       ps.id = %1
     $priceSetId = CRM_Price_BAO_PriceSet::getFor($baoName, $id);
     if ($priceSetId) {
       $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config');
-      if($isQuickConfig) {
+      if ($isQuickConfig) {
         $copyPriceSet = &CRM_Price_BAO_PriceSet::copy($priceSetId);
         CRM_Price_BAO_PriceSet::addTo($baoName, $newId, $copyPriceSet->id);
       }
index 52262405d0c736cccbbd41ee574dab9420cf195e..bad820c4e7007a8014929acf4a98ba176586cea4 100644 (file)
@@ -241,9 +241,9 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form {
     // installments * intervals using the mysql date_add function, along
     // with the interval unit (e.g. DATE_ADD(start_date, INTERVAL 12 * 1 MONTH)
     $date_suffixes = array('relative', 'from', 'to');
-    while(list(, $suffix) = each($date_suffixes)) {
+    while (list(, $suffix) = each($date_suffixes)) {
       // Check to see if the user wants to search by calculated date.
-      if(!empty($this->_params['calculated_end_date_' . $suffix])) {
+      if (!empty($this->_params['calculated_end_date_' . $suffix])) {
         // The calculated date field is in use - spring into action
         // Gather values
         $relative = CRM_Utils_Array::value("calculated_end_date_relative", $this->_params);
index 7d8f6cb09da11d3df64b9310ce42995e0470f13a..5cbf13d54f6e4ff1f7f0eea2e24459dabb79ea6a 100644 (file)
@@ -551,7 +551,7 @@ SELECT id, title FROM civicrm_report_instance
 WHERE  report_id = %1";
       $params = array(1 => array($reportUrl, 'String'));
       $result = CRM_Core_DAO::executeQuery($sql, $params);
-      while$result->fetch()) {
+      while ($result->fetch()) {
         $instanceDetails[$reportUrl][$result->id] = $result->title . " (ID: {$result->id})";
       }
     }
index ab4d71b517f58283b8f2adcbf77fa749644cd338..fd55b05490a171ab62bc744cabb423997654445b 100644 (file)
@@ -62,7 +62,7 @@ class CRM_UF_Form_Inline_Preview extends CRM_UF_Form_AbstractPreview {
       CRM_Core_Error::fatal(ts('Permission Denied'));
     }
     $content = json_decode($_REQUEST['ufData'], TRUE);
-    foreach(array('ufGroup', 'ufFieldCollection') as $key) {
+    foreach (array('ufGroup', 'ufFieldCollection') as $key) {
       if (!is_array($content[$key])) {
         CRM_Core_Error::fatal("Missing JSON parameter, $key");
       }
index 78a354322a7a3bc2c89c0afa8e40477490cd0afe..95f44661567cfbe9835e7eba036b6c41d13b6ee1 100644 (file)
@@ -133,7 +133,7 @@ WHERE {$key}.id IS NULL";
       //CRM-11636
       //here we do the financial type check and migration
       $isDefaultsModified = self::_checkAndMigrateDefaultFinancialTypes();
-      if($isDefaultsModified) {
+      if ($isDefaultsModified) {
         $postUpgradeMessage .= '<br />' . ts('Please review all price set financial type assignments.');
       }
       list($context, $orgName) = self::createDomainContacts();
@@ -429,7 +429,7 @@ FROM   civicrm_financial_type
 WHERE name IN ('Donation', 'Event Fee', 'Member Dues');
 ";
     $daoFinancialIds = CRM_Core_DAO::executeQuery($sqlFinancialIds);
-    while($daoFinancialIds->fetch()) {
+    while ($daoFinancialIds->fetch()) {
       $financialIds[$daoFinancialIds->name] = $daoFinancialIds->id;
     }
     $sqlPriceSetUpdate = "
@@ -853,7 +853,7 @@ LEFT JOIN civicrm_loc_block clb ON clb.id = cd. loc_block_id
 LEFT JOIN civicrm_email ce ON ce.id = clb.email_id ;
 ' ;
     $dao = CRM_Core_DAO::executeQuery($query);
-    while($dao->fetch()) {
+    while ($dao->fetch()) {
       $query = "
 SELECT    cc.id FROM civicrm_contact cc
 LEFT JOIN civicrm_email ce ON ce.contact_id = cc.id
@@ -905,7 +905,7 @@ AND TABLE_SCHEMA = %1
 ";
     $params = array(1 => array($dbUf['database'], 'String'));
     $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, NULL, FALSE, FALSE);
-    foreach($tables as $columnName => $value){
+    foreach ($tables as $columnName => $value){
       if ($value['tableName'] == 'civicrm_membership_type' || $value['tableName'] == 'civicrm_contribution_recur') {
         $foreignKeyExists = CRM_Core_DAO::checkConstraintExists($value['tableName'], $value['fkey']);
         $fKey = $value['fkey'];
index 6fb33ae416e9a7ddaf6de937945e77f150aee47d..ce76d2935810579edfe2eebb13ee46a521a9fb2f 100644 (file)
@@ -181,7 +181,7 @@ INNER JOIN civicrm_price_set cps ON cps.id = cpf.price_set_id AND cps.name <>'de
                     'civicrm_event' => 'FK_civicrm_event_payment_processor_id',
                     'civicrm_group' => 'FK_civicrm_group_saved_search_id',
                     );
-    foreach($tables as $tableName => $fKey){
+    foreach ($tables as $tableName => $fKey){
       $foreignKeyExists = CRM_Core_DAO::checkConstraintExists($tableName, $fKey);
       if ($foreignKeyExists){
         CRM_Core_DAO::executeQuery("ALTER TABLE {$tableName} DROP FOREIGN KEY {$fKey}", $params, TRUE, NULL, FALSE, FALSE);
index faf4152a45d693987fd81e293bf758f2e1032ce6..cddeaba0b250fc3d8db1b0aee02d159989f5a296 100644 (file)
@@ -98,7 +98,7 @@ class CRM_Utils_API_MatchOption implements API_Wrapper {
     // If one of the options was specified, then try to match records.
     // Matching logic differs for 'create' and 'replace' actions.
     if ($keys !== NULL) {
-      switch($apiRequest['action']) {
+      switch ($apiRequest['action']) {
         case 'create':
           if (empty($apiRequest['params']['id'])) {
             $apiRequest['params'] = $this->match($apiRequest['entity'], $apiRequest['params'], $keys, $isMandatory);
@@ -117,7 +117,7 @@ class CRM_Utils_API_MatchOption implements API_Wrapper {
           ));
 
           // attempt to match each replacement item
-          foreach($apiRequest['params']['values'] as $offset => $createParams) {
+          foreach ($apiRequest['params']['values'] as $offset => $createParams) {
             $createParams = array_merge($baseParams, $createParams);
             $createParams = $this->match($apiRequest['entity'], $createParams, $keys, $isMandatory);
             $apiRequest['params']['values'][$offset] = $createParams;
index 2c26507bb65b0c7888046cd30661f0dfd73aa8e0..1e8cb66b5f3c02e90a6d29abf2e1b8b88d3282e6 100644 (file)
@@ -541,7 +541,7 @@ class CRM_Utils_Array {
     foreach (func_get_args() as $n => $key) {
       // Skip argument 0 ($items) by testing $n for truth.
       if ($n && is_array($key)) {
-        foreach($key as $k) {
+        foreach ($key as $k) {
           unset($items[$k]);
         }
       }
index 7cbc0beefcf4830f24cac4409b68a30fb1f140d2..f1d4a23f176b1c87fb84a15cadb00d1a798a4beb 100644 (file)
@@ -1277,7 +1277,7 @@ class CRM_Utils_Date {
             $quarter    = ceil($now['mon'] / 3);
             $quarter    = $quarter - $difference;
             //CRM-14550 QA Fix
-            if($quarter > 4) {
+            if ($quarter > 4) {
               $now['year'] = $now['year'] + 1;
               $quarter = 1;
             }
index 5e50e8b813e1c4fa6c48cb831cf9cbfd862043e5..25a7c0d4baacdeb9cd12c3769283cfc2c4f6f535 100644 (file)
@@ -991,7 +991,7 @@ function _civicrm_api3_deprecated_add_formatted_location_blocks(&$values, &$para
       continue;
     }
 
-    if($name == 'phone_ext'){
+    if ($name == 'phone_ext'){
       $block = 'Phone';
     }
 
@@ -1370,7 +1370,7 @@ function _civicrm_api3_deprecated_contact_check_params(
     );
 
     // contact_type has a limited number of valid values
-    if(empty($params['contact_type'])) {
+    if (empty($params['contact_type'])) {
       return civicrm_api3_create_error("No Contact Type");
     }
     $fields = CRM_Utils_Array::value($params['contact_type'], $required);
index 6860d05f7b15cfd0c232f25d407cbd9ec9d292fa..d0e62a291f3dd39d0eeac039d7074af3f7627dfb 100644 (file)
@@ -419,7 +419,7 @@ class CRM_Utils_REST {
 
     if (array_key_exists('json', $requestParams) &&  $requestParams['json'][0] == "{") {
       $params = json_decode($requestParams['json'], TRUE);
-      if($params === NULL) {
+      if ($params === NULL) {
         CRM_Utils_JSON::output(array('is_error' => 1, 'error_message', 'Unable to decode supplied JSON.'));
       }
     }
@@ -483,7 +483,7 @@ class CRM_Utils_REST {
     $tpl = 'CRM/'.$entity.'/Page/Inline/'.$tplfile.'.tpl';
     $smarty = CRM_Core_Smarty::singleton( );
     CRM_Utils_System::setTitle( "$entity::$tplfile inline $tpl" );
-    if!$smarty->template_exists($tpl) ){
+    if (!$smarty->template_exists($tpl) ){
       header("Status: 404 Not Found");
       die ("Can't find the requested template file templates/$tpl");
     }
index 2a5806ea68d09f068c82caa87eed7dcfe9df0f54..d9780608285f268f3d0a543cd9bff768621bb320 100644 (file)
@@ -246,7 +246,7 @@ abstract class CRM_Utils_System_Base {
    */
   public function setMySQLTimeZone(){
     $timeZoneOffset = $this->getTimeZoneOffset();
-    if($timeZoneOffset){
+    if ($timeZoneOffset){
       $sql = "SET time_zone = '$timeZoneOffset'";
       CRM_Core_DAO::executequery($sql);
     }
@@ -337,7 +337,7 @@ abstract class CRM_Utils_System_Base {
    * @return int $ufid - user ID of UF System
    */
   public function getBestUFID($user = NULL) {
-    if($user) {
+    if ($user) {
       return $this->getUserIDFromUserObject($user);
     }
     return $this->getLoggedInUfID();
@@ -353,7 +353,7 @@ abstract class CRM_Utils_System_Base {
    * @return string $uniqueIdentifier - unique identifier from the UF System
    */
   public function getBestUFUniqueIdentifier($user = NULL) {
-    if($user) {
+    if ($user) {
       return $this->getUniqueIdentifierFromUserObject($user);
     }
     return $this->getLoggedInUniqueIdentifier();
index 409b70fceed1d1b2d08bb68924446c635fefe50a..0dd24bb0b19399ce4c95652ed5471f8920079586 100644 (file)
@@ -64,7 +64,7 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_DrupalBase {
       $form_state['input']['pass'] = array('pass1' => $params['cms_pass'], 'pass2' => $params['cms_pass']);
     }
 
-    if(!empty($params['notify'])){
+    if (!empty($params['notify'])){
       $form_state['input']['notify'] = $params['notify'];
     }
 
index 6f8d2b82fd496724e5ad90605a087dde8e955812..b7bf37554d28a01ffdf679765f666e8b6f0a603f 100644 (file)
@@ -202,7 +202,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
         );
       }
       if (strtolower($dbEmail) == strtolower($email)) {
-        if(empty($email)) {
+        if (empty($email)) {
           $errors[$emailName] = ts('You cannot create an email account for a contact with no email',
             array(1 => $email)
           );
index 9884f47dcc4cd0f7bc696d81e215122fd5ae5266..df77f22ac5895c8d654630463fa24e6b640f568c 100644 (file)
@@ -134,7 +134,7 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base {
   public function appendCoreDirectoryToResourceBase($url) {
     global $civicrm_root;
     $lastDirectory = basename($civicrm_root);
-    if($lastDirectory != 'civicrm') {
+    if ($lastDirectory != 'civicrm') {
       return $url .= $lastDirectory . '/';
     }
     return $url;
index ffe0b4d1c717733759cb655a4ad358075dd0d676..05135adfa361db2e342f58ab415eb70fb0501911 100644 (file)
@@ -676,7 +676,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
       define('JVERSION', $jversion->getShortVersion());
     }
 
-    ifversion_compare(JVERSION, '3.0', 'lt') ) {
+    if (version_compare(JVERSION, '3.0', 'lt') ) {
       require $joomlaBase . '/libraries/joomla/environment/uri.php';
       require $joomlaBase . '/libraries/joomla/application/component/helper.php';
     }
index e64ecb7c4624271f281e9440e846751b7ef941c7..588cb56d6a44161711bb7d0d3017ae545bef072a 100644 (file)
@@ -628,7 +628,7 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
       $ufName = CRM_Utils_Type::escape($ufName, 'String');
 
       $values = array('ID' => $ufID, 'user_email' => $ufName);
-      if$ufID ) {
+      if ($ufID ) {
         wp_update_user( $values );
       }
     }
index 891e2d258b27c80639adbd21035f8f30a63d7630..6b1222ced92cf7cfdc35ca8a66fa90125e1c382a 100644 (file)
@@ -49,7 +49,7 @@ class CRM_Utils_SystemLogger extends Psr\Log\AbstractLogger implements \Psr\Log\
    * @return null
    */
   public function log($level, $message, array $context = array()) {
-    if(!isset($context['hostname'])) {
+    if (!isset($context['hostname'])) {
       $context['hostname'] = CRM_Utils_System::ipAddress();
     }
     $rec = new CRM_Core_DAO_SystemLog();
index e96b894d218cc6dcf0869f57b6d820e70c400e6a..08a9c9558f98ac400b24a8a4be011b1233da95af 100644 (file)
@@ -1442,7 +1442,7 @@ class CRM_Utils_Token {
         $greetingTokens = $remainingTokens['contact'];
         reset($greetingTokens);
         $greetingsReturnProperties = array();
-        while(list($key) = each($greetingTokens)) {
+        while (list($key) = each($greetingTokens)) {
           $props = array_flip(CRM_Utils_Array::value($key, $greetingTokens));
           $props = array_fill_keys(array_keys($props), 1);
           $greetingsReturnProperties = $greetingsReturnProperties + $props;
@@ -1656,11 +1656,11 @@ class CRM_Utils_Token {
    * @return \Ambigous|mixed|string|\unknown
    */
   public static function replaceMultipleContributionTokens($separator, $str, &$contribution, $html = FALSE, $knownTokens = NULL, $escapeSmarty = FALSE) {
-    if(empty($knownTokens['contribution'])) {
+    if (empty($knownTokens['contribution'])) {
       return $str;
     }
 
-    if(in_array('receive_date', $knownTokens['contribution'])) {
+    if (in_array('receive_date', $knownTokens['contribution'])) {
       $formattedDates = array();
       $dates = explode($separator, $contribution['receive_date']);
       foreach ($dates as $date) {
index 483069dde8577d855b5ea2e351b0780bed6f83dd..32a036fca4bab3b2c4f645d70cfaa770523f0c86 100644 (file)
@@ -41,7 +41,7 @@ function civicrm_api($entity, $action, $params, $extra = NULL) {
 function civicrm_api3($entity, $action, $params = array()) {
   $params['version'] = 3;
   $result = civicrm_api($entity, $action, $params);
-  if(is_array($result) && !empty($result['is_error'])){
+  if (is_array($result) && !empty($result['is_error'])){
     throw new CiviCRM_API3_Exception($result['error_message'], CRM_Utils_Array::value('error_code', $result, 'undefined'), $result);
   }
   return $result;
@@ -71,7 +71,7 @@ function _civicrm_api3_api_getfields(&$apiRequest) {
   }
   $getFieldsParams = array('action' => $apiRequest['action']);
   $entity = $apiRequest['entity'];
-  if($entity == 'profile' && array_key_exists('profile_id', $apiRequest['params'])) {
+  if ($entity == 'profile' && array_key_exists('profile_id', $apiRequest['params'])) {
     $getFieldsParams['profile_id'] = $apiRequest['params']['profile_id'];
   }
   $fields = civicrm_api3($entity, 'getfields', $getFieldsParams);
index 5da510e8f9da0fb15c44f417b84fe481baa8a75b..b8ff55bd2f8ac69080edd8ae0aa30a104a16148c 100644 (file)
@@ -236,7 +236,7 @@ function civicrm_api3_activity_get($params) {
     $activities = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
   }
   $options = _civicrm_api3_get_options_from_params($params, FALSE, 'activity', 'get');
-  if($options['is_count']) {
+  if ($options['is_count']) {
     return civicrm_api3_create_success($activities, $params, 'activity', 'get');
   }
 
index d49e767b511fce30a8eb7f015c978541f366c863..21a429d03699b88d035a0096aa595d26a25553f8 100644 (file)
@@ -128,7 +128,7 @@ function civicrm_api3_constant_get($params) {
   }
   else{
     $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name);
-    if(!empty($values)){
+    if (!empty($values)){
       return civicrm_api3_create_success($values, $params, 'constant');
     }
   }
index cf70975aca286ead0806aae73afb414678457aaa..8513bcd3ce6b41fc4576d219f49545d1a4e5aa2d 100644 (file)
@@ -588,7 +588,7 @@ function civicrm_api3_contact_getquick($params) {
     }
     // phone_numeric should be phone
     $searchField = str_replace('_numeric', '', $field_name);
-    if(!in_array($searchField, $list)) {
+    if (!in_array($searchField, $list)) {
       $list[] = $searchField;
     }
   }
@@ -989,7 +989,7 @@ function _civicrm_api3_contact_getlist_params(&$request) {
   }
   // phone_numeric should be phone
   $searchField = str_replace('_numeric', '', $field_name);
-  if(!in_array($searchField, $list)) {
+  if (!in_array($searchField, $list)) {
     $list[] = $searchField;
   }
   $request['description_field'] = $list;
@@ -1028,7 +1028,7 @@ function _civicrm_api3_contact_getlist_output($result, $request) {
         }
       }
       $address = array();
-      foreach($addressFields as $item) {
+      foreach ($addressFields as $item) {
         if (!empty($row[$item])) {
           $address[] = $row[$item];
         }
index 03bea847cedbf4376e63080aad1326c297eb0743..5916409c5edeca795b2ca20a2ec45b58aa1fdf59 100644 (file)
@@ -154,14 +154,14 @@ function _civicrm_api3_contribution_create_spec(&$params) {
  */
 function _civicrm_api3_contribution_create_legacy_support_45(&$params){
   //legacy soft credit handling - recommended approach is chaining
-  if(!empty($params['soft_credit_to'])){
+  if (!empty($params['soft_credit_to'])){
     $params['soft_credit'][] = array(
       'contact_id'          => $params['soft_credit_to'],
       'amount'              => $params['total_amount'],
       'soft_credit_type_id' => CRM_Core_OptionGroup::getDefaultValue("soft_credit_type")
     );
   }
-  if(!empty($params['honor_contact_id'])){
+  if (!empty($params['honor_contact_id'])){
     $params['soft_credit'][] = array(
       'contact_id'          => $params['honor_contact_id'],
       'amount'              => $params['total_amount'],
@@ -224,7 +224,7 @@ function civicrm_api3_contribution_get($params) {
     $contribution_details = $query->store($dao);
     $softContribution = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($dao->contribution_id, TRUE);
     $contribution[$dao->contribution_id] = array_merge($contribution_details, $softContribution);
-    if(isset($contribution[$dao->contribution_id]['financial_type_id'])){
+    if (isset($contribution[$dao->contribution_id]['financial_type_id'])){
       $contribution[$dao->contribution_id]['financial_type_id'] = $contribution[$dao->contribution_id]['financial_type_id'];
     }
     // format soft credit for backward compatibility
@@ -423,11 +423,11 @@ function civicrm_api3_contribution_completetransaction(&$params) {
   $contribution = new CRM_Contribute_BAO_Contribution();
   $contribution->id = $params['id'];
   $contribution->find(TRUE);
-  if(!$contribution->id == $params['id']){
+  if (!$contribution->id == $params['id']){
     throw new API_Exception('A valid contribution ID is required', 'invalid_data');
   }
   try {
-    if(!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)){
+    if (!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)){
       throw new API_Exception('failed to load related objects');
     }
     elseif ($contribution->contribution_status_id == CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name')) {
@@ -439,7 +439,7 @@ function civicrm_api3_contribution_completetransaction(&$params) {
     $input['is_test'] = $contribution->is_test;
     $input['trxn_id'] = !empty($params['trxn_id']) ? $params['trxn_id'] : $contribution->trxn_id;
     $input['amount'] = $contribution->total_amount;
-    if(isset($params['is_email_receipt'])){
+    if (isset($params['is_email_receipt'])){
       $input['is_email_receipt'] = $params['is_email_receipt'];
     }
     // @todo required for base ipn but problematic as api layer handles this
index eddb04cb557914d8a92d08f90fd02c42c5481b71..a71b15826aa20fd35d362e917bc65641e15c4d64 100644 (file)
@@ -60,7 +60,7 @@ function civicrm_api3_domain_get($params) {
   $domains = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'domain');
 
   foreach ($domains as $domain) {
-    if(!empty($domain['contact_id'])){
+    if (!empty($domain['contact_id'])){
       $values = array();
       $locparams = array(
         'contact_id' => $domain['contact_id']
index 586b87fa801984c1dd98ff7e302688c2a5f77b1c..071b8051adba7e18e6de846c74ecbd808898737a 100644 (file)
@@ -50,7 +50,7 @@
  */
 function civicrm_api3_entity_tag_get($params) {
 
-  if(empty($params['entity_id'])) {
+  if (empty($params['entity_id'])) {
     return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
   }
   else{
index c08d30c0b1ee027ffea3d1025a070413acb93039..629e8eddf57256128bbce880123cfcb993270063 100644 (file)
@@ -91,7 +91,7 @@ function _civicrm_api3_event_create_spec(&$params) {
  * across schema changes.
  */
 function _civicrm_api3_event_create_legacy_support_42(&$params){
-  if(!empty($params['payment_processor_id'])){
+  if (!empty($params['payment_processor_id'])){
     $params['payment_processor'] = CRM_Core_DAO::VALUE_SEPARATOR . $params['payment_processor_id'] . CRM_Core_DAO::VALUE_SEPARATOR;
   }
 }
@@ -150,7 +150,7 @@ function civicrm_api3_event_get($params) {
     }
     _civicrm_api3_event_get_legacy_support_42($event, $eventDAO->id);
     _civicrm_api3_custom_data_get($event[$eventDAO->id], 'Event', $eventDAO->id, NULL, $eventDAO->event_type_id);
-    if(!empty($options['return'])) {
+    if (!empty($options['return'])) {
       $event[$eventDAO->id]['price_set_id'] = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $eventDAO->id);
     }
   }
@@ -176,9 +176,9 @@ function _civicrm_api3_event_get_spec(&$params) {
  * across schema changes.
  */
 function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id){
-  if(!empty($event[$event_id]['payment_processor'])){
+  if (!empty($event[$event_id]['payment_processor'])){
     $processors = explode(CRM_Core_DAO::VALUE_SEPARATOR, $event[$event_id]['payment_processor']);
-    if(count($processors) == 3 ){
+    if (count($processors) == 3 ){
       $event[$event_id]['payment_processor_id'] = $processors[1];
     }
   }
index 3de180b9ea5b7048080e376c681556a32a3727ab..362c1c438865bbeb682970a59a83582f95d02c61 100644 (file)
@@ -25,12 +25,12 @@ function civicrm_api3_generic_getfields($apiRequest) {
     $results = array();
     // we will also clear pseudoconstants here - should potentially be moved to relevant BAO classes
     CRM_Core_PseudoConstant::flush();
-    if(!empty($apiRequest['params']['fieldname'])){
+    if (!empty($apiRequest['params']['fieldname'])){
       CRM_Utils_PseudoConstant::flushConstant($apiRequest['params']['fieldname']);
     }
-    if(!empty($apiRequest['params']['option_group_id'])){
+    if (!empty($apiRequest['params']['option_group_id'])){
       $optionGroupName = civicrm_api('option_group', 'getvalue', array('version' => 3, 'id' => $apiRequest['params']['option_group_id'], 'return' => 'name') );
-      if(is_string($optionGroupName)){
+      if (is_string($optionGroupName)){
         CRM_Utils_PseudoConstant::flushConstant(_civicrm_api_get_camel_name($optionGroupName));
       }
     }
@@ -65,7 +65,7 @@ function civicrm_api3_generic_getfields($apiRequest) {
       $metadata = _civicrm_api_get_fields($apiRequest['entity'], $unique, $apiRequest['params']);
       if (empty($metadata['id'])){
         // if id is not set we will set it eg. 'id' from 'case_id', case_id will be an alias
-        if(!empty($metadata[strtolower($apiRequest['entity']) . '_id'])) {
+        if (!empty($metadata[strtolower($apiRequest['entity']) . '_id'])) {
           $metadata['id'] = $metadata[$lcase_entity . '_id'];
           unset($metadata[$lcase_entity . '_id']);
           $metadata['id']['api.aliases'] = array($lcase_entity . '_id');
@@ -152,10 +152,10 @@ function civicrm_api3_generic_getfields($apiRequest) {
 function civicrm_api3_generic_getcount($apiRequest) {
   $apiRequest['params']['options']['is_count'] = TRUE;
   $result = civicrm_api($apiRequest['entity'], 'get', $apiRequest['params']);
-  if(is_numeric (CRM_Utils_Array::value('values', $result))) {
+  if (is_numeric (CRM_Utils_Array::value('values', $result))) {
     return (int) $result['values'];
   }
-  if(!isset($result['count'])) {
+  if (!isset($result['count'])) {
     throw new API_Exception(ts('Unexpected result from getcount') . print_r($result, TRUE));
   }
   return $result['count'];
index ae28129d2e7b32c9569ecbe232784175e8ea3b2e..41a87cfb23c2e1f5d4cfe7598799b7d219c4b628 100644 (file)
@@ -54,7 +54,7 @@ function civicrm_api3_generic_update($apiRequest) {
   // @fixme
   // tests show that contribution works better with create
   // this is horrible but to make it work we'll just handle it separately
-  if(strtolower($apiRequest['entity']) == 'contribution'){
+  if (strtolower($apiRequest['entity']) == 'contribution'){
     return civicrm_api($apiRequest['entity'], 'create', $apiRequest['params']);
   }
   $seek = array($key_id => $apiRequest['params'][$key_id], 'version' => $apiRequest['version']);
index b9155be9c8aa7864d10b90962a45615d195814f1..22f7e38eb07fd2b6cab675a0d414b8f72cace98b 100644 (file)
@@ -83,7 +83,7 @@ function _civicrm_api3_group_create_spec(&$params) {
  */
 function civicrm_api3_group_get($params) {
   $options = _civicrm_api3_get_options_from_params($params, TRUE, 'group', 'get');
-  if(empty($options['return']) || !in_array('member_count', $options['return'])) {
+  if (empty($options['return']) || !in_array('member_count', $options['return'])) {
     return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Group');
   }
 
index 361e12132049544c98fab21206dbd8b1f6240f8c..85362a1208d8fbff63373d01d2cf3c0cf3f443fd 100644 (file)
@@ -62,7 +62,7 @@ function civicrm_api3_mailing_contact_get($params) {
  * @throws Exception
  */
 function _civicrm_api3_mailing_contact_getresults($params, $count){
-  if(empty($params['type'])){
+  if (empty($params['type'])){
     //ie. because the api is an anomoly & passing in id is not valid
     throw new Exception('This api call does not accept api as a parameter');
   }
index 2f795df4d704db3fa81bed0f01bdadbd911c2041..d50c025f9850bbdcf941a4fb9286f3f39c60f3f5 100644 (file)
@@ -212,7 +212,7 @@ function civicrm_api3_membership_get($params) {
   $membershipValues = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Membership');
 
   $return = $options['return'];
-  if(empty($membershipValues) ||
+  if (empty($membershipValues) ||
     (!empty($return)
       && !array_key_exists('related_contact_id', $return)
       && !array_key_exists('relationship_name', $return)
index b3eaa0edd8b4cbd23bfba67e91b28d010378c213..aa2646a1c42fbd17197f2a943d89026ecea48683 100644 (file)
@@ -147,7 +147,7 @@ function civicrm_api3_membership_status_calc($membershipParams) {
     throw new API_Exception('membershipParams do not contain membership_id');
   }
 
-  if(empty($membershipParams['id'])) {
+  if (empty($membershipParams['id'])) {
     //for consistency lets make sure id is set as this will get passed to hooks downstream
     $membershipParams['id'] = $membershipID;
   }
index 4217ea1a7611f9836e61acc861c7b21354fac97a..0067508464bd5acf6562a3e95d359232741661b4 100644 (file)
@@ -84,7 +84,7 @@ function _civicrm_api3_option_value_create_spec(&$params) {
 function civicrm_api3_option_value_delete($params) {
   // we will get the option group id before deleting so we can flush pseudoconstants
   $optionGroupID = civicrm_api('option_value', 'getvalue', array('version' => 3, 'id' => $params['id'], 'return' => 'option_group_id'));
-  if(CRM_Core_BAO_OptionValue::del((int) $params['id'])){
+  if (CRM_Core_BAO_OptionValue::del((int) $params['id'])){
     civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID));
     return civicrm_api3_create_success();
   }
index 3ad986fc68ba0fea49a8d34be5f42152727433ef..0dea44820a8a49ed1fbb3f7acc644cefcd14c9b4 100644 (file)
@@ -70,7 +70,7 @@ function civicrm_api3_participant_create($params) {
 
   $participantBAO = CRM_Event_BAO_Participant::create($params);
 
-  if(empty($params['price_set_id']) && empty($params['id']) && !empty($params['fee_level'])){
+  if (empty($params['price_set_id']) && empty($params['id']) && !empty($params['fee_level'])){
     _civicrm_api3_participant_createlineitem($params, $participantBAO);
   }
   _civicrm_api3_object_to_array($participantBAO, $participant[$participantBAO->id]);
@@ -88,7 +88,7 @@ function _civicrm_api3_participant_createlineitem(&$params, $participant){
   $priceFieldValueDetails = CRM_Utils_Array::explodePadded(
     $params["fee_level"]);
 
-  foreach($priceFieldValueDetails as $detail) {
+  foreach ($priceFieldValueDetails as $detail) {
     if (preg_match('/- ([0-9]+)$/', $detail, $matches)) {
       // it is possible that a price field value is payd for multiple times.
       // (FIXME: if the price field value ends in minus followed by whitespace
index ec3e0853afc992d1a7dc83b489ae42d4fd11e1d2..57fc14247772e0101838164e044840f81edfa9e3 100644 (file)
@@ -68,7 +68,7 @@ function civicrm_api3_pledge_payment_create($params) {
   }
 
   $dao = CRM_Pledge_BAO_PledgePayment::add($paymentParams);
-  if(empty($dao->pledge_id)){
+  if (empty($dao->pledge_id)){
     $dao->find(TRUE);
   }
   _civicrm_api3_object_to_array($dao, $result[$dao->id]);
index f3a294ffea32cd6601de17a1364db42ea2f4665b..74c444cc889ca0ac1c36307a68e516d9873df448 100644 (file)
@@ -49,7 +49,7 @@
  */
 function civicrm_api3_price_field_value_create($params) {
   $ids = array();
-  if(!empty($params['id'])){
+  if (!empty($params['id'])){
     $ids['id'] = $params['id'];
   }
 
index 1c4c785b378e46c1387b217df39033abc32ee50f..66ff4b8f76a07430ac7642448a7b5cbb6dc1ec8d 100644 (file)
@@ -90,7 +90,7 @@ function _civicrm_api3_price_set_create_spec(&$params) {
 function civicrm_api3_price_set_get($params) {
   // hack to make getcount work. - not sure the best approach here
   // as creating an alternate getcount function also feels a bit hacky
-  if(isset($params['options'])  && isset($params['options']['is_count'])) {
+  if (isset($params['options'])  && isset($params['options']['is_count'])) {
     return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
   }
   $result = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
index 713a21cd259ab51371e23b7afb7e5232ddc9e076..cf17237085553ceff1e5d67e7995840a8cd82671 100644 (file)
@@ -55,7 +55,7 @@
  */
 function civicrm_api3_profile_get($params) {
   $nonStandardLegacyBehaviour = is_numeric($params['profile_id']) ? TRUE : FALSE;
-  if(!empty($params['check_permissions']) && !empty($params['contact_id']) && !1 === civicrm_api3('contact', 'getcount', array('contact_id' => $params['contact_id'], 'check_permissions' => 1))) {
+  if (!empty($params['check_permissions']) && !empty($params['contact_id']) && !1 === civicrm_api3('contact', 'getcount', array('contact_id' => $params['contact_id'], 'check_permissions' => 1))) {
     throw new API_Exception('permission denied');
   }
   $profiles = (array) $params['profile_id'];
@@ -68,7 +68,7 @@ function civicrm_api3_profile_get($params) {
       $values[$profileID] = _civicrm_api3_profile_getbillingpseudoprofile($params);
       continue;
     }
-    if(!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_active')) {
+    if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_active')) {
       throw new API_Exception('Invalid value for profile_id : ' . $profileID);
     }
 
@@ -128,7 +128,7 @@ function civicrm_api3_profile_get($params) {
       $values[$profileID] = array_fill_keys(array_keys($profileFields), '');
     }
   }
-  if($nonStandardLegacyBehaviour) {
+  if ($nonStandardLegacyBehaviour) {
     $result = civicrm_api3_create_success();
     $result['values'] = $values[$profileID];
     return $result;
@@ -200,13 +200,13 @@ function civicrm_api3_profile_submit($params) {
     $locationEntities = array('email', 'address', 'phone', 'website', 'im');
 
     $entity = strtolower(CRM_Utils_Array::value('entity', $field));
-    if($entity && !in_array($entity, array_merge($contactEntities, $locationEntities))) {
+    if ($entity && !in_array($entity, array_merge($contactEntities, $locationEntities))) {
       $contactParams['api.' . $entity . '.create'][$fieldName] = $value;
       //@todo we are not currently declaring this option
-      if(isset($params['batch_id']) && strtolower($entity) == 'contribution') {
+      if (isset($params['batch_id']) && strtolower($entity) == 'contribution') {
         $contactParams['api.' . $entity . '.create']['batch_id'] = $params['batch_id'];
       }
-      if(isset($params[$entity . '_id'])) {
+      if (isset($params[$entity . '_id'])) {
         //todo possibly declare $entity_id in getfields ?
         $contactParams['api.' . $entity . '.create']['id'] = $params[$entity . '_id'];
       }
@@ -215,14 +215,14 @@ function civicrm_api3_profile_submit($params) {
       $contactParams[_civicrm_api3_profile_translate_fieldnames_for_bao($fieldName)] = $value;
     }
   }
-  if(isset($contactParams['api.contribution.create']) && isset($contactParams['api.membership.create'])) {
+  if (isset($contactParams['api.contribution.create']) && isset($contactParams['api.membership.create'])) {
     $contactParams['api.membership_payment.create'] = array(
       'contribution_id' => '$value.api.contribution.create.id',
       'membership_id' => '$value.api.membership.create.id'
     );
   }
 
-  if(isset($contactParams['api.contribution.create']) && isset($contactParams['api.participant.create'])) {
+  if (isset($contactParams['api.contribution.create']) && isset($contactParams['api.participant.create'])) {
     $contactParams['api.participant_payment.create'] = array(
       'contribution_id' => '$value.api.contribution.create.id',
       'participant_id' => '$value.api.participant.create.id'
@@ -307,7 +307,7 @@ function _civicrm_api3_profile_translate_fieldnames_for_bao($fieldName){
  * @param array $apirequest
  */
 function _civicrm_api3_profile_submit_spec(&$params, $apirequest) {
-  if(isset($apirequest['params']['profile_id'])) {
+  if (isset($apirequest['params']['profile_id'])) {
     // we will return what is required for this profile
     // note the problem with simply over-riding getfields & then calling generic if needbe is we don't have the
     // api request array to pass to it.
@@ -405,7 +405,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) {
   $locations = civicrm_api3('address', 'getoptions', array('field' => 'location_type_id'));
   $locationTypeID = array_search('Billing', $locations['values']);
 
-  if(empty($params['contact_id'])) {
+  if (empty($params['contact_id'])) {
     $config = CRM_Core_Config::singleton();
     $blanks = array(
       'billing_first_name' => '',
@@ -440,7 +440,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) {
     'billing_last_name' => $result['last_name'],
   );
 
-  if(!empty($result['api.address.get.1']['count'])) {
+  if (!empty($result['api.address.get.1']['count'])) {
     foreach ($addressFields as $fieldname) {
       $values['billing_' . $fieldname . '-' . $locationTypeID] = isset($result['api.address.get.1']['values'][0][$fieldname]) ? $result['api.address.get.1']['values'][0][$fieldname] : '';
     }
@@ -456,7 +456,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) {
     }
   }
 
-  if(!empty($result['api.email.get.1']['count'])) {
+  if (!empty($result['api.email.get.1']['count'])) {
     $values['billing-email'. '-' . $locationTypeID] = $result['api.email.get.1']['values'][0]['email'];
   }
   elseif(!empty($result['api.email.get.2']['count'])) {
@@ -491,24 +491,24 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) {
 
 function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = 1, $is_flush) {
   static $profileFields = array();
-  if($is_flush) {
+  if ($is_flush) {
     $profileFields = array();
-    if(empty($profileID)) {
+    if (empty($profileID)) {
       return;
     }
   }
-  if(isset($profileFields[$profileID])) {
+  if (isset($profileFields[$profileID])) {
     return $profileFields[$profileID];
   }
   $fields = civicrm_api3('uf_field', 'get', array('uf_group_id' => $profileID));
   $entities = array();
   foreach ($fields['values'] as $field) {
-    if(!$field['is_active']) {
+    if (!$field['is_active']) {
       continue;
     }
     list($entity, $fieldName) = _civicrm_api3_map_profile_fields_to_entity($field);
     $aliasArray = array();
-    if(strtolower($fieldName) != $fieldName) {
+    if (strtolower($fieldName) != $fieldName) {
       $aliasArray['api.aliases'] = array($fieldName);
       $fieldName = strtolower($fieldName);
     }
@@ -522,7 +522,7 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour =
     ), $aliasArray);
 
     $ufFieldTaleFieldName = $field['field_name'];
-    if(isset($entity[$ufFieldTaleFieldName]['name'])) {
+    if (isset($entity[$ufFieldTaleFieldName]['name'])) {
       // in the case where we are dealing with an alias we map back to a name
       // this will be tested by 'membership_type_id' field
       $ufFieldTaleFieldName = $entity[$ufFieldTaleFieldName]['name'];
@@ -542,7 +542,7 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour =
       'soft_credit_type' => 'soft_credit_type_id',
     );
 
-    if(array_key_exists($ufFieldTaleFieldName, $hardCodedEntityFields)) {
+    if (array_key_exists($ufFieldTaleFieldName, $hardCodedEntityFields)) {
       $ufFieldTaleFieldName = $hardCodedEntityFields[$ufFieldTaleFieldName];
     }
 
@@ -554,49 +554,49 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour =
     $entityGetFieldsResult = _civicrm_api3_profile_appendaliases($result['values'], $entity);
     foreach ($entityFields as $entityfield => $realName) {
       $fieldName = strtolower($entityfield);
-      if(!strstr($fieldName, '-')) {
-        if(strtolower($realName) != $fieldName) {
+      if (!strstr($fieldName, '-')) {
+        if (strtolower($realName) != $fieldName) {
           // we want to keep the '-' pattern for locations but otherwise
           // we are going to make the api-standard field the main / preferred name but support the db name
           // in future naming the fields in the DB to reflect the way the rest of the api / BAO / metadata works would
           // reduce code
           $fieldName = strtolower($realName);
         }
-        if(isset($entityGetFieldsResult[$realName]['uniqueName'])) {
+        if (isset($entityGetFieldsResult[$realName]['uniqueName'])) {
           // we won't alias the field name on here are we are using uniqueNames for the possibility of needing to differentiate
           // which entity 'status_id' belongs to
           $fieldName = $entityGetFieldsResult[$realName]['uniqueName'];
         }
         else{
-          if(isset($entityGetFieldsResult[$realName]['name'])) {
+          if (isset($entityGetFieldsResult[$realName]['name'])) {
             // this will sort out membership_type_id vs membership_type
             $fieldName = $entityGetFieldsResult[$realName]['name'];
           }
         }
       }
       $profileFields[$profileID][$fieldName] = array_merge($entityGetFieldsResult[$realName], $profileFields[$profileID][$entityfield]);
-      if(!isset($profileFields[$profileID][$fieldName]['api.aliases'])) {
+      if (!isset($profileFields[$profileID][$fieldName]['api.aliases'])) {
         $profileFields[$profileID][$fieldName]['api.aliases'] = array();
       }
-      if($optionsBehaviour && !empty($entityGetFieldsResult[$realName]['pseudoconstant'])) {
-        if($optionsBehaviour > 1  || !in_array($realName, array('state_province_id', 'county_id', 'country_id'))) {
+      if ($optionsBehaviour && !empty($entityGetFieldsResult[$realName]['pseudoconstant'])) {
+        if ($optionsBehaviour > 1  || !in_array($realName, array('state_province_id', 'county_id', 'country_id'))) {
           $options = civicrm_api3($entity, 'getoptions', array('field' => $realName));
           $profileFields[$profileID][$fieldName]['options'] = $options['values'];
         }
       }
 
-      if($entityfield != $fieldName) {
-        if(isset($profileFields[$profileID][$entityfield])) {
+      if ($entityfield != $fieldName) {
+        if (isset($profileFields[$profileID][$entityfield])) {
           unset($profileFields[$profileID][$entityfield]);
         }
-        if(!in_array($entityfield, $profileFields[$profileID][$fieldName]['api.aliases'])) {
+        if (!in_array($entityfield, $profileFields[$profileID][$fieldName]['api.aliases'])) {
           // we will make the mixed case version (e.g. of 'Primary') an alias
           $profileFields[$profileID][$fieldName]['api.aliases'][] = $entityfield;
         }
       }
       /**
        * putting this on hold -this would cause the api to set the default - but could have unexpected behaviour
-      if(isset($result['values'][$realName]['default_value'])) {
+      if (isset($result['values'][$realName]['default_value'])) {
       //this would be the case for a custom field with a configured default
       $profileFields[$profileID][$entityfield]['api.default'] = $result['values'][$realName]['default_value'];
       }
@@ -628,14 +628,14 @@ function _civicrm_api3_order_by_weight($a, $b) {
 function _civicrm_api3_map_profile_fields_to_entity(&$field) {
   $entity = $field['field_type'];
   $contactTypes = civicrm_api3('contact', 'getoptions', array('field' => 'contact_type'));
-  if(in_array($entity, $contactTypes['values'])) {
+  if (in_array($entity, $contactTypes['values'])) {
     $entity = 'contact';
   }
   $entity = _civicrm_api_get_entity_name_from_camel($entity);
   $locationFields = array('email' => 'email');
   $fieldName = $field['field_name'];
-  if(!empty($field['location_type_id'])) {
-    if($fieldName == 'email') {
+  if (!empty($field['location_type_id'])) {
+    if ($fieldName == 'email') {
       $entity = 'email';
     }
     else{
@@ -647,7 +647,7 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) {
     $fieldName .= '-Primary';
     $entity = 'email';
   }
-  if(!empty($field['phone_type_id'])) {
+  if (!empty($field['phone_type_id'])) {
     $fieldName .= '-' . $field['location_type_id'];
     $entity = 'phone';
   }
@@ -683,7 +683,7 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) {
     'group' => 'group_contact',
     'tag' => 'entity_tag',
    );
-  if(array_key_exists($fieldName, $hardCodedEntityMappings)) {
+  if (array_key_exists($fieldName, $hardCodedEntityMappings)) {
     $entity = $hardCodedEntityMappings[$fieldName];
   }
   return array($entity, $fieldName);
@@ -699,7 +699,7 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) {
  * @throws CiviCRM_API3_Exception
  */
 function _civicrm_api3_profile_getProfileID($profileID) {
-  if(!empty($profileID) && strtolower($profileID) != 'billing' && !is_numeric($profileID)) {
+  if (!empty($profileID) && strtolower($profileID) != 'billing' && !is_numeric($profileID)) {
     $profileID = civicrm_api3('uf_group', 'getvalue', array('return' => 'id', 'name' => $profileID));
   }
   return $profileID;
@@ -719,17 +719,17 @@ function _civicrm_api3_profile_getProfileID($profileID) {
  */
 function _civicrm_api3_profile_appendaliases($values, $entity) {
   foreach ($values as $field => $spec) {
-    if(!empty($spec['api.aliases'])) {
+    if (!empty($spec['api.aliases'])) {
       foreach ($spec['api.aliases'] as $alias) {
         $values[$alias] = $spec;
       }
     }
-    if(!empty($spec['uniqueName'])) {
+    if (!empty($spec['uniqueName'])) {
       $values[$spec['uniqueName']] = $spec;
     }
   }
   //special case on membership & contribution - can't see how to handle in a generic way
-  if(in_array($entity, array('membership', 'contribution'))) {
+  if (in_array($entity, array('membership', 'contribution'))) {
     $values['send_receipt'] = array('title' => 'Send Receipt', 'type' => (int) 16);
   }
   return $values;
index 6a685598d797c99d53d2914c3aed30e94b140c6c..2f6b159acec2b12d4a6edfa7e8331a12a752614e 100644 (file)
@@ -116,7 +116,7 @@ function civicrm_api3_relationship_get($params) {
   $options = _civicrm_api3_get_options_from_params($params);
 
   if (empty($params['contact_id'])) {
-    if(!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) {
+    if (!empty($params['membership_type_id']) && empty($params['relationship_type_id'])) {
       CRM_Contact_BAO_Relationship::membershipTypeToRelationshipTypes($params);
     }
     $relationships = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Relationship');
@@ -134,7 +134,7 @@ function civicrm_api3_relationship_get($params) {
     );
   }
   //perhaps we should add a 'getcount' but at this stage lets just handle getcount output
-  if($options['is_count']) {
+  if ($options['is_count']) {
     return array('count' => $relationships);
   }
   foreach ($relationships as $relationshipId => $values) {
index e59dc6829be02a14e98bfb4b431f29810cd28e63..ac5b66239d592bd77a276596fdf3714f3818e819 100644 (file)
@@ -104,7 +104,7 @@ function civicrm_api3_report_template_getrows($params) {
  * @throws CiviCRM_API3_Exception
  */
 function _civicrm_api3_report_template_getrows($params) {
-  if(empty($params['report_id'])) {
+  if (empty($params['report_id'])) {
     $params['report_id'] = civicrm_api3('report_instance', 'getvalue', array('id' => $params['instance_id'], 'return' => 'report_id'));
   }
 
@@ -116,7 +116,7 @@ function _civicrm_api3_report_template_getrows($params) {
   );
 
   $reportInstance = new $class();
-  if(!empty($params['instance_id'])) {
+  if (!empty($params['instance_id'])) {
     $reportInstance->setID($params['instance_id']);
   }
   $reportInstance->setParams($params);
@@ -132,12 +132,12 @@ function _civicrm_api3_report_template_getrows($params) {
   $rows = $metadata = $requiredMetadata  = array();
   $reportInstance->buildRows($sql, $rows);
   $requiredMetadata = array();
-  if(isset($params['options']) && !empty($params['options']['metadata'])) {
+  if (isset($params['options']) && !empty($params['options']['metadata'])) {
     $requiredMetadata = $params['options']['metadata'];
-    if(in_array('title', $requiredMetadata)) {
+    if (in_array('title', $requiredMetadata)) {
       $metadata['metadata']['title'] = $reportInstance->getTitle();
     }
-    if(in_array('labels', $requiredMetadata)) {
+    if (in_array('labels', $requiredMetadata)) {
       foreach ($reportInstance->_columnHeaders as $key => $header) {
         //would be better just to expect reports to provide titles but reports are not consistent so we anticipate empty
         //NB I think these are already translated
index 4872fea4a0b72b175ec61c3b51963c5d816da9c4..c223be15b94c6f4b5802db9257efccef3c448f70 100644 (file)
@@ -36,7 +36,7 @@
  */
 
 function civicrm_api3_setting_getfields($params) {
-  if(!empty($params['action']) && strtolower($params['action']) == 'getvalue'){
+  if (!empty($params['action']) && strtolower($params['action']) == 'getvalue'){
     $result = array(
       'name' => array(
         'title' => 'name of setting field',
@@ -50,7 +50,7 @@ function civicrm_api3_setting_getfields($params) {
       );
     return civicrm_api3_create_success($result, $params, 'setting', 'getfields');
   }
-  if(!empty($params['name'])){
+  if (!empty($params['name'])){
     //am of two minds about special handling for 'name' as opposed to other filters - but is does make most common
     //usage really easy
     $params['filters']['name'] = $params['name'];
@@ -93,14 +93,14 @@ function civicrm_api3_setting_getdefaults(&$params){
     $defaults[$domainID] = array();
     $noDefaults = array();
     foreach ($settings['values'] as $setting => $spec){
-      if(array_key_exists('default', $spec) && !is_null($spec['default'])){
+      if (array_key_exists('default', $spec) && !is_null($spec['default'])){
         $defaults[$domainID][$setting] = $spec['default'];
       }
       else{
         $noDefaults[$setting] = 1;
       }
     }
-    if(!empty($params['debug'])){
+    if (!empty($params['debug'])){
       // we are only tracking 'noDefaults' to help us check the xml
       print_r($noDefaults);
     }
@@ -133,7 +133,7 @@ function civicrm_api3_setting_revert(&$params){
   $result = array();
   foreach ($domains as $domainID){
     $valuesToRevert = array_intersect_key($defaults['values'][$domainID], $fields);
-    if(!empty($valuesToRevert)){
+    if (!empty($valuesToRevert)){
       $valuesToRevert['version'] = $params['version'];
       $valuesToRevert['domain_id'] = $domainID;
       // note that I haven't looked at how the result would appear with multiple domains in play
@@ -172,7 +172,7 @@ function civicrm_api3_setting_fill(&$params){
     );
     $existing = civicrm_api3('setting', 'get', $apiArray);
     $valuesToFill = array_diff_key($defaults['values'][$domainID], $existing['values'][$domainID]);
-    if(!empty($valuesToFill)){
+    if (!empty($valuesToFill)){
       $result = array_merge($result, civicrm_api('setting', 'create', $valuesToFill + $apiArray));
     }
   }
@@ -277,7 +277,7 @@ function _civicrm_api3_setting_get_spec(&$params) {
  */
 function civicrm_api3_setting_getvalue($params) {
   $config = CRM_Core_Config::singleton();
-  if(isset($config->$params['name'])){
+  if (isset($config->$params['name'])){
     return $config->$params['name'];
   }
   return CRM_Core_BAO_Setting::getItem(
@@ -330,15 +330,15 @@ function _civicrm_api3_setting_getvalue_spec(&$params) {
  * we did talk about id being a pseudonym for domain_id in this api so applying it here
  */
 function _civicrm_api3_setting_getDomainArray(&$params){
-  if(empty($params['domain_id']) && isset($params['id'])){
+  if (empty($params['domain_id']) && isset($params['id'])){
     $params['domain_id'] = $params['id'];
   }
 
-  if($params['domain_id'] == 'current_domain'){
+  if ($params['domain_id'] == 'current_domain'){
     $params['domain_id']    = CRM_Core_Config::domainID();
   }
 
-  if($params['domain_id'] == 'all'){
+  if ($params['domain_id'] == 'all'){
     $domainAPIResult = civicrm_api('domain', 'get', array('version' => 3, 'return' => 'id'));
     if (isset($domainAPIResult['values'])) {
       $params['domain_id'] = array_keys($domainAPIResult['values']);
@@ -347,7 +347,7 @@ function _civicrm_api3_setting_getDomainArray(&$params){
       throw new Exception('All domains not retrieved - problem with Domain Get api call ' . $domainAPIResult['error_message']);
     }
   }
-  if(is_array($params['domain_id'])){
+  if (is_array($params['domain_id'])){
     $domains = $params['domain_id'];
   }
   else{
index 0ef32ced5801ff0647f60a885b058377a7a22cbd..c0a7563fb82c11f640f8fc64d665fba510537302 100644 (file)
@@ -112,12 +112,12 @@ function civicrm_api3_system_log($params) {
   $log = new CRM_Utils_SystemLogger();
   // this part means fields with separate db storage are accepted as params which kind of seems more intuitive to me
   // because I felt like not doing this required a bunch of explanation in the spec function - but perhaps other won't see it as helpful?
-  if(!isset($params['context'])) {
+  if (!isset($params['context'])) {
     $params['context'] = array();
   }
   $specialFields = array('contact_id', 'hostname');
-  foreach($specialFields as $specialField) {
-    if(isset($params[$specialField]) && !isset($params['context'])) {
+  foreach ($specialFields as $specialField) {
+    if (isset($params[$specialField]) && !isset($params['context'])) {
       $params['context'][$specialField] = $params[$specialField];
     }
   }
index 9ab3b5e7a836b2f2e6f94c7b71d7346f4503382b..268f196d03ef41dcda94c79b4131ca4290ecb24b 100644 (file)
@@ -144,7 +144,7 @@ function civicrm_api3_create_error($msg, $data = array()) {
   $data['error_message'] = $msg;
   // we will show sql to privileged user only (not sure of a specific
   // security hole here but seems sensible - perhaps should apply to the trace as well?)
-  if(isset($data['sql']) && CRM_Core_Permission::check('Administer CiviCRM')) {
+  if (isset($data['sql']) && CRM_Core_Permission::check('Administer CiviCRM')) {
     $data['debug_information'] = $data['sql']; // Isn't this redundant?
   }
   else {
@@ -180,11 +180,11 @@ function civicrm_api3_create_success($values = 1, $params = array(), $entity = N
       if (empty($item['id']) && !empty($item[$entity . "_id"])) {
         $values[$key]['id'] = $item[$entity . "_id"];
       }
-      if(!empty($item['financial_type_id'])){
+      if (!empty($item['financial_type_id'])){
         //4.3 legacy handling
         $values[$key]['contribution_type_id'] = $item['financial_type_id'];
       }
-      if(!empty($item['next_sched_contribution_date'])){
+      if (!empty($item['next_sched_contribution_date'])){
         // 4.4 legacy handling
         $values[$key]['next_sched_contribution'] = $item['next_sched_contribution_date'];
       }
@@ -242,9 +242,9 @@ function civicrm_api3_create_success($values = 1, $params = array(), $entity = N
   else {
     $result['values'] = $values;
   }
-  if(!empty($params['options']['metadata'])) {
+  if (!empty($params['options']['metadata'])) {
     // we've made metadata an array but only supporting 'fields' atm
-    if(in_array('fields', (array) $params['options']['metadata']) && $action !== 'getfields') {
+    if (in_array('fields', (array) $params['options']['metadata']) && $action !== 'getfields') {
       $fields = civicrm_api3($entity, 'getfields', array('action' => substr($action, 0, 3) == 'get' ? 'get' : 'create'));
       $result['metadata']['fields'] = $fields['values'];
     }
@@ -336,7 +336,7 @@ function _civicrm_api3_get_DAO($name) {
   }
 
   // Really weird apis can declare their own DAO name. Not sure if this is a good idea...
-  if(file_exists("api/v3/$name.php")) {
+  if (file_exists("api/v3/$name.php")) {
     include_once "api/v3/$name.php";
   }
 
@@ -382,7 +382,7 @@ function _civicrm_api3_separate_values(&$values) {
       _civicrm_api3_separate_values($value);
     }
     elseif (is_string($value)) {
-      if($key == 'case_type_id'){// this is to honor the way case API was originally written
+      if ($key == 'case_type_id'){// this is to honor the way case API was originally written
         $value = trim(str_replace($sp, ',', $value), ',');
       }
       elseif (strpos($value, $sp) !== FALSE) {
@@ -467,17 +467,17 @@ function _civicrm_api3_get_using_query_object($entity, $params, $additional_opti
     CRM_Utils_Array::value('return', $options, array()),
     CRM_Utils_Array::value('return', $additional_options, array())
   );
-  if(empty($returnProperties)){
+  if (empty($returnProperties)){
     $returnProperties = NULL;
   }
-  if(!empty($params['check_permissions'])){
+  if (!empty($params['check_permissions'])){
     // we will filter query object against getfields
     $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'get'));
     // we need to add this in as earlier in this function 'id' was unset in favour of $entity_id
     $fields['values'][$entity . '_id'] = array();
     $varsToFilter = array('returnProperties', 'inputParams');
     foreach ($varsToFilter as $varToFilter){
-      if(!is_array($$varToFilter)){
+      if (!is_array($$varToFilter)){
         continue;
       }
       //I was going to throw an exception rather than silently filter out - but
@@ -493,18 +493,18 @@ function _civicrm_api3_get_using_query_object($entity, $params, $additional_opti
   $limit             = CRM_Utils_Array::value('limit', $options, NULL);
   $smartGroupCache  = CRM_Utils_Array::value('smartGroupCache', $params);
 
-  if($getCount){
+  if ($getCount){
     $limit = NULL;
     $returnProperties = NULL;
   }
 
   $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams);
   foreach ($newParams as &$newParam) {
-    if($newParam[1] == '='  && is_array($newParam[2])) {
+    if ($newParam[1] == '='  && is_array($newParam[2])) {
       // we may be looking at an attempt to use the 'IN' style syntax
       // @todo at time of writing only 'IN' & 'NOT IN' are  supported for the array style syntax
       $sqlFilter = CRM_Core_DAO::createSqlFilter($newParam[0], $params[$newParam[0]], 'String', NULL, TRUE);
-      if($sqlFilter) {
+      if ($sqlFilter) {
         $newParam[1] = key($newParam[2]);
         $newParam[2] = $sqlFilter;
       }
@@ -565,7 +565,7 @@ function _civicrm_api3_get_query_object($params, $mode, $entity) {
   if (!empty($sort)) {
     $sql .= " ORDER BY $sort ";
   }
-  if(!empty($rowCount)) {
+  if (!empty($rowCount)) {
     $sql .= " LIMIT $offset, $rowCount ";
   }
   $dao = CRM_Core_DAO::executeQuery($sql);
@@ -620,7 +620,7 @@ function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $entity) {
       //get the actual fieldname from db
       $fieldName = $allfields[$field]['name'];
       $where = CRM_Core_DAO::createSqlFilter($fieldName, $params[$field], 'String');
-      if(!empty($where)) {
+      if (!empty($where)) {
         $dao->whereAdd($where);
       }
     }
@@ -680,11 +680,11 @@ function _civicrm_api3_apply_filters_to_dao($filterField, $filterValue, &$dao) {
     $fieldName = substr($filterField, 0, -4);
     $dao->whereAdd("($fieldName >= $filterValue )");
   }
-  if($filterField == 'is_current' && $filterValue == 1){
+  if ($filterField == 'is_current' && $filterValue == 1){
     $todayStart = date('Ymd000000', strtotime('now'));
     $todayEnd = date('Ymd235959', strtotime('now'));
     $dao->whereAdd("(start_date <= '$todayStart' OR start_date IS NULL) AND (end_date >= '$todayEnd' OR end_date IS NULL)");
-    if(property_exists($dao, 'is_active')){
+    if (property_exists($dao, 'is_active')){
       $dao->whereAdd('is_active = 1');
     }
   }
@@ -808,8 +808,8 @@ function _civicrm_api3_get_options_from_params(&$params, $queryObject = FALSE, $
 function _civicrm_api3_apply_options_to_dao(&$params, &$dao, $entity) {
 
   $options = _civicrm_api3_get_options_from_params($params, FALSE, $entity);
-  if(!$options['is_count']) {
-    if(!empty($options['limit'])) {
+  if (!$options['is_count']) {
+    if (!empty($options['limit'])) {
       $dao->limit((int) $options['offset'], (int) $options['limit']);
     }
     if (!empty($options['sort'])) {
@@ -871,7 +871,7 @@ function _civicrm_api3_get_unique_name_array(&$bao) {
  */
 function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, $entity = "", $autoFind = TRUE) {
   $result = array();
-  if(isset($params['options']) && !empty($params['options']['is_count'])) {
+  if (isset($params['options']) && !empty($params['options']['is_count'])) {
     return $dao->count();
   }
   if (empty($dao)) {
@@ -881,7 +881,7 @@ function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE,
     return array();
   }
 
-  if(isset($dao->count)) {
+  if (isset($dao->count)) {
     return $dao->count;
   }
 
@@ -899,7 +899,7 @@ function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE,
     }
     $result[$dao->id] = $tmp;
 
-    if(_civicrm_api3_custom_fields_are_required($entity, $params)) {
+    if (_civicrm_api3_custom_fields_are_required($entity, $params)) {
       _civicrm_api3_custom_data_get($result[$dao->id], $entity, $dao->id);
     }
   }
@@ -925,7 +925,7 @@ function _civicrm_api3_custom_fields_are_required($entity, $params) {
   $options = _civicrm_api3_get_options_from_params($params);
   //we check for possibility of 'custom' => 1 as well as specific custom fields
   $returnString = implode('', $options['return']) . implode('', array_keys($options['return']));
-  if(stristr($returnString, 'custom')) {
+  if (stristr($returnString, 'custom')) {
     return TRUE;
   }
 }
@@ -972,12 +972,12 @@ function _civicrm_api3_custom_format_params($params, &$values, $extends, $entity
   $values['custom'] = array();
   $checkCheckBoxField = FALSE;
   $entity = $extends;
-  if(in_array($extends, array('Household', 'Individual', 'Organization'))) {
+  if (in_array($extends, array('Household', 'Individual', 'Organization'))) {
     $entity = 'Contact';
   }
 
   $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'create'));
-  if(!$fields['is_error']) {
+  if (!$fields['is_error']) {
     // not sure if fields could be error - maybe change to using civicrm_api3 wrapper later - this is conservative
     $fields = $fields['values'];
     $checkCheckBoxField = TRUE;
@@ -1005,7 +1005,7 @@ function _civicrm_api3_format_params_for_create(&$params, $entity) {
   $nonGenericEntities = array('Contact', 'Individual', 'Household', 'Organization');
 
   $customFieldEntities = array_diff_key(CRM_Core_BAO_CustomQuery::$extendsMap, array_fill_keys($nonGenericEntities, 1));
-  if(!array_key_exists($entity, $customFieldEntities)) {
+  if (!array_key_exists($entity, $customFieldEntities)) {
     return;
   }
   $values = array();
@@ -1815,7 +1815,7 @@ function _civicrm_api3_validate_integer(&$params, &$fieldName, &$fieldInfo, $ent
     }
 
     // Check our field length
-    if(is_string($params[$fieldName]) && !empty($fieldInfo['maxlength']) && strlen($params[$fieldName]) > $fieldInfo['maxlength']
+    if (is_string($params[$fieldName]) && !empty($fieldInfo['maxlength']) && strlen($params[$fieldName]) > $fieldInfo['maxlength']
       ){
       throw new API_Exception( $params[$fieldName] . " is " . strlen($params[$fieldName]) . " characters  - longer than $fieldName length" . $fieldInfo['maxlength'] . ' characters',
         2100, array('field' => $fieldName, "max_length" => $fieldInfo['maxlength'])
@@ -1885,7 +1885,7 @@ function _civicrm_api3_validate_html(&$params, &$fieldName, $fieldInfo) {
 function _civicrm_api3_validate_string(&$params, &$fieldName, &$fieldInfo, $entity) {
   // If fieldname exists in params
   $value = CRM_Utils_Array::value($fieldName, $params, '');
-  if(!is_array($value)){
+  if (!is_array($value)){
     $value = (string) $value;
   }
   else{
@@ -1925,7 +1925,7 @@ function _civicrm_api3_validate_string(&$params, &$fieldName, &$fieldInfo, $enti
 function _civicrm_api3_api_match_pseudoconstant(&$params, $entity, $fieldName, $fieldInfo) {
   $options = CRM_Utils_Array::value('options', $fieldInfo);
   if (!$options) {
-    if(strtolower($entity) == 'profile' && !empty($fieldInfo['entity'])) {
+    if (strtolower($entity) == 'profile' && !empty($fieldInfo['entity'])) {
       // we need to get the options from the entity the field relates to
       $entity = $fieldInfo['entity'];
     }
index 1b601581a5e466e64141f0a5b0248ba053005aee..78988649b4648137aabbbbdd7dfde991bfde8bdd 100644 (file)
@@ -175,7 +175,7 @@ class civicrm_cli {
         $this->_joblog = TRUE;
       }
       else {
-        while(list($short, $long) = each($this->_additional_arguments)) {
+        while (list($short, $long) = each($this->_additional_arguments)) {
           if ($arg == '-' . $short || $arg == '--' . $long) {
             $property = '_' . $long;
             $this->$property = $value;
@@ -245,7 +245,7 @@ class civicrm_cli {
     }
 
     if (!empty($this->_user)) {
-      if(!CRM_Utils_System::authenticateScript(TRUE, $this->_user, $this->_password, TRUE, FALSE, FALSE)) {
+      if (!CRM_Utils_System::authenticateScript(TRUE, $this->_user, $this->_password, TRUE, FALSE, FALSE)) {
         $this->_log(ts("Failed to login as %1. Wrong username or password.", array('1' => $this->_user)));
         return FALSE;
       }
@@ -334,14 +334,14 @@ class civicrm_cli_csv_exporter extends civicrm_cli {
     $result = civicrm_api($this->_entity, 'Get', $this->_params);
     $first = TRUE;
     foreach ($result['values'] as $row) {
-      if($first) {
+      if ($first) {
         $columns = array_keys($row);
         fputcsv($out, $columns, $this->separator, '"');
         $first = FALSE;
       }
       //handle values returned as arrays (i.e. custom fields that allow multiple selections) by inserting a control character
       foreach ($row as &$field) {
-        if(is_array($field)) {
+        if (is_array($field)) {
           //convert to string
           $field = implode($field, CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
         }
@@ -397,7 +397,7 @@ class civicrm_cli_csv_file extends civicrm_cli {
     $this->header = $header;
     while (($data = fgetcsv($handle, 0, $this->separator)) !== FALSE) {
       // skip blank lines
-      if(count($data) == 1 && is_null($data[0])) { continue;
+      if (count($data) == 1 && is_null($data[0])) { continue;
       }
       $this->row++;
       $params = $this->convertLine($data);
index 53811c90ea7a80b98ec2dbf6a6d710275830b14d..1ea38db3a2800e0264ea52f6456ffad25e7f2949 100644 (file)
@@ -714,7 +714,7 @@ class InstallRequirements {
       $filename = $this->getBaseDir() . $filename;
     }
 
-    if (!is_writeable($filename)) {
+    if (!is_writable($filename)) {
       $name = NULL;
       if (function_exists('posix_getpwuid')) {
         $user = posix_getpwuid(posix_geteuid());
index d7b6f47232631cb3152c0ed7ce0fed5754a65494..8f18575c4b86b1141179f5f549fb654df2548cf3 100644 (file)
@@ -164,7 +164,7 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
     $this->assertEquals(date('Y-m-d', strtotime('now')), $result['values'][3]['join_date']);
     $result = $this->callAPISuccess('contribution', 'get', array('return' => 'total_amount'));
     $this->assertEquals(3, $result['count']);
-    foreach($result['values'] as $contribution) {
+    foreach ($result['values'] as $contribution) {
       $this-> assertEquals($this->callAPISuccess('line_item', 'getvalue', array(
         'contribution_id' => $contribution['id'],
         'return' => 'line_total',
@@ -183,7 +183,7 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
     $this->assertTrue($form->testProcessContribution($params));
     $result = $this->callAPISuccess('contribution', 'get', array('return' => 'total_amount'));
     $this->assertEquals(2, $result['count']);
-    foreach($result['values'] as $contribution) {
+    foreach ($result['values'] as $contribution) {
       $this-> assertEquals($this->callAPISuccess('line_item', 'getvalue', array(
        'contribution_id' => $contribution['id'],
        'return' => 'line_total',
index 7abc2361ef6db1fd95217f8d8e3d2fd06b17b46f..5aacef45b03ad3f2c5dc36f1ba2f1053a6659715 100644 (file)
@@ -174,7 +174,7 @@ class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase {
 
     $this->assertCount($recursion->schedule['start_action_offset'], $generatedEntities['civicrm_event'], 'Check if the number of events created are right');
     $actualDates = array();
-    foreach($generatedEntities['civicrm_event'] as $key => $val) {
+    foreach ($generatedEntities['civicrm_event'] as $key => $val) {
       $this->assertDBNotNull('CRM_Event_DAO_Event', $val, 'id', 'id', 'Check if repeating events were created.');
       $startDate = date('YmdHis', strtotime(CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $val, 'start_date', 'id')));
       $endDate = date('YmdHis', strtotime(CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $val, 'end_date', 'id')));
@@ -184,7 +184,7 @@ class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase {
     $resultDates = array_diff($actualDates, $expectedDates);
     $this->assertEquals(0, count($resultDates), "Check if all the value in expected array matches actual array");
 
-    foreach($generatedEntities['civicrm_tell_friend'] as $key => $val) {
+    foreach ($generatedEntities['civicrm_tell_friend'] as $key => $val) {
       $this->assertDBNotNull('CRM_Friend_DAO_Friend', $val, 'id', 'id', 'Check if friends were created in loop');
       $this->assertDBCompareValue('CRM_Friend_DAO_Friend', $val, 'entity_id', 'id', $generatedEntities['civicrm_event'][$key], 'Check DB if correct FK was maintained with event for Friend');
     }
index d86e5076a5ace32c6eae51fdffdaf95731be7d94..91348ff92bfed9ca00fdbd31a82efa2473fee3a7 100644 (file)
@@ -431,7 +431,7 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase {
       $groups[] = $dao->id;
     }
 
-    if(!empty($allGroups)) {
+    if (!empty($allGroups)) {
       //all groups is empty if we really mean all groups but if a filter like 'is_disabled' is already applied
       // it is populated, ajax calls from Manage Groups will leave empty but calls from New Mailing pass in a filtered list
       $currentGroups = array_intersect($groups, array_flip($allGroups));
index 1dd53ab109945dbb976e7fcb23ca685b935959d8..c07429131dcef6e676d3594a98ba43a8c72f197f 100644 (file)
@@ -104,7 +104,7 @@ class Utils {
      $backtrace = debug_backtrace();
      $dir_name  = dirname( __FILE__ );
      $cwd_len   = strlen( $dir_name ) + 1;
-     foreach$backtrace as $frame ){
+     foreach ($backtrace as $frame ){
      echo "      ";
      if ( array_key_exists( 'class', $frame ) ) {
      echo " class {$frame['class']}";
index 4ff94545c895fec8bf071640a74bb90af216f018..37a7693145dc38d0f8b87dba1ef3e60e61d4da61 100644 (file)
@@ -257,7 +257,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase {
   private function inlineEdit($block, $params, $valid = 're_open') {
     $this->openInlineForm($block);
     foreach ($params as $item => $val) {
-      switch(gettype($val)) {
+      switch (gettype($val)) {
         case 'boolean':
           $this->click($item);
           break;
@@ -309,7 +309,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase {
       if ($validate && $valid !== 'no_open') {
         $this->openInlineForm($block);
         foreach ($params as $item => $val) {
-          switch(gettype($val)) {
+          switch (gettype($val)) {
             case 'string':
               if ($val && substr($val, 0, 5) == 'date:') {
                 $val = date('m/d/Y', strtotime(trim(substr($val, 5))));
@@ -340,7 +340,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase {
     }
     // Verify there was a form error
     else {
-      switch($valid) {
+      switch ($valid) {
         case 'errorJs':
           $this->waitForElementPresent('css=label.error');
           break;
index bd671eb5e3476a165da219bf9e38e1f89f31f716..94bdd06cff0cf8660eecd7710c2999d1a616b38d 100644 (file)
@@ -624,7 +624,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
       3 => "{$firstName3}.{$lastName3}@example.com"
     );
 
-    foreach($contactEmails as $key => $value) {
+    foreach ($contactEmails as $key => $value) {
       $this->click('sort_name_navigation');
       $this->type('css=input#sort_name_navigation', $value);
       $this->typeKeys('css=input#sort_name_navigation', $value);
index e6e04636cb69e6a7d47d3d6629f53645c6310a28..83310dd7ad54ebc7fffb36e1f4689a71ea52bb43 100644 (file)
@@ -61,7 +61,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase {
     $isDefault = FALSE;
 
     //Add new organisation
-    if($orgName) {
+    if ($orgName) {
       $this->webtestAddOrganization($orgName);
     }
     $this->_testAddFinancialAccount($financialAccountTitle,
index cc91535ff749f3f6f18032a9db9474d40c01c4cf..00c00d5c602c57d24cde2e4c5a4d6b1ffb136da1 100644 (file)
@@ -56,7 +56,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
     $isDefault = FALSE;
 
     //Add new organisation
-    if($orgName) {
+    if ($orgName) {
       $this->webtestAddOrganization($orgName);
     }
 
index 2d853a456eeaed812277df328d91d0fc24962a5c..0a52cfa2d8fcdaa3b13c05b5520e9c93affd4af4 100644 (file)
@@ -346,7 +346,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     //verifying the registered participants
     $status = "Registered (test)";
 
-    foreach($contacts as $contact) {
+    foreach ($contacts as $contact) {
       $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$contact['sort_name']}']/../../td[9]", preg_quote($status));
       $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$contact['sort_name']}']/../../td[4]/a", preg_quote($eventName));
     }
index 883d070b1b857638aa22d35b486307140a1b3668..d81dfde532ae3ed0fe6f27def4e40205bf41a5c9 100644 (file)
@@ -52,7 +52,7 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase {
     $isDefault = FALSE;
 
     //Add new organisation
-    if($orgName) {
+    if ($orgName) {
       $this->webtestAddOrganization($orgName);
     }
 
@@ -114,7 +114,7 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase {
       $isDefault
     );
 
-    if($orgNameEdit) {
+    if ($orgNameEdit) {
       $orgName = $orgNameEdit;
     }
     $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']");
index 8b7e1224516761888c243455b147ee6b2817c7f7..cdede18d47d1583cd3f6299e294847ffb72c326d 100644 (file)
@@ -59,7 +59,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
     $this->click("css=ul.ui-autocomplete li");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    foreach($customDataParams['customFields'] as $key => $value){
+    foreach ($customDataParams['customFields'] as $key => $value){
       $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-summary-row']/div[@class='crm-label'][contains(text(), '$key')]"));
       $this->assertElementContainsText('address-block-1', "$value");
     }
@@ -84,7 +84,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
       'state' => 'State',
       'country' => 'Country',
     );
-    foreach$customDataParams['headers'] as $key => $value){
+    foreach ($customDataParams['headers'] as $key => $value){
       $headers[$key] = $value;
     }
 
index d751aeb8540eda36d45ef5a5768e785ecec85f1d..0615cb7b70c0f403fcac1337cd4ab56b555ae13b 100644 (file)
@@ -424,7 +424,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase {
     $summaryInfoLinks = array('Intended Recipients', 'Successful Deliveries', 'Tracked Opens', 'Click-throughs', 'Forwards', 'Replies', 'Bounces', 'Unsubscribe Requests', 'Opt-out Requests');
 
     //check for report and adv search links
-    foreach($summaryInfoLinks as $value) {
+    foreach ($summaryInfoLinks as $value) {
       $this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[1][text()='Report']"), "Report link missing for {$value}");
       $this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[2][text()='Advanced Search']"), "Advance Search link missing for {$value}");
     }
@@ -506,8 +506,8 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase {
    * @param $mailingReportUrl
    */
   public function criteriaCheck($criteriaCheck, $mailingReportUrl) {
-    foreach($criteriaCheck as $key => $infoFilter) {
-      foreach($infoFilter as $entity => $dataToCheck) {
+    foreach ($criteriaCheck as $key => $infoFilter) {
+      foreach ($infoFilter as $entity => $dataToCheck) {
         $this->open($mailingReportUrl);
         if ($entity == "report") {
           $this->clickLink("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$key}']]/descendant::td[3]/span/a[1][text()='Report']");
@@ -526,7 +526,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase {
    * @param $entity
    */
   public function _verifyCriteria($summaryInfo, $dataToCheck, $entity) {
-    foreach($dataToCheck as $key => $value) {
+    foreach ($dataToCheck as $key => $value) {
       if ($entity == 'report') {
         if ($key == 'report_name') {
           $this->assertElementContainsText('page-title', "{$value}");
index dfe5aa61572219f1a2eda188a29c9298a7b1b7bb..678bc213f84cbefe9ebb30500c5dd205ab7871a3 100644 (file)
@@ -127,7 +127,7 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa
       ),
     );
     $i = 2;
-    foreach($options as $index => $values){
+    foreach ($options as $index => $values){
       $this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}");
       // Because it tends to cause problems, all uses of sleep() must be justified in comments
       // Sleep should never be used for wait for anything to load from the server
@@ -136,7 +136,7 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa
       $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input", $values['membership_num_terms']);
       $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input", $values['label']);
       $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input", $values['amount']);
-      if($i > 3){
+      if ($i > 3){
         $this->click('link=another choice');
       }
       $i++;
index 3d7015ed738e7ee6eea8a2251f04dcb5ae085c43..f61d9b937b740be669e8989d3f48441eb82639e3 100644 (file)
@@ -139,14 +139,14 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas
 
           );
     $i = 2;
-    foreach($options as $index => $values){
+    foreach ($options as $index => $values){
       $this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}");
 
       $this->waitForElementPresent("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input");
       $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input", $values['membership_num_terms']);
       $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input", $values['label']);
       $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input", $values['amount']);
-      if($i > 3){
+      if ($i > 3){
         $this->click('link=another choice');
       }
       $i++;
@@ -419,7 +419,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas
    * @param bool $renew
    */
   public function _testMultilpeTermsMembershipRegistration($pageId, $contactParams, $memTypeTitle1, $term, $renew = FALSE){
-    if($renew){
+    if ($renew){
       $this->openCiviPage('member/search', 'reset=1', 'member_end_date_high');
       $this->type("sort_name", "{$contactParams['first_name']} {$contactParams['last_name']}");
       $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr");
index d719d4287dcfd4f2c74ff7e04f4b9cbf61803fe3..ddc81015a3281b5c7309c9c62df297faa317a9a9 100644 (file)
@@ -150,7 +150,7 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase {
       '6' => 'Completed',
     );
 
-    foreach($expected as $key => $value) {
+    foreach ($expected as $key => $value) {
       $this->verifyText("xpath=//div[@class='crm-accordion-wrapper']//table/tbody//tr/td[$key]", $value);
     }
 
index 074bc5b07e290b1d78b687a627e64ea8368fe806..c0093c71c691d485ce197ca325032aaf8a4d846b 100644 (file)
@@ -83,20 +83,20 @@ class WebTest_Profile_ProfileCountryState extends CiviSeleniumTestCase {
     $this->click('_qf_Field_next');
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    if($gid) {
+    if ($gid) {
       $this->openCiviPage('admin/setting/localization', 'reset=1', '_qf_Localization_next-bottom');
       $country = array(1001 => 'Afghanistan', 1013 => 'Australia', 1039 => 'Canada', 1101 => 'India');
       $enabledCountries = $this->getSelectOptions("countryLimit-t");
       $enabledStates = $this->getSelectOptions("provinceLimit-t");
       $newCountry = array();
-      foreach($country as $countryID => $countryName) {
-        if(!in_array($countryName, $enabledCountries)) {
+      foreach ($country as $countryID => $countryName) {
+        if (!in_array($countryName, $enabledCountries)) {
           $newCountry[$countryID] = $countryName;
           $this->addSelection("countryLimit-f", "label=$countryName");
           $this->click("xpath=//select[@id='countryLimit-f']/option[@value='$countryID']");
           $this->click("xpath=//tr[@class='crm-localization-form-block-countryLimit']/td[2]/table//tbody/tr/td[2]/input[@name='add']");
         }
-        if(!in_array($countryName, $enabledStates)) {
+        if (!in_array($countryName, $enabledStates)) {
           $this->addSelection("provinceLimit-f", "label=$countryName");
           $this->click("//option[@value='$countryID']");
           $this->click("xpath=//tr[@class='crm-localization-form-block-provinceLimit']/td[2]/table//tbody/tr/td[2]/input[@name='add']");
@@ -130,7 +130,7 @@ class WebTest_Profile_ProfileCountryState extends CiviSeleniumTestCase {
       $enabledCountries = $this->getSelectOptions("countryLimit-t");
       $enabledStates = $this->getSelectOptions("provinceLimit-t");
       $removed = FALSE;
-      foreach($newCountry as $countryID => $countryName) {
+      foreach ($newCountry as $countryID => $countryName) {
         $this->addSelection("countryLimit-t", "label=$countryName");
         $this->click("xpath=//select[@id='countryLimit-t']/option[@value='$countryID']");
         $this->click("xpath=//tr[@class='crm-localization-form-block-countryLimit']/td[2]/table//tbody/tr/td[2]/input[@name='remove']");
index 0f34e98c714dc000d158cd456ce6803c1b4bf932..707c9f1cac923d4005cf54329fb5a41eb0416bc5 100644 (file)
@@ -108,7 +108,7 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
         $apiStdFunctions = $this->getAllAPIStdFunctions();
         $this->assertGreaterThan(1, count($apiStdFunctions),"something has gone wrong getting the std functions in line " . __LINE__);
         $params = 'string';
-        foreach($apiStdFunctions as $key => $function){
+        foreach ($apiStdFunctions as $key => $function){
             if ( in_array( $function, $this->_skipFunctionList ) ) {
                 continue;
             }
index 113c2ddf04a858648d99c78b1c036eb7bdb6c069..1a47f574b0c8f659cc4f10aee4750464ee474648 100644 (file)
@@ -254,7 +254,7 @@ class api_v3_EventTest extends CiviUnitTestCase {
    */
   public function testCreateGetEventLegacyContributionTypeID() {
     $contributionTypeArray = array('contribution_type_id' => 3);
-    if(isset($this->_params[0]['financial_type_id'])){
+    if (isset($this->_params[0]['financial_type_id'])){
       //in case someone edits $this->_params & invalidates this test :-)
       unset($this->_params[0]['financial_type_id']);
     }
index bfaecf64a09cb5e0b20bbd2cd0c5f4f3d3f4e4ee..78b29d7cc9c46a189a9c839612df47e150c8e05d 100644 (file)
@@ -100,7 +100,7 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
    * @param int $groupID
    */
   public function createContactsInGroup($count, $groupID) {
-    for($i = 1; $i <= $count; $i++ ) {
+    for ($i = 1; $i <= $count; $i++ ) {
       $contactID = $this->individualCreate(array('first_name' => $count, 'email' => 'mail' . $i . '@nul.com'));
       $this->callAPISuccess('group_contact', 'create', array('contact_id' => $contactID, 'group_id' => $groupID, 'status' => 'Added'));
     }
@@ -114,7 +114,7 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
    */
   public function getRecipients($start, $count) {
     $recipients = array();
-    for($i = $start; $i < ($start + $count); $i++ ) {
+    for ($i = $start; $i < ($start + $count); $i++ ) {
       $recipients[][0] = 'mail' . $i . '@nul.com';
     }
     return $recipients;
index c1d0d51e9ce659ee4dffe75cb3c251bd305ced31..89f49bc1e932bce7182157898ebf37310f2449b9 100644 (file)
@@ -466,8 +466,8 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
   public function testMembershipGetFieldsOrder() {
     $result = $this->callAPISuccess('profile', 'getfields', array('action' => 'submit', 'profile_id' => 'membership_batch_entry'));
     $weight = 1;
-    foreach($result['values'] as $fieldName => $field) {
-      if($fieldName == 'profile_id') {
+    foreach ($result['values'] as $fieldName => $field) {
+      if ($fieldName == 'profile_id') {
         continue;
       }
       $this->assertEquals($field['weight'], $weight);
index b661d685a1885bf1ff1394b9cc7d02757401d44b..4ea4818b79e08bfac2c2c52d8fb7377e30f75add 100644 (file)
@@ -139,7 +139,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
    * @dataProvider getReportTemplates
    */
   public function testReportTemplateGetRowsAllReports($reportID) {
-    if(stristr($reportID, 'has existing issues')) {
+    if (stristr($reportID, 'has existing issues')) {
       $this->markTestIncomplete($reportID);
     }
     $result = $this->callAPISuccess('report_template', 'getrows', array(
@@ -151,10 +151,10 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
    * @dataProvider getReportTemplates
    */
   public function testReportTemplateGetStatisticsAllReports($reportID) {
-    if(stristr($reportID, 'has existing issues')) {
+    if (stristr($reportID, 'has existing issues')) {
       $this->markTestIncomplete($reportID);
     }
-    if(in_array($reportID, array('contribute/softcredit', 'contribute/bookkeeping'))) {
+    if (in_array($reportID, array('contribute/softcredit', 'contribute/bookkeeping'))) {
       $this->markTestIncomplete($reportID . " has non enotices when calling statistics fn");
     }
     $description = "Get Statistics from a report (note there isn't much data to get in the test DB :-(";
@@ -191,7 +191,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
 
     $reports = civicrm_api3('report_template', 'get', array('return' => 'value', 'options' => array('limit' => 500)));
     foreach ($reports['values'] as $report) {
-      if(empty($reportsToSkip[$report['value']])) {
+      if (empty($reportsToSkip[$report['value']])) {
         $reportTemplates[] = array($report['value']);
       }
       else {
index 851118bd932387a09332402979f1611dcd8f32b0..dc740b33fe12a1443dcc94071a245ac1efbccee0 100644 (file)
@@ -183,9 +183,9 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
     $invalidEntities = array('Individual', 'Organization', 'Household');
     $entitiesToFix = array('Case', 'Relationship');
     foreach ($entities as $entityName => $entity ) {
-      if(!in_array($entityName, $invalidEntities)
+      if (!in_array($entityName, $invalidEntities)
         && !in_array($entityName, $entitiesToFix)) {
-        if(!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) {
+        if (!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) {
           CRM_Core_BAO_ConfigSetting::enableComponent(self::$componentMap[$entityName]);
         }
         $customDataEntities[] = array($entityName);
@@ -489,7 +489,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
         ),
       ),
     );
-    if(empty($knownFailures[$entity]) || empty($knownFailures[$entity][$key])){
+    if (empty($knownFailures[$entity]) || empty($knownFailures[$entity][$key])){
       return array();
     }
     return $knownFailures[$entity][$key];
@@ -723,7 +723,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
       $this->checkLimitAgainstExpected($entityName, $case[0], $case[1], $case[2]);
 
       //non preferred / legacy syntax
-      if(isset($case[0]['options']['limit'])) {
+      if (isset($case[0]['options']['limit'])) {
         $this->checkLimitAgainstExpected($entityName, array('rowCount' => $case[0]['options']['limit']), $case[1], $case[2]);
         $this->checkLimitAgainstExpected($entityName, array('option_limit' => $case[0]['options']['limit']), $case[1], $case[2]);
         $this->checkLimitAgainstExpected($entityName, array('option.limit' => $case[0]['options']['limit']), $case[1], $case[2]);
@@ -779,7 +779,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
    */
   public function checkLimitAgainstExpected($entityName, $params, $limit, $message) {
     $result = $this->callAPISuccess($entityName, 'get', $params);
-    if($limit == 30) {
+    if ($limit == 30) {
       $this->assertGreaterThanOrEqual($limit, $result['count'], $message);
       $this->assertGreaterThanOrEqual($limit, $result['count'], $message);
     }
@@ -945,7 +945,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
     $this->assertNotEmpty($baoString, $entityName);
     $this->assertNotEmpty($entityName, $entityName);
     $fieldsGet = $fields = $this->callAPISuccess($entityName, 'getfields', array('action' => 'get'));
-    if($entityName != 'Pledge'){
+    if ($entityName != 'Pledge'){
       $fields = $this->callAPISuccess($entityName, 'getfields', array('action' => 'create'));
     }
     $fields = $fields['values'];
@@ -1015,7 +1015,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
             $entity[$fieldName] = 2;
           }
           elseif (!empty($specs['FKClassName'])) {
-            if($specs['FKClassName'] == $baoString){
+            if ($specs['FKClassName'] == $baoString){
               $entity[$fieldName] = (string) $entity2['id'];
             }
             else{
@@ -1052,7 +1052,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
         $options = $this->callAPISuccess($entityName, 'getoptions', array('context' => 'create', 'field' => $field));
         if (empty($options['values'])) {
           //eg. pdf_format id doesn't ship with any
-          if(isset($specs['pseudoconstant']['optionGroupName'])) {
+          if (isset($specs['pseudoconstant']['optionGroupName'])) {
             $optionGroupID = $this->callAPISuccess('option_group', 'getvalue', array('name' => 'pdf_format', 'return' => 'id'));
             $optionValue = $this->callAPISuccess('option_value', 'create', array('option_group_id' => $optionGroupID, 'label' => 'new option value'));
             $options['values'][] = $optionValue['id'];
@@ -1064,7 +1064,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
         'id' => $entity['id'],
         $field => isset($entity[$field]) ? $entity[$field] : NULL,
       );
-      if(isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
+      if (isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
         //api has special handling on these 2 fields for backward compatibility reasons
         $entity['contribution_type_id'] = $updateParams['financial_type_id'];
       }
@@ -1087,7 +1087,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
         $entity = array_merge($entity, $resetFKTo);
         $updateParams = array_merge($updateParams, $resetFKTo);
         $this->callAPISuccess($entityName, 'create', $updateParams);
-        if(isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
+        if (isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
           //api has special handling on these 2 fields for backward compatibility reasons
           $entity['contribution_type_id'] = $updateParams['financial_type_id'];
         }
@@ -1257,7 +1257,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
     }
     $baos = array();
     $i = 0;
-    while($i < $count) {
+    while ($i < $count) {
       // create entities
       $baoObj = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD'));
       $this->assertTrue(is_integer($baoObj->id), 'check first id');