From 22e263ad985b62de5cf7bdaf09555bfb3f0cd322 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 19:44:33 -0800 Subject: [PATCH] INFRA-132 - Put space after flow-control (if/switch/for/foreach/while) --- CRM/Activity/BAO/Query.php | 8 +- CRM/Activity/Form/Task.php | 2 +- CRM/Activity/Form/Task/Batch.php | 6 +- CRM/Activity/Page/AJAX.php | 8 +- CRM/Admin/Form/PaymentProcessor.php | 2 +- CRM/Admin/Form/Setting.php | 8 +- .../Form/Setting/UpdateConfigBackend.php | 2 +- CRM/Admin/Page/Access.php | 2 +- CRM/Admin/Page/Extensions.php | 2 +- CRM/Badge/BAO/Layout.php | 2 +- CRM/Campaign/BAO/Query.php | 2 +- CRM/Campaign/BAO/Survey.php | 4 +- CRM/Case/Page/DashBoard.php | 4 +- CRM/Contact/BAO/Group.php | 6 +- CRM/Contact/BAO/Relationship.php | 28 +++---- CRM/Contact/Form/CustomData.php | 2 +- CRM/Contact/Form/Edit/Address.php | 4 +- CRM/Contact/Form/Edit/CustomData.php | 2 +- CRM/Contact/Form/ProfileContact.php | 2 +- CRM/Contact/Form/Relationship.php | 2 +- CRM/Contact/Form/Search/Advanced.php | 2 +- .../Search/Custom/ContributionAggregate.php | 2 +- CRM/Contact/Form/Task/AlterPreferences.php | 6 +- CRM/Contact/Form/Task/EmailCommon.php | 2 +- CRM/Contact/Import/Form/MapField.php | 2 +- CRM/Contact/Page/AJAX.php | 4 +- CRM/Contact/Selector.php | 2 +- CRM/Contribute/BAO/Contribution/Utils.php | 2 +- CRM/Contribute/BAO/ContributionPage.php | 2 +- CRM/Contribute/BAO/ContributionSoft.php | 2 +- CRM/Contribute/BAO/Query.php | 6 +- CRM/Contribute/Form/Contribution/Main.php | 10 +-- .../Form/ContributionPage/AddProduct.php | 6 +- .../Form/ContributionPage/Amount.php | 2 +- CRM/Contribute/Form/ManagePremiums.php | 12 +-- CRM/Contribute/Form/Search.php | 6 +- CRM/Contribute/Form/SearchContribution.php | 2 +- CRM/Contribute/Form/Task/PDFLetter.php | 2 +- CRM/Contribute/Form/Task/PDFLetterCommon.php | 40 +++++----- CRM/Contribute/Import/Form/MapField.php | 2 +- CRM/Contribute/Import/Parser.php | 2 +- CRM/Contribute/Import/Parser/Contribution.php | 4 +- CRM/Contribute/Page/ManagePremiums.php | 2 +- CRM/Contribute/Task.php | 2 +- CRM/Core/BAO/ActionSchedule.php | 2 +- CRM/Core/BAO/Address.php | 4 +- CRM/Core/BAO/Block.php | 2 +- CRM/Core/BAO/CustomValueTable.php | 8 +- CRM/Core/BAO/Dashboard.php | 2 +- CRM/Core/BAO/Email.php | 2 +- CRM/Core/BAO/FinancialTrxn.php | 4 +- CRM/Core/BAO/MailSettings.php | 2 +- CRM/Core/BAO/Mapping.php | 4 +- CRM/Core/BAO/OptionGroup.php | 2 +- CRM/Core/BAO/OptionValue.php | 8 +- CRM/Core/BAO/RecurringEntity.php | 8 +- CRM/Core/BAO/SchemaHandler.php | 2 +- CRM/Core/BAO/Setting.php | 26 +++---- CRM/Core/BAO/UFField.php | 2 +- CRM/Core/BAO/UFMatch.php | 2 +- CRM/Core/BAO/WordReplacement.php | 2 +- CRM/Core/CodeGen/Specification.php | 6 +- CRM/Core/DAO.php | 2 +- CRM/Core/Form.php | 20 ++--- CRM/Core/Form/RecurringEntity.php | 10 +-- CRM/Core/Payment/AuthorizeNet.php | 4 +- CRM/Core/Payment/AuthorizeNetIPN.php | 2 +- CRM/Core/Payment/BaseIPN.php | 6 +- CRM/Core/Payment/PayPalProIPN.php | 20 ++--- CRM/Core/Permission.php | 10 +-- CRM/Core/Permission/Joomla.php | 2 +- CRM/Core/PseudoConstant.php | 4 +- CRM/Core/Region.php | 2 +- CRM/Custom/Import/Parser/Api.php | 2 +- CRM/Dedupe/BAO/QueryBuilder.php | 2 +- CRM/Dedupe/Merger.php | 2 +- CRM/Event/BAO/ParticipantPayment.php | 2 +- CRM/Event/BAO/Query.php | 4 +- CRM/Event/Form/EventFees.php | 2 +- CRM/Event/Form/ManageEvent/Fee.php | 2 +- CRM/Event/Form/ManageEvent/Registration.php | 4 +- CRM/Event/Form/ManageEvent/Repeat.php | 6 +- CRM/Event/Form/Participant.php | 24 +++--- CRM/Event/Form/ParticipantFeeSelection.php | 4 +- CRM/Event/Form/Registration/Confirm.php | 2 +- CRM/Event/Form/Registration/Register.php | 4 +- CRM/Event/Import/Parser/Participant.php | 2 +- CRM/Event/Task.php | 2 +- CRM/Extension/Downloader.php | 2 +- CRM/Extension/System.php | 2 +- CRM/Financial/BAO/ExportFormat/IIF.php | 4 +- CRM/Financial/BAO/FinancialAccount.php | 2 +- CRM/Financial/BAO/FinancialType.php | 2 +- CRM/Financial/Form/Export.php | 6 +- CRM/Financial/Page/FinancialType.php | 2 +- CRM/Grant/BAO/Grant.php | 2 +- CRM/Grant/BAO/Query.php | 4 +- CRM/Group/Page/AJAX.php | 2 +- CRM/Mailing/BAO/Mailing.php | 4 +- CRM/Mailing/BAO/TrackableURL.php | 2 +- CRM/Mailing/Form/Group.php | 2 +- CRM/Mailing/Form/Schedule.php | 2 +- CRM/Mailing/Form/Settings.php | 2 +- CRM/Mailing/Form/Test.php | 2 +- CRM/Mailing/Form/Upload.php | 2 +- CRM/Member/BAO/MembershipStatus.php | 2 +- CRM/Member/BAO/Query.php | 2 +- CRM/Member/Form/Membership.php | 2 +- CRM/Member/Form/MembershipBlock.php | 4 +- CRM/Member/Form/MembershipRenewal.php | 4 +- CRM/Member/Form/Task/Label.php | 4 +- CRM/Member/Import/Parser/Membership.php | 6 +- CRM/Member/Page/DashBoard.php | 2 +- CRM/Member/Task.php | 2 +- CRM/PCP/BAO/PCP.php | 4 +- CRM/Price/BAO/LineItem.php | 2 +- CRM/Price/BAO/PriceField.php | 4 +- CRM/Price/BAO/PriceFieldValue.php | 2 +- CRM/Price/BAO/PriceSet.php | 12 +-- CRM/Report/Form/Contribute/Recur.php | 4 +- CRM/Report/Utils/Report.php | 2 +- CRM/UF/Form/Inline/Preview.php | 2 +- CRM/Upgrade/Incremental/php/FourThree.php | 8 +- CRM/Upgrade/Incremental/php/FourTwo.php | 2 +- CRM/Utils/API/MatchOption.php | 4 +- CRM/Utils/Array.php | 2 +- CRM/Utils/Date.php | 2 +- CRM/Utils/DeprecatedUtils.php | 4 +- CRM/Utils/REST.php | 4 +- CRM/Utils/System/Base.php | 6 +- CRM/Utils/System/Drupal.php | 2 +- CRM/Utils/System/Drupal6.php | 2 +- CRM/Utils/System/DrupalBase.php | 2 +- CRM/Utils/System/Joomla.php | 2 +- CRM/Utils/System/WordPress.php | 2 +- CRM/Utils/SystemLogger.php | 2 +- CRM/Utils/Token.php | 6 +- api/api.php | 4 +- api/v3/Activity.php | 2 +- api/v3/Constant.php | 2 +- api/v3/Contact.php | 6 +- api/v3/Contribution.php | 12 +-- api/v3/Domain.php | 2 +- api/v3/EntityTag.php | 2 +- api/v3/Event.php | 8 +- api/v3/Generic.php | 12 +-- api/v3/Generic/Update.php | 2 +- api/v3/Group.php | 2 +- api/v3/MailingContact.php | 2 +- api/v3/Membership.php | 2 +- api/v3/MembershipStatus.php | 2 +- api/v3/OptionValue.php | 2 +- api/v3/Participant.php | 4 +- api/v3/PledgePayment.php | 2 +- api/v3/PriceFieldValue.php | 2 +- api/v3/PriceSet.php | 2 +- api/v3/Profile.php | 78 +++++++++---------- api/v3/Relationship.php | 4 +- api/v3/ReportTemplate.php | 10 +-- api/v3/Setting.php | 22 +++--- api/v3/System.php | 6 +- api/v3/utils.php | 58 +++++++------- bin/cli.class.php | 10 +-- install/index.php | 2 +- tests/phpunit/CRM/Batch/Form/EntryTest.php | 4 +- .../CRM/Core/BAO/RecurringEntityTest.php | 4 +- tests/phpunit/CRM/Group/Page/AjaxTest.php | 2 +- tests/phpunit/Utils.php | 2 +- .../WebTest/Contact/InlineFieldsEditTest.php | 6 +- .../WebTest/Contact/MergeContactsTest.php | 2 +- .../Contribute/ContactContextAddTest.php | 2 +- .../WebTest/Contribute/StandaloneAddTest.php | 2 +- .../WebTest/Event/AddParticipationTest.php | 2 +- .../Financial/FinancialAccountTest.php | 4 +- .../WebTest/Import/AddressImportTest.php | 4 +- tests/phpunit/WebTest/Mailing/MailingTest.php | 8 +- .../OfflineMembershipAddPricesetTest.php | 4 +- .../OnlineMembershipAddPricesetTest.php | 6 +- .../WebTest/Member/StandaloneAddTest.php | 2 +- .../WebTest/Profile/ProfileCountryState.php | 10 +-- tests/phpunit/api/v3/APIStandardsTest.php | 2 +- tests/phpunit/api/v3/EventTest.php | 2 +- .../phpunit/api/v3/JobProcessMailingTest.php | 4 +- tests/phpunit/api/v3/ProfileTest.php | 4 +- tests/phpunit/api/v3/ReportTemplateTest.php | 8 +- .../phpunit/api/v3/SyntaxConformanceTest.php | 22 +++--- 186 files changed, 489 insertions(+), 489 deletions(-) diff --git a/CRM/Activity/BAO/Query.php b/CRM/Activity/BAO/Query.php index e5ff26e68f..6276199b6a 100644 --- a/CRM/Activity/BAO/Query.php +++ b/CRM/Activity/BAO/Query.php @@ -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"), diff --git a/CRM/Activity/Form/Task.php b/CRM/Activity/Form/Task.php index cc3efb0e7f..f748a9bf40 100644 --- a/CRM/Activity/Form/Task.php +++ b/CRM/Activity/Form/Task.php @@ -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; } } diff --git a/CRM/Activity/Form/Task/Batch.php b/CRM/Activity/Form/Task/Batch.php index 0a3f41f1cb..1f8c6278eb 100755 --- a/CRM/Activity/Form/Task/Batch.php +++ b/CRM/Activity/Form/Task/Batch.php @@ -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; diff --git a/CRM/Activity/Page/AJAX.php b/CRM/Activity/Page/AJAX.php index 28d2a41f25..0720178e59 100644 --- a/CRM/Activity/Page/AJAX.php +++ b/CRM/Activity/Page/AJAX.php @@ -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'] = ''.$clientRelationships[$key]['name'].''; } @@ -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'] = ''. diff --git a/CRM/Admin/Form/PaymentProcessor.php b/CRM/Admin/Form/PaymentProcessor.php index 5f44eca512..90ab5b80e8 100644 --- a/CRM/Admin/Form/PaymentProcessor.php +++ b/CRM/Admin/Form/PaymentProcessor.php @@ -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(); diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index 14455159a7..fdbf570755 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -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'); } diff --git a/CRM/Admin/Form/Setting/UpdateConfigBackend.php b/CRM/Admin/Form/Setting/UpdateConfigBackend.php index ad18055e9e..d9eaea95c1 100644 --- a/CRM/Admin/Form/Setting/UpdateConfigBackend.php +++ b/CRM/Admin/Form/Setting/UpdateConfigBackend.php @@ -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) ); diff --git a/CRM/Admin/Page/Access.php b/CRM/Admin/Page/Access.php index b6a3dd5720..dfee8dff41 100644 --- a/CRM/Admin/Page/Access.php +++ b/CRM/Admin/Page/Access.php @@ -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 - if( version_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"'; diff --git a/CRM/Admin/Page/Extensions.php b/CRM/Admin/Page/Extensions.php index 0dbb4a2b44..5109f9c73d 100644 --- a/CRM/Admin/Page/Extensions.php +++ b/CRM/Admin/Page/Extensions.php @@ -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); } diff --git a/CRM/Badge/BAO/Layout.php b/CRM/Badge/BAO/Layout.php index 2f9a8372a1..1f6a867c6a 100644 --- a/CRM/Badge/BAO/Layout.php +++ b/CRM/Badge/BAO/Layout.php @@ -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; diff --git a/CRM/Campaign/BAO/Query.php b/CRM/Campaign/BAO/Query.php index 7510457a59..feae5e93af 100755 --- a/CRM/Campaign/BAO/Query.php +++ b/CRM/Campaign/BAO/Query.php @@ -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', diff --git a/CRM/Campaign/BAO/Survey.php b/CRM/Campaign/BAO/Survey.php index ad2fe8d347..fc12cb4a12 100644 --- a/CRM/Campaign/BAO/Survey.php +++ b/CRM/Campaign/BAO/Survey.php @@ -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'); } diff --git a/CRM/Case/Page/DashBoard.php b/CRM/Case/Page/DashBoard.php index 9d9ac409aa..c0a1839485 100644 --- a/CRM/Case/Page/DashBoard.php +++ b/CRM/Case/Page/DashBoard.php @@ -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'; } } diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 8b27b05ac9..ab2bf906c1 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -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'] .= '
'.ts('Child of').': ' . implode(', ', $title) . '
'; @@ -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; } } diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index 19021ce59e..ebc7a081d5 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -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)) { diff --git a/CRM/Contact/Form/CustomData.php b/CRM/Contact/Form/CustomData.php index 022534ea15..d863505cb0 100644 --- a/CRM/Contact/Form/CustomData.php +++ b/CRM/Contact/Form/CustomData.php @@ -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); diff --git a/CRM/Contact/Form/Edit/Address.php b/CRM/Contact/Form/Edit/Address.php index e79f564500..cdfaeef9c7 100644 --- a/CRM/Contact/Form/Edit/Address.php +++ b/CRM/Contact/Form/Edit/Address.php @@ -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 diff --git a/CRM/Contact/Form/Edit/CustomData.php b/CRM/Contact/Form/Edit/CustomData.php index 282d4dc1e3..265958ba17 100644 --- a/CRM/Contact/Form/Edit/CustomData.php +++ b/CRM/Contact/Form/Edit/CustomData.php @@ -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)) { diff --git a/CRM/Contact/Form/ProfileContact.php b/CRM/Contact/Form/ProfileContact.php index 27533c439e..9344c55744 100644 --- a/CRM/Contact/Form/ProfileContact.php +++ b/CRM/Contact/Form/ProfileContact.php @@ -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); } diff --git a/CRM/Contact/Form/Relationship.php b/CRM/Contact/Form/Relationship.php index 561f3d164b..2ec068edb5 100644 --- a/CRM/Contact/Form/Relationship.php +++ b/CRM/Contact/Form/Relationship.php @@ -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); } diff --git a/CRM/Contact/Form/Search/Advanced.php b/CRM/Contact/Form/Search/Advanced.php index d3d298332f..4f452ddce0 100644 --- a/CRM/Contact/Form/Search/Advanced.php +++ b/CRM/Contact/Form/Search/Advanced.php @@ -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; } } diff --git a/CRM/Contact/Form/Search/Custom/ContributionAggregate.php b/CRM/Contact/Form/Search/Custom/ContributionAggregate.php index 559e2f36a3..8a0422d77a 100644 --- a/CRM/Contact/Form/Search/Custom/ContributionAggregate.php +++ b/CRM/Contact/Form/Search/Custom/ContributionAggregate.php @@ -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); } diff --git a/CRM/Contact/Form/Task/AlterPreferences.php b/CRM/Contact/Form/Task/AlterPreferences.php index 8cabc53bf3..c634632410 100644 --- a/CRM/Contact/Form/Task/AlterPreferences.php +++ b/CRM/Contact/Form/Task/AlterPreferences.php @@ -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)); } diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index ee9ffebb44..e715b320f9 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -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, diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index a6e0823133..33f86c8a96 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -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"; } diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index 998f63e84b..3f659e3755 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -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; } diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 11c927f94d..461dc334c4 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -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) . "')"; } diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index e50a02fbd3..c4f75a232d 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -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; diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 468fe9c1d2..372f8fcc2c 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -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']; diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index e045313309..a08dbaf5bc 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -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(); diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 26c360547d..2880598500 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -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 diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index e88a5219be..e0b6786562 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -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 %1, 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.'); } diff --git a/CRM/Contribute/Form/ContributionPage/AddProduct.php b/CRM/Contribute/Form/ContributionPage/AddProduct.php index 0ee679cb22..c4694e42c5 100644 --- a/CRM/Contribute/Form/ContributionPage/AddProduct.php +++ b/CRM/Contribute/Form/ContributionPage/AddProduct.php @@ -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] ); } } - if( count( $financialType ) ){ + if (count( $financialType ) ){ $this->assign( 'financialType', $financialType ); } $this->add( diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index 6b885032da..438125c44d 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -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, diff --git a/CRM/Contribute/Form/ManagePremiums.php b/CRM/Contribute/Form/ManagePremiums.php index 82a45b2014..0a135e6d00 100644 --- a/CRM/Contribute/Form/ManagePremiums.php +++ b/CRM/Contribute/Form/ManagePremiums.php @@ -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] ); } } - if( count( $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') { diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index 69267ac13b..cc38b5821d 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -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; } } diff --git a/CRM/Contribute/Form/SearchContribution.php b/CRM/Contribute/Form/SearchContribution.php index a92ce45128..df72a0e2b7 100644 --- a/CRM/Contribute/Form/SearchContribution.php +++ b/CRM/Contribute/Form/SearchContribution.php @@ -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); } diff --git a/CRM/Contribute/Form/Task/PDFLetter.php b/CRM/Contribute/Form/Task/PDFLetter.php index be57082197..08ceac1d9f 100644 --- a/CRM/Contribute/Form/Task/PDFLetter.php +++ b/CRM/Contribute/Form/Task/PDFLetter.php @@ -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.'); } diff --git a/CRM/Contribute/Form/Task/PDFLetterCommon.php b/CRM/Contribute/Form/Task/PDFLetterCommon.php index d98f7eb8d9..7d2e6e99a3 100644 --- a/CRM/Contribute/Form/Task/PDFLetterCommon.php +++ b/CRM/Contribute/Form/Task/PDFLetterCommon.php @@ -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 = ""; } } @@ -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 == '' && !self::isValidHTMLWithTableSeparator($messageToken, $html_message)) { + if (empty($groupBy) || empty($contact['is_sent'][$groupBy][$groupByID])) { + if (!$validated && $realSeparator == '' && !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)); } diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index 516708f6ba..445dc45ba1 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -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"; } diff --git a/CRM/Contribute/Import/Parser.php b/CRM/Contribute/Import/Parser.php index e1a0c73238..1787bb1da0 100644 --- a/CRM/Contribute/Import/Parser.php +++ b/CRM/Contribute/Import/Parser.php @@ -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; } } diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 73b1823701..5f0acf6264 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -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'], diff --git a/CRM/Contribute/Page/ManagePremiums.php b/CRM/Contribute/Page/ManagePremiums.php index ac7a93c5a7..9e3a6832b1 100644 --- a/CRM/Contribute/Page/ManagePremiums.php +++ b/CRM/Contribute/Page/ManagePremiums.php @@ -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' ); } diff --git a/CRM/Contribute/Task.php b/CRM/Contribute/Task.php index 6f997a815e..47904af7d0 100644 --- a/CRM/Contribute/Task.php +++ b/CRM/Contribute/Task.php @@ -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]); } diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index 587ef5922c..5f3c281023 100644 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -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(); diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index d7af70f013..fa1262af5a 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -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 { diff --git a/CRM/Core/BAO/Block.php b/CRM/Core/BAO/Block.php index 4d45db3347..93ac3a3d98 100644 --- a/CRM/Core/BAO/Block.php +++ b/CRM/Core/BAO/Block.php @@ -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'); } diff --git a/CRM/Core/BAO/CustomValueTable.php b/CRM/Core/BAO/CustomValueTable.php index 2b1ca78553..e5d0334885 100644 --- a/CRM/Core/BAO/CustomValueTable.php +++ b/CRM/Core/BAO/CustomValueTable.php @@ -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]; } diff --git a/CRM/Core/BAO/Dashboard.php b/CRM/Core/BAO/Dashboard.php index d100387e2d..7df895acbc 100644 --- a/CRM/Core/BAO/Dashboard.php +++ b/CRM/Core/BAO/Dashboard.php @@ -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'); } } diff --git a/CRM/Core/BAO/Email.php b/CRM/Core/BAO/Email.php index e5ee11cb20..b009369d38 100644 --- a/CRM/Core/BAO/Email.php +++ b/CRM/Core/BAO/Email.php @@ -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); diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index ac43f72462..bcb0c089c7 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -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)) { diff --git a/CRM/Core/BAO/MailSettings.php b/CRM/Core/BAO/MailSettings.php index 83e73fb3f7..93b5ab351b 100644 --- a/CRM/Core/BAO/MailSettings.php +++ b/CRM/Core/BAO/MailSettings.php @@ -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); } diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 1b1c0bbbf7..9670fd100c 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -871,7 +871,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $js .= implode(', ', $elements); $js .= "]"; $js .= " - for(var i=0;ihtml->$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); } } diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index ec2073ae97..f40baf7826 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -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); diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 084b5450ed..c74529baca 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -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); } } diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index e9b481427e..04a078e382 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -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." ", 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); } } diff --git a/CRM/Core/Payment/AuthorizeNet.php b/CRM/Core/Payment/AuthorizeNet.php index 7e891d9b96..4719890b32 100644 --- a/CRM/Core/Payment/AuthorizeNet.php +++ b/CRM/Core/Payment/AuthorizeNet.php @@ -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(); diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php index 6257cc4d6a..adac3ac24d 100644 --- a/CRM/Core/Payment/AuthorizeNetIPN.php +++ b/CRM/Core/Payment/AuthorizeNetIPN.php @@ -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} "); diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index 55056becfb..c46a367833 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -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; diff --git a/CRM/Core/Payment/PayPalProIPN.php b/CRM/Core/Payment/PayPalProIPN.php index e2736d9d6b..ac937ea4e7 100644 --- a/CRM/Core/Payment/PayPalProIPN.php +++ b/CRM/Core/Payment/PayPalProIPN.php @@ -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') ))) { diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php index 29a58e381c..05cdc7d335 100644 --- a/CRM/Core/Permission.php +++ b/CRM/Core/Permission.php @@ -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; } } diff --git a/CRM/Core/Permission/Joomla.php b/CRM/Core/Permission/Joomla.php index b98112281c..0c87db1fe0 100644 --- a/CRM/Core/Permission/Joomla.php +++ b/CRM/Core/Permission/Joomla.php @@ -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); diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 26000e203b..cf9ca258a6 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -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'; } diff --git a/CRM/Core/Region.php b/CRM/Core/Region.php index 25d37829e4..8ba4f7faa2 100644 --- a/CRM/Core/Region.php +++ b/CRM/Core/Region.php @@ -173,7 +173,7 @@ class CRM_Core_Region { if ($snippet['disabled']) { continue; } - switch($snippet['type']) { + switch ($snippet['type']) { case 'markup': $html .= $snippet['markup']; break; diff --git a/CRM/Custom/Import/Parser/Api.php b/CRM/Custom/Import/Parser/Api.php index e638069085..603a472980 100644 --- a/CRM/Custom/Import/Parser/Api.php +++ b/CRM/Custom/Import/Parser/Api.php @@ -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; diff --git a/CRM/Dedupe/BAO/QueryBuilder.php b/CRM/Dedupe/BAO/QueryBuilder.php index 5607c5d4df..ee56688353 100644 --- a/CRM/Dedupe/BAO/QueryBuilder.php +++ b/CRM/Dedupe/BAO/QueryBuilder.php @@ -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) ))"; } diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 2934f8a20f..565c685cff 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -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( diff --git a/CRM/Event/BAO/ParticipantPayment.php b/CRM/Event/BAO/ParticipantPayment.php index 8e8c59682d..4a2008823b 100644 --- a/CRM/Event/BAO/ParticipantPayment.php +++ b/CRM/Event/BAO/ParticipantPayment.php @@ -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'"; diff --git a/CRM/Event/BAO/Query.php b/CRM/Event/BAO/Query.php index a40e68ec84..79fd0198b5 100644 --- a/CRM/Event/BAO/Query.php +++ b/CRM/Event/BAO/Query.php @@ -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)) { diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index f0cf91d1ed..c5fe459e51 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -234,7 +234,7 @@ class CRM_Event_Form_EventFees { $contribution = new CRM_Contribute_DAO_Contribution(); $contribution->id = $contriId; $contribution->find( TRUE ); - foreach( array('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); } diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index 8437c35669..b2513a9c6e 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -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'); } } diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index 707c2d5f65..92bb3c205d 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -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) { diff --git a/CRM/Event/Form/ManageEvent/Repeat.php b/CRM/Event/Form/ManageEvent/Repeat.php index 18add1a8e7..767cc0b35c 100644 --- a/CRM/Event/Form/ManageEvent/Repeat.php +++ b/CRM/Event/Form/ManageEvent/Repeat.php @@ -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; } diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 5a800e3596..24e5b742b4 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -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; } diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index a80d8f7d32..a88596a293 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -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'], diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 031f670923..406cce15c4 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -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 diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 0a397fafb6..2f910888e0 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -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); } diff --git a/CRM/Event/Import/Parser/Participant.php b/CRM/Event/Import/Parser/Participant.php index f0b8a96840..ca9037a79d 100644 --- a/CRM/Event/Import/Parser/Participant.php +++ b/CRM/Event/Import/Parser/Participant.php @@ -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']); } diff --git a/CRM/Event/Task.php b/CRM/Event/Task.php index c704ca3a8e..cd0ac30fcf 100644 --- a/CRM/Event/Task.php +++ b/CRM/Event/Task.php @@ -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]); } } diff --git a/CRM/Extension/Downloader.php b/CRM/Extension/Downloader.php index 26d6b1557c..a9698a5287 100644 --- a/CRM/Extension/Downloader.php +++ b/CRM/Extension/Downloader.php @@ -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( diff --git a/CRM/Extension/System.php b/CRM/Extension/System.php index 021b3a6e62..bdc93a0ae3 100644 --- a/CRM/Extension/System.php +++ b/CRM/Extension/System.php @@ -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 { diff --git a/CRM/Financial/BAO/ExportFormat/IIF.php b/CRM/Financial/BAO/ExportFormat/IIF.php index 93142945a3..bbb82aa04e 100644 --- a/CRM/Financial/BAO/ExportFormat/IIF.php +++ b/CRM/Financial/BAO/ExportFormat/IIF.php @@ -64,7 +64,7 @@ class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat public function export($exportParams) { parent::export( $exportParams ); - foreach( self::$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; diff --git a/CRM/Financial/BAO/FinancialAccount.php b/CRM/Financial/BAO/FinancialAccount.php index a48a31233a..a8a15e9fde 100644 --- a/CRM/Financial/BAO/FinancialAccount.php +++ b/CRM/Financial/BAO/FinancialAccount.php @@ -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); diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php index f8d4e9fdad..d0fcc8179b 100644 --- a/CRM/Financial/BAO/FinancialType.php +++ b/CRM/Financial/BAO/FinancialType.php @@ -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); diff --git a/CRM/Financial/Form/Export.php b/CRM/Financial/Form/Export.php index 4a9ddc5708..efa2bbc468 100644 --- a/CRM/Financial/Form/Export.php +++ b/CRM/Financial/Form/Export.php @@ -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]); diff --git a/CRM/Financial/Page/FinancialType.php b/CRM/Financial/Page/FinancialType.php index 0fb7a49d73..a7add5d117 100644 --- a/CRM/Financial/Page/FinancialType.php +++ b/CRM/Financial/Page/FinancialType.php @@ -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 ); diff --git a/CRM/Grant/BAO/Grant.php b/CRM/Grant/BAO/Grant.php index b3b33763e7..7873796c18 100644 --- a/CRM/Grant/BAO/Grant.php +++ b/CRM/Grant/BAO/Grant.php @@ -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]; diff --git a/CRM/Grant/BAO/Query.php b/CRM/Grant/BAO/Query.php index 0f265f2e80..cf29d36424 100644 --- a/CRM/Grant/BAO/Query.php +++ b/CRM/Grant/BAO/Query.php @@ -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); } } diff --git a/CRM/Group/Page/AJAX.php b/CRM/Group/Page/AJAX.php index 86aa51b196..a5ed2d72b1 100644 --- a/CRM/Group/Page/AJAX.php +++ b/CRM/Group/Page/AJAX.php @@ -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); diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index fb921c9d62..94a4c3f8c0 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -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); } diff --git a/CRM/Mailing/BAO/TrackableURL.php b/CRM/Mailing/BAO/TrackableURL.php index 0d6458d1de..473fc84c95 100644 --- a/CRM/Mailing/BAO/TrackableURL.php +++ b/CRM/Mailing/BAO/TrackableURL.php @@ -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)) { diff --git a/CRM/Mailing/Form/Group.php b/CRM/Mailing/Form/Group.php index cb381ab1bd..e2d6e9a76d 100644 --- a/CRM/Mailing/Form/Group.php +++ b/CRM/Mailing/Form/Group.php @@ -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"); } } diff --git a/CRM/Mailing/Form/Schedule.php b/CRM/Mailing/Form/Schedule.php index 996028525c..b59b388657 100644 --- a/CRM/Mailing/Form/Schedule.php +++ b/CRM/Mailing/Form/Schedule.php @@ -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); diff --git a/CRM/Mailing/Form/Settings.php b/CRM/Mailing/Form/Settings.php index 0d15ca5b47..824284858a 100644 --- a/CRM/Mailing/Form/Settings.php +++ b/CRM/Mailing/Form/Settings.php @@ -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); diff --git a/CRM/Mailing/Form/Test.php b/CRM/Mailing/Form/Test.php index da8146db10..30bb49ab5f 100644 --- a/CRM/Mailing/Form/Test.php +++ b/CRM/Mailing/Form/Test.php @@ -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); diff --git a/CRM/Mailing/Form/Upload.php b/CRM/Mailing/Form/Upload.php index 9d0c91b1c6..ee11d3a02c 100644 --- a/CRM/Mailing/Form/Upload.php +++ b/CRM/Mailing/Form/Upload.php @@ -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); diff --git a/CRM/Member/BAO/MembershipStatus.php b/CRM/Member/BAO/MembershipStatus.php index d875889f40..a679e9a8ce 100644 --- a/CRM/Member/BAO/MembershipStatus.php +++ b/CRM/Member/BAO/MembershipStatus.php @@ -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{ diff --git a/CRM/Member/BAO/Query.php b/CRM/Member/BAO/Query.php index 8583da38ce..753a4f8172 100644 --- a/CRM/Member/BAO/Query.php +++ b/CRM/Member/BAO/Query.php @@ -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]; } } diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 7a46b74d10..33b3329494 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -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) { diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php index 264692408f..43884b48f1 100644 --- a/CRM/Member/Form/MembershipBlock.php +++ b/CRM/Member/Form/MembershipBlock.php @@ -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' diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index b54420d99a..c5ca5d063c 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -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( diff --git a/CRM/Member/Form/Task/Label.php b/CRM/Member/Form/Task/Label.php index 32d19a21a3..179685e37d 100644 --- a/CRM/Member/Form/Task/Label.php +++ b/CRM/Member/Form/Task/Label.php @@ -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) { diff --git a/CRM/Member/Import/Parser/Membership.php b/CRM/Member/Import/Parser/Membership.php index b5eb6244a1..25185a91d0 100644 --- a/CRM/Member/Import/Parser/Membership.php +++ b/CRM/Member/Import/Parser/Membership.php @@ -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)) )) { diff --git a/CRM/Member/Page/DashBoard.php b/CRM/Member/Page/DashBoard.php index f96d8a09f9..f578c4c6f9 100644 --- a/CRM/Member/Page/DashBoard.php +++ b/CRM/Member/Page/DashBoard.php @@ -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; diff --git a/CRM/Member/Task.php b/CRM/Member/Task.php index bb28abbe3c..2509e040e5 100644 --- a/CRM/Member/Task.php +++ b/CRM/Member/Task.php @@ -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]); } } diff --git a/CRM/PCP/BAO/PCP.php b/CRM/PCP/BAO/PCP.php index b03aa3ee6f..66b74e8e9d 100644 --- a/CRM/PCP/BAO/PCP.php +++ b/CRM/PCP/BAO/PCP.php @@ -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 %1, 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 %1, 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!"; } } diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 1a7f49975d..e62eacbdfd 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -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)) { diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 710a7b3ab0..27cfdf9974 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -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; } diff --git a/CRM/Price/BAO/PriceFieldValue.php b/CRM/Price/BAO/PriceFieldValue.php index 8f9f8e92aa..05404c1f18 100644 --- a/CRM/Price/BAO/PriceFieldValue.php +++ b/CRM/Price/BAO/PriceFieldValue.php @@ -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)); } diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index d7c974aa40..2ce05eb47b 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -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); } diff --git a/CRM/Report/Form/Contribute/Recur.php b/CRM/Report/Form/Contribute/Recur.php index 52262405d0..bad820c4e7 100644 --- a/CRM/Report/Form/Contribute/Recur.php +++ b/CRM/Report/Form/Contribute/Recur.php @@ -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); diff --git a/CRM/Report/Utils/Report.php b/CRM/Report/Utils/Report.php index 7d8f6cb09d..5cbf13d54f 100644 --- a/CRM/Report/Utils/Report.php +++ b/CRM/Report/Utils/Report.php @@ -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})"; } } diff --git a/CRM/UF/Form/Inline/Preview.php b/CRM/UF/Form/Inline/Preview.php index ab4d71b517..fd55b05490 100644 --- a/CRM/UF/Form/Inline/Preview.php +++ b/CRM/UF/Form/Inline/Preview.php @@ -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"); } diff --git a/CRM/Upgrade/Incremental/php/FourThree.php b/CRM/Upgrade/Incremental/php/FourThree.php index 78a354322a..95f4466156 100644 --- a/CRM/Upgrade/Incremental/php/FourThree.php +++ b/CRM/Upgrade/Incremental/php/FourThree.php @@ -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 .= '
' . 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']; diff --git a/CRM/Upgrade/Incremental/php/FourTwo.php b/CRM/Upgrade/Incremental/php/FourTwo.php index 6fb33ae416..ce76d29358 100644 --- a/CRM/Upgrade/Incremental/php/FourTwo.php +++ b/CRM/Upgrade/Incremental/php/FourTwo.php @@ -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); diff --git a/CRM/Utils/API/MatchOption.php b/CRM/Utils/API/MatchOption.php index faf4152a45..cddeaba0b2 100644 --- a/CRM/Utils/API/MatchOption.php +++ b/CRM/Utils/API/MatchOption.php @@ -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; diff --git a/CRM/Utils/Array.php b/CRM/Utils/Array.php index 2c26507bb6..1e8cb66b5f 100644 --- a/CRM/Utils/Array.php +++ b/CRM/Utils/Array.php @@ -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]); } } diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php index 7cbc0beefc..f1d4a23f17 100644 --- a/CRM/Utils/Date.php +++ b/CRM/Utils/Date.php @@ -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; } diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 5e50e8b813..25a7c0d4ba 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -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); diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index 6860d05f7b..d0e62a291f 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -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"); } diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index 2a5806ea68..d978060828 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -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(); diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php index 409b70fcee..0dd24bb0b1 100644 --- a/CRM/Utils/System/Drupal.php +++ b/CRM/Utils/System/Drupal.php @@ -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']; } diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 6f8d2b82fd..b7bf37554d 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -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) ); diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 9884f47dcc..df77f22ac5 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -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; diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index ffe0b4d1c7..05135adfa3 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -676,7 +676,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { define('JVERSION', $jversion->getShortVersion()); } - if( version_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'; } diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index e64ecb7c46..588cb56d6a 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -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 ); } } diff --git a/CRM/Utils/SystemLogger.php b/CRM/Utils/SystemLogger.php index 891e2d258b..6b1222ced9 100644 --- a/CRM/Utils/SystemLogger.php +++ b/CRM/Utils/SystemLogger.php @@ -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(); diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index e96b894d21..08a9c9558f 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -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) { diff --git a/api/api.php b/api/api.php index 483069dde8..32a036fca4 100644 --- a/api/api.php +++ b/api/api.php @@ -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); diff --git a/api/v3/Activity.php b/api/v3/Activity.php index 5da510e8f9..b8ff55bd2f 100644 --- a/api/v3/Activity.php +++ b/api/v3/Activity.php @@ -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'); } diff --git a/api/v3/Constant.php b/api/v3/Constant.php index d49e767b51..21a429d036 100644 --- a/api/v3/Constant.php +++ b/api/v3/Constant.php @@ -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'); } } diff --git a/api/v3/Contact.php b/api/v3/Contact.php index cf70975aca..8513bcd3ce 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -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]; } diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 03bea847ce..5916409c5e 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -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 diff --git a/api/v3/Domain.php b/api/v3/Domain.php index eddb04cb55..a71b15826a 100644 --- a/api/v3/Domain.php +++ b/api/v3/Domain.php @@ -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'] diff --git a/api/v3/EntityTag.php b/api/v3/EntityTag.php index 586b87fa80..071b8051ad 100644 --- a/api/v3/EntityTag.php +++ b/api/v3/EntityTag.php @@ -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{ diff --git a/api/v3/Event.php b/api/v3/Event.php index c08d30c0b1..629e8eddf5 100644 --- a/api/v3/Event.php +++ b/api/v3/Event.php @@ -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]; } } diff --git a/api/v3/Generic.php b/api/v3/Generic.php index 3de180b9ea..362c1c4388 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -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']; diff --git a/api/v3/Generic/Update.php b/api/v3/Generic/Update.php index ae28129d2e..41a87cfb23 100644 --- a/api/v3/Generic/Update.php +++ b/api/v3/Generic/Update.php @@ -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']); diff --git a/api/v3/Group.php b/api/v3/Group.php index b9155be9c8..22f7e38eb0 100644 --- a/api/v3/Group.php +++ b/api/v3/Group.php @@ -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'); } diff --git a/api/v3/MailingContact.php b/api/v3/MailingContact.php index 361e121320..85362a1208 100644 --- a/api/v3/MailingContact.php +++ b/api/v3/MailingContact.php @@ -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'); } diff --git a/api/v3/Membership.php b/api/v3/Membership.php index 2f795df4d7..d50c025f98 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -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) diff --git a/api/v3/MembershipStatus.php b/api/v3/MembershipStatus.php index b3eaa0edd8..aa2646a1c4 100644 --- a/api/v3/MembershipStatus.php +++ b/api/v3/MembershipStatus.php @@ -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; } diff --git a/api/v3/OptionValue.php b/api/v3/OptionValue.php index 4217ea1a76..0067508464 100644 --- a/api/v3/OptionValue.php +++ b/api/v3/OptionValue.php @@ -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(); } diff --git a/api/v3/Participant.php b/api/v3/Participant.php index 3ad986fc68..0dea44820a 100644 --- a/api/v3/Participant.php +++ b/api/v3/Participant.php @@ -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 diff --git a/api/v3/PledgePayment.php b/api/v3/PledgePayment.php index ec3e0853af..57fc142477 100644 --- a/api/v3/PledgePayment.php +++ b/api/v3/PledgePayment.php @@ -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]); diff --git a/api/v3/PriceFieldValue.php b/api/v3/PriceFieldValue.php index f3a294ffea..74c444cc88 100644 --- a/api/v3/PriceFieldValue.php +++ b/api/v3/PriceFieldValue.php @@ -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']; } diff --git a/api/v3/PriceSet.php b/api/v3/PriceSet.php index 1c4c785b37..66ff4b8f76 100644 --- a/api/v3/PriceSet.php +++ b/api/v3/PriceSet.php @@ -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); diff --git a/api/v3/Profile.php b/api/v3/Profile.php index 713a21cd25..cf17237085 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -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; diff --git a/api/v3/Relationship.php b/api/v3/Relationship.php index 6a685598d7..2f6b159ace 100644 --- a/api/v3/Relationship.php +++ b/api/v3/Relationship.php @@ -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) { diff --git a/api/v3/ReportTemplate.php b/api/v3/ReportTemplate.php index e59dc6829b..ac5b66239d 100644 --- a/api/v3/ReportTemplate.php +++ b/api/v3/ReportTemplate.php @@ -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 diff --git a/api/v3/Setting.php b/api/v3/Setting.php index 4872fea4a0..c223be15b9 100644 --- a/api/v3/Setting.php +++ b/api/v3/Setting.php @@ -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{ diff --git a/api/v3/System.php b/api/v3/System.php index 0ef32ced58..c0a7563fb8 100644 --- a/api/v3/System.php +++ b/api/v3/System.php @@ -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]; } } diff --git a/api/v3/utils.php b/api/v3/utils.php index 9ab3b5e7a8..268f196d03 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -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']; } diff --git a/bin/cli.class.php b/bin/cli.class.php index 1b601581a5..78988649b4 100644 --- a/bin/cli.class.php +++ b/bin/cli.class.php @@ -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); diff --git a/install/index.php b/install/index.php index 53811c90ea..1ea38db3a2 100644 --- a/install/index.php +++ b/install/index.php @@ -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()); diff --git a/tests/phpunit/CRM/Batch/Form/EntryTest.php b/tests/phpunit/CRM/Batch/Form/EntryTest.php index d7b6f47232..8f18575c4b 100644 --- a/tests/phpunit/CRM/Batch/Form/EntryTest.php +++ b/tests/phpunit/CRM/Batch/Form/EntryTest.php @@ -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', diff --git a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php index 7abc2361ef..5aacef45b0 100644 --- a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php +++ b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php @@ -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'); } diff --git a/tests/phpunit/CRM/Group/Page/AjaxTest.php b/tests/phpunit/CRM/Group/Page/AjaxTest.php index d86e5076a5..91348ff92b 100644 --- a/tests/phpunit/CRM/Group/Page/AjaxTest.php +++ b/tests/phpunit/CRM/Group/Page/AjaxTest.php @@ -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)); diff --git a/tests/phpunit/Utils.php b/tests/phpunit/Utils.php index 1dd53ab109..c07429131d 100644 --- a/tests/phpunit/Utils.php +++ b/tests/phpunit/Utils.php @@ -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']}"; diff --git a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php index 4ff94545c8..37a7693145 100644 --- a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php +++ b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php @@ -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; diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index bd671eb5e3..94bdd06cff 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -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); diff --git a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php index e6e04636cb..83310dd7ad 100644 --- a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php @@ -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, diff --git a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php index cc91535ff7..00c00d5c60 100644 --- a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php @@ -56,7 +56,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { $isDefault = FALSE; //Add new organisation - if($orgName) { + if ($orgName) { $this->webtestAddOrganization($orgName); } diff --git a/tests/phpunit/WebTest/Event/AddParticipationTest.php b/tests/phpunit/WebTest/Event/AddParticipationTest.php index 2d853a456e..0a52cfa2d8 100644 --- a/tests/phpunit/WebTest/Event/AddParticipationTest.php +++ b/tests/phpunit/WebTest/Event/AddParticipationTest.php @@ -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)); } diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php index 883d070b1b..d81dfde532 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php @@ -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']"); diff --git a/tests/phpunit/WebTest/Import/AddressImportTest.php b/tests/phpunit/WebTest/Import/AddressImportTest.php index 8b7e122451..cdede18d47 100644 --- a/tests/phpunit/WebTest/Import/AddressImportTest.php +++ b/tests/phpunit/WebTest/Import/AddressImportTest.php @@ -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; } diff --git a/tests/phpunit/WebTest/Mailing/MailingTest.php b/tests/phpunit/WebTest/Mailing/MailingTest.php index d751aeb854..0615cb7b70 100644 --- a/tests/phpunit/WebTest/Mailing/MailingTest.php +++ b/tests/phpunit/WebTest/Mailing/MailingTest.php @@ -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}"); diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php index dfe5aa6157..678bc213f8 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php @@ -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++; diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php index 3d7015ed73..f61d9b937b 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php @@ -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"); diff --git a/tests/phpunit/WebTest/Member/StandaloneAddTest.php b/tests/phpunit/WebTest/Member/StandaloneAddTest.php index d719d4287d..ddc81015a3 100644 --- a/tests/phpunit/WebTest/Member/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Member/StandaloneAddTest.php @@ -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); } diff --git a/tests/phpunit/WebTest/Profile/ProfileCountryState.php b/tests/phpunit/WebTest/Profile/ProfileCountryState.php index 074bc5b07e..c0093c71c6 100644 --- a/tests/phpunit/WebTest/Profile/ProfileCountryState.php +++ b/tests/phpunit/WebTest/Profile/ProfileCountryState.php @@ -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']"); diff --git a/tests/phpunit/api/v3/APIStandardsTest.php b/tests/phpunit/api/v3/APIStandardsTest.php index 0f34e98c71..707c9f1cac 100644 --- a/tests/phpunit/api/v3/APIStandardsTest.php +++ b/tests/phpunit/api/v3/APIStandardsTest.php @@ -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; } diff --git a/tests/phpunit/api/v3/EventTest.php b/tests/phpunit/api/v3/EventTest.php index 113c2ddf04..1a47f574b0 100644 --- a/tests/phpunit/api/v3/EventTest.php +++ b/tests/phpunit/api/v3/EventTest.php @@ -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']); } diff --git a/tests/phpunit/api/v3/JobProcessMailingTest.php b/tests/phpunit/api/v3/JobProcessMailingTest.php index bfaecf64a0..78b29d7cc9 100644 --- a/tests/phpunit/api/v3/JobProcessMailingTest.php +++ b/tests/phpunit/api/v3/JobProcessMailingTest.php @@ -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; diff --git a/tests/phpunit/api/v3/ProfileTest.php b/tests/phpunit/api/v3/ProfileTest.php index c1d0d51e9c..89f49bc1e9 100644 --- a/tests/phpunit/api/v3/ProfileTest.php +++ b/tests/phpunit/api/v3/ProfileTest.php @@ -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); diff --git a/tests/phpunit/api/v3/ReportTemplateTest.php b/tests/phpunit/api/v3/ReportTemplateTest.php index b661d685a1..4ea4818b79 100644 --- a/tests/phpunit/api/v3/ReportTemplateTest.php +++ b/tests/phpunit/api/v3/ReportTemplateTest.php @@ -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 { diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 851118bd93..dc740b33fe 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -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'); -- 2.25.1