From 58d4d2d737f52fef85d7b61879a875061bef1893 Mon Sep 17 00:00:00 2001 From: colemanw Date: Tue, 4 Jul 2023 09:40:56 -0400 Subject: [PATCH] Autoformat php short array syntax --- CRM/Campaign/Form/Search.php | 28 +- CRM/Case/Audit/AuditConfig.php | 2 +- CRM/Contribute/Form/UpdateBilling.php | 42 +-- CRM/Contribute/Page/ContributionPage.php | 116 +++--- CRM/Core/BAO/CustomField.php | 12 +- CRM/Core/BAO/Note.php | 8 +- CRM/Core/BAO/Setting.php | 2 +- CRM/Core/BAO/Tag.php | 4 +- CRM/Core/Block.php | 112 +++--- CRM/Core/Region.php | 2 +- CRM/Event/Import/Form/MapField.php | 8 +- CRM/Event/Page/ParticipantListing.php | 4 +- CRM/Extension/Browser.php | 2 +- CRM/Extension/Container/Default.php | 16 +- CRM/Extension/Downloader.php | 20 +- CRM/Group/Form/Edit.php | 40 +- CRM/Import/Form/MapField.php | 4 +- CRM/Mailing/Event/BAO/MailingEventBounce.php | 4 +- CRM/Member/Import/Form/MapField.php | 16 +- CRM/Member/Page/DashBoard.php | 134 +++---- CRM/Pledge/BAO/PledgeBlock.php | 32 +- CRM/Report/Form.php | 2 +- CRM/Report/Form/Campaign/SurveyDetails.php | 178 ++++----- CRM/Report/Form/Contact/Summary.php | 82 ++-- CRM/Report/Form/Contribute/Repeat.php | 252 ++++++------- CRM/Report/Form/Event/ParticipantListing.php | 352 +++++++++--------- CRM/SMS/Page/Provider.php | 10 +- CRM/SMS/Provider.php | 42 +-- CRM/Upgrade/Incremental/php/FiveSixteen.php | 2 +- .../Incremental/php/TimezoneRevertTrait.php | 2 +- CRM/Utils/Check/Component.php | 4 +- CRM/Utils/Hook/Joomla.php | 2 +- CRM/Utils/Hook/UnitTests.php | 2 +- CRM/Utils/Hook/WordPress.php | 2 +- CRM/Utils/System/Drupal8.php | 4 +- CRM/Utils/System/WordPress.php | 4 +- Civi/Core/Themes.php | 36 +- Civi/Core/Themes/Resolvers.php | 4 +- Civi/Test/MailingTestTrait.php | 8 +- Civi/Test/TAP7.php | 8 +- Civi/Test/TAP9.php | 8 +- Civi/Test/TAPLegacy.php | 8 +- ext/ewaysingle/CRM/Core/Payment/eWAY.mgd.php | 12 +- .../CRM/Contact/Form/Search/Custom.php | 12 +- .../tests/phpunit/CRM/OAuth/MailSetupTest.php | 4 +- .../SearchDisplay/AbstractRunActionTest.php | 199 +++++----- install/civicrm.php | 4 +- install/index.php | 298 +++++++-------- 48 files changed, 1056 insertions(+), 1093 deletions(-) diff --git a/CRM/Campaign/Form/Search.php b/CRM/Campaign/Form/Search.php index ce473654a5..dcbf439915 100644 --- a/CRM/Campaign/Form/Search.php +++ b/CRM/Campaign/Form/Search.php @@ -65,11 +65,11 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { //operation for state machine. $this->_operation = CRM_Utils_Request::retrieve('op', 'String', $this, FALSE, 'reserve'); //validate operation. - if (!in_array($this->_operation, array( + if (!in_array($this->_operation, [ 'reserve', 'release', 'interview', - )) + ]) ) { $this->_operation = 'reserve'; $this->set('op', $this->_operation); @@ -139,11 +139,11 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { //append breadcrumb to survey dashboard. if (CRM_Campaign_BAO_Campaign::accessCampaign()) { $url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey'); - CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Survey(s)'), 'url' => $url))); + CRM_Utils_System::appendBreadCrumb([['title' => ts('Survey(s)'), 'url' => $url]]); } //set the form title. - $this->setTitle(ts('Find Respondents To %1', array(1 => ucfirst($this->_operation)))); + $this->setTitle(ts('Find Respondents To %1', [1 => ucfirst($this->_operation)])); } /** @@ -179,14 +179,14 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { $allTasks = CRM_Campaign_Task::permissionedTaskTitles(CRM_Core_Permission::getPermission()); //hack to serve right page to state machine. - $taskMapping = array( + $taskMapping = [ 'interview' => CRM_Campaign_Task::INTERVIEW, 'reserve' => CRM_Campaign_Task::RESERVE, 'release' => CRM_Campaign_Task::RELEASE, - ); + ]; $currentTaskValue = $taskMapping[$this->_operation] ?? NULL; - $taskValue = array($currentTaskValue => $allTasks[$currentTaskValue]); + $taskValue = [$currentTaskValue => $allTasks[$currentTaskValue]]; if ($this->_operation == 'interview' && !empty($this->_formValues['campaign_survey_id'])) { $activityTypes = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE); @@ -194,11 +194,11 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { $this->_formValues['campaign_survey_id'], 'activity_type_id' ); - $taskValue = array( + $taskValue = [ $currentTaskValue => ts('Record %1 Responses', - array(1 => $activityTypes[$surveyTypeId]) + [1 => $activityTypes[$surveyTypeId]] ), - ); + ]; } $this->addTaskMenu($taskValue); @@ -293,7 +293,7 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { } //format multi-select group and contact types. - foreach (array('group', 'contact_type') as $param) { + foreach (['group', 'contact_type'] as $param) { if ($this->_force) { continue; } @@ -401,12 +401,12 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { * @return array */ public function voterClause() { - $params = array('campaign_search_voter_for' => $this->_operation); + $params = ['campaign_search_voter_for' => $this->_operation]; - $clauseFields = array( + $clauseFields = [ 'surveyId' => 'campaign_survey_id', 'interviewerId' => 'survey_interviewer_id', - ); + ]; foreach ($clauseFields as $param => $key) { $params[$key] = $this->_formValues[$key] ?? NULL; diff --git a/CRM/Case/Audit/AuditConfig.php b/CRM/Case/Audit/AuditConfig.php index be1ee8a08d..5973879860 100644 --- a/CRM/Case/Audit/AuditConfig.php +++ b/CRM/Case/Audit/AuditConfig.php @@ -226,7 +226,7 @@ class CRM_Case_Audit_AuditConfig { } $this->sortRegion = $r; - uasort($f, array(&$this, "compareFields")); + uasort($f, [&$this, "compareFields"]); } /** diff --git a/CRM/Contribute/Form/UpdateBilling.php b/CRM/Contribute/Form/UpdateBilling.php index 272a7ed234..b7e60559b0 100644 --- a/CRM/Contribute/Form/UpdateBilling.php +++ b/CRM/Contribute/Form/UpdateBilling.php @@ -87,7 +87,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution if ($this->getSubscriptionDetails()->contact_id) { $fields = []; - $names = array( + $names = [ 'first_name', 'middle_name', 'last_name', @@ -96,7 +96,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}", "state_province_id-{$this->_bltID}", - ); + ]; foreach ($names as $name) { $fields[$name] = 1; } @@ -139,20 +139,20 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution $type = 'submit'; } - $this->addButtons(array( - array( + $this->addButtons([ + [ 'type' => $type, 'name' => ts('Save'), 'isDefault' => TRUE, - ), - array( + ], + [ 'type' => 'cancel', 'name' => ts('Cancel'), - ), - )); + ], + ]); CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, TRUE, TRUE); - $this->addFormRule(array('CRM_Contribute_Form_UpdateBilling', 'formRule'), $this); + $this->addFormRule(['CRM_Contribute_Form_UpdateBilling', 'formRule'], $this); } /** @@ -221,7 +221,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution // build tpl params if ($this->getSubscriptionDetails()->membership_id) { - $inputParams = array('id' => $this->getSubscriptionDetails()->membership_id); + $inputParams = ['id' => $this->getSubscriptionDetails()->membership_id]; CRM_Member_BAO_Membership::getValues($inputParams, $tplParams); $tplParams = $tplParams[$this->getSubscriptionDetails()->membership_id]; $tplParams['membership_status'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $tplParams['status_id']); @@ -234,24 +234,24 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution } else { $status = ts('Billing details for the recurring contribution of %1, every %2 %3 have been updated.', - array( + [ 1 => $this->getSubscriptionDetails()->amount, 2 => $this->getSubscriptionDetails()->frequency_interval, 3 => $this->getSubscriptionDetails()->frequency_unit, - ) + ] ); $msgTitle = ts('Details Updated'); $msgType = 'success'; - $tplParams = array( + $tplParams = [ 'recur_frequency_interval' => $this->getSubscriptionDetails()->frequency_interval, 'recur_frequency_unit' => $this->getSubscriptionDetails()->frequency_unit, 'amount' => $this->getSubscriptionDetails()->amount, - ); + ]; } // format new address for display - $addressParts = array("street_address", "city", "postal_code", "state_province", "country"); + $addressParts = ["street_address", "city", "postal_code", "state_province", "country"]; foreach ($addressParts as $part) { $addressParts[$part] = $processorParams[$part] ?? NULL; } @@ -260,7 +260,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution // format old address to store in activity details $this->_defaults["state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvince($this->_defaults["state_province-{$this->_bltID}"], FALSE); $this->_defaults["country-{$this->_bltID}"] = CRM_Core_PseudoConstant::country($this->_defaults["country-{$this->_bltID}"], FALSE); - $addressParts = array("street_address", "city", "postal_code", "state_province", "country"); + $addressParts = ["street_address", "city", "postal_code", "state_province", "country"]; foreach ($addressParts as $part) { $key = "{$part}-{$this->_bltID}"; $addressParts[$part] = $this->_defaults[$key] ?? NULL; @@ -296,7 +296,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution
{$this->_defaults['billingName']}
{$this->_defaults['address']}"; - $activityParams = array( + $activityParams = [ 'source_contact_id' => $this->getSubscriptionDetails()->contact_id, 'activity_type_id' => CRM_Core_PseudoConstant::getKey( 'CRM_Activity_BAO_Activity', @@ -307,7 +307,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution 'details' => $message, 'activity_date_time' => date('YmdHis'), 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Completed'), - ); + ]; $session = CRM_Core_Session::singleton(); $cid = $session->get('userID'); if ($cid) { @@ -317,11 +317,11 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution CRM_Activity_BAO_Activity::create($activityParams); list($donorDisplayName, $donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->getSubscriptionDetails()->contact_id); - $tplParams['contact'] = array('display_name' => $donorDisplayName); + $tplParams['contact'] = ['display_name' => $donorDisplayName]; $tplParams = array_merge($tplParams, CRM_Contribute_Form_AbstractEditPayment::formatCreditCardDetails($processorParams)); - $sendTemplateParams = array( + $sendTemplateParams = [ 'groupName' => $this->getSubscriptionDetails()->membership_id ? 'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution', 'workflow' => $this->getSubscriptionDetails()->membership_id ? 'membership_autorenew_billing' : 'contribution_recurring_billing', 'contactId' => $this->getSubscriptionDetails()->contact_id, @@ -331,7 +331,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution 'from' => CRM_Contribute_BAO_ContributionRecur::getRecurFromAddress($this->getContributionRecurID()), 'toName' => $donorDisplayName, 'toEmail' => $donorEmail, - ); + ]; list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); } else { diff --git a/CRM/Contribute/Page/ContributionPage.php b/CRM/Contribute/Page/ContributionPage.php index db9f1ba790..0ebc82cfcd 100644 --- a/CRM/Contribute/Page/ContributionPage.php +++ b/CRM/Contribute/Page/ContributionPage.php @@ -60,32 +60,32 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page { $deleteExtra = ts('Are you sure you want to delete this Contribution page?'); $copyExtra = ts('Are you sure you want to make a copy of this Contribution page?'); - self::$_actionLinks = array( - CRM_Core_Action::COPY => array( + self::$_actionLinks = [ + CRM_Core_Action::COPY => [ 'name' => ts('Make a Copy'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=copy&gid=%%id%%', 'title' => ts('Make a Copy of CiviCRM Contribution Page'), 'extra' => 'onclick = "return confirm(\'' . $copyExtra . '\');"', - ), - CRM_Core_Action::DISABLE => array( + ], + CRM_Core_Action::DISABLE => [ 'name' => ts('Disable'), 'title' => ts('Disable'), 'ref' => 'crm-enable-disable', - ), - CRM_Core_Action::ENABLE => array( + ], + CRM_Core_Action::ENABLE => [ 'name' => ts('Enable'), 'ref' => 'crm-enable-disable', 'title' => ts('Enable'), - ), - CRM_Core_Action::DELETE => array( + ], + CRM_Core_Action::DELETE => [ 'name' => ts('Delete'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=delete&reset=1&id=%%id%%', 'title' => ts('Delete Custom Field'), 'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"', - ), - ); + ], + ]; } return self::$_actionLinks; } @@ -101,75 +101,75 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page { $urlString = 'civicrm/admin/contribute/'; $urlParams = 'reset=1&action=update&id=%%id%%'; - self::$_configureActionLinks = array( - CRM_Core_Action::ADD => array( + self::$_configureActionLinks = [ + CRM_Core_Action::ADD => [ 'name' => ts('Title and Settings'), 'title' => ts('Title and Settings'), 'url' => $urlString . 'settings', 'qs' => $urlParams, 'uniqueName' => 'settings', - ), - CRM_Core_Action::UPDATE => array( + ], + CRM_Core_Action::UPDATE => [ 'name' => ts('Contribution Amounts'), 'title' => ts('Contribution Amounts'), 'url' => $urlString . 'amount', 'qs' => $urlParams, 'uniqueName' => 'amount', - ), - CRM_Core_Action::VIEW => array( + ], + CRM_Core_Action::VIEW => [ 'name' => ts('Membership Settings'), 'title' => ts('Membership Settings'), 'url' => $urlString . 'membership', 'qs' => $urlParams, 'uniqueName' => 'membership', - ), - CRM_Core_Action::EXPORT => array( + ], + CRM_Core_Action::EXPORT => [ 'name' => ts('Thank-you and Receipting'), 'title' => ts('Thank-you and Receipting'), 'url' => $urlString . 'thankyou', 'qs' => $urlParams, 'uniqueName' => 'thankyou', - ), - CRM_Core_Action::BASIC => array( + ], + CRM_Core_Action::BASIC => [ 'name' => ts('Tell a Friend'), 'title' => ts('Tell a Friend'), 'url' => $urlString . 'friend', 'qs' => $urlParams, 'uniqueName' => 'friend', - ), - CRM_Core_Action::PROFILE => array( + ], + CRM_Core_Action::PROFILE => [ 'name' => ts('Include Profiles'), 'title' => ts('Include Profiles'), 'url' => $urlString . 'custom', 'qs' => $urlParams, 'uniqueName' => 'custom', - ), - CRM_Core_Action::MAP => array( + ], + CRM_Core_Action::MAP => [ 'name' => ts('Contribution Widget'), 'title' => ts('Contribution Widget'), 'url' => $urlString . 'widget', 'qs' => $urlParams, 'uniqueName' => 'widget', - ), - CRM_Core_Action::FOLLOWUP => array( + ], + CRM_Core_Action::FOLLOWUP => [ 'name' => ts('Premiums'), 'title' => ts('Premiums'), 'url' => $urlString . 'premium', 'qs' => $urlParams, 'uniqueName' => 'premium', - ), - CRM_Core_Action::ADVANCED => array( + ], + CRM_Core_Action::ADVANCED => [ 'name' => ts('Personal Campaign Pages'), 'title' => ts('Personal Campaign Pages'), 'url' => $urlString . 'pcp', 'qs' => $urlParams, 'uniqueName' => 'pcp', - ), - ); - $context = array( + ], + ]; + $context = [ 'urlString' => $urlString, 'urlParams' => $urlParams, - ); + ]; CRM_Utils_Hook::tabset('civicrm/admin/contribute', self::$_configureActionLinks, $context); } @@ -185,16 +185,16 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page { if (!isset(self::$_onlineContributionLinks)) { $urlString = 'civicrm/contribute/transact'; $urlParams = 'reset=1&id=%%id%%'; - self::$_onlineContributionLinks = array( - CRM_Core_Action::RENEW => array( + self::$_onlineContributionLinks = [ + CRM_Core_Action::RENEW => [ 'name' => ts('Live Page'), 'title' => ts('Live Page'), 'url' => $urlString, 'qs' => $urlParams, 'fe' => TRUE, 'uniqueName' => 'live_page', - ), - CRM_Core_Action::PREVIEW => array( + ], + CRM_Core_Action::PREVIEW => [ 'name' => ts('Test-drive'), 'title' => ts('Test-drive'), 'url' => $urlString, @@ -202,8 +202,8 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page { // Addresses https://lab.civicrm.org/dev/core/issues/658 'fe' => TRUE, 'uniqueName' => 'test_drive', - ), - ); + ], + ]; } return self::$_onlineContributionLinks; @@ -226,29 +226,29 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page { $urlString = 'civicrm/contribute/search'; $urlParams = 'reset=1&contribution_page_id=%%id%%&force=1&test=0'; - self::$_contributionLinks = array( - CRM_Core_Action::DETACH => array( + self::$_contributionLinks = [ + CRM_Core_Action::DETACH => [ 'name' => ts('Current Month-To-Date'), 'title' => ts('Current Month-To-Date'), 'url' => $urlString, 'qs' => "{$urlParams}&receive_date_low={$monthDate}&receive_date_high={$now}", 'uniqueName' => 'current_month_to_date', - ), - CRM_Core_Action::REVERT => array( + ], + CRM_Core_Action::REVERT => [ 'name' => ts('Fiscal Year-To-Date'), 'title' => ts('Fiscal Year-To-Date'), 'url' => $urlString, 'qs' => "{$urlParams}&receive_date_low={$yearDate}&receive_date_high={$yearNow}", 'uniqueName' => 'fiscal_year_to_date', - ), - CRM_Core_Action::BROWSE => array( + ], + CRM_Core_Action::BROWSE => [ 'name' => ts('Cumulative'), 'title' => ts('Cumulative'), 'url' => $urlString, 'qs' => "{$urlParams}", 'uniqueName' => 'cumulative', - ), - ); + ], + ]; } return self::$_contributionLinks; @@ -277,14 +277,14 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page { ); // set breadcrumb to append to 2nd layer pages - $breadCrumb = array( - array( + $breadCrumb = [ + [ 'title' => ts('Manage Contribution Pages'), 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1' ), - ), - ); + ], + ]; // what action to take ? if ($action & CRM_Core_Action::ADD) { @@ -333,7 +333,7 @@ AND cp.page_type = 'contribute' "; if ($pageTitle = CRM_Core_DAO::singleValueQuery($query)) { - CRM_Core_Session::setStatus(ts('The \'%1\' cannot be deleted! You must Delete all Personal Campaign Page(s) related with this contribution page prior to deleting the page.', array(1 => $pageTitle)), ts('Deletion Error'), 'error'); + CRM_Core_Session::setStatus(ts('The \'%1\' cannot be deleted! You must Delete all Personal Campaign Page(s) related with this contribution page prior to deleting the page.', [1 => $pageTitle]), ts('Deletion Error'), 'error'); CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/contribute', 'reset=1')); } @@ -485,7 +485,7 @@ ORDER BY is_active desc, title asc $sectionsInfo = CRM_Utils_Array::value($dao->id, $contriPageSectionInfo, []); $contributions[$dao->id]['configureActionLinks'] = CRM_Core_Action::formLink(self::formatConfigureLinks($sectionsInfo), $action, - array('id' => $dao->id), + ['id' => $dao->id], ts('Configure'), TRUE, 'contributionpage.configure.actions', @@ -496,7 +496,7 @@ ORDER BY is_active desc, title asc //build the contributions links. $contributions[$dao->id]['contributionLinks'] = CRM_Core_Action::formLink(self::contributionLinks(), $action, - array('id' => $dao->id), + ['id' => $dao->id], ts('Contributions'), TRUE, 'contributionpage.contributions.search', @@ -507,7 +507,7 @@ ORDER BY is_active desc, title asc //build the online contribution links. $contributions[$dao->id]['onlineContributionLinks'] = CRM_Core_Action::formLink(self::onlineContributionLinks(), $action, - array('id' => $dao->id), + ['id' => $dao->id], ts('Links'), TRUE, 'contributionpage.online.links', @@ -518,7 +518,7 @@ ORDER BY is_active desc, title asc //build the normal action links. $contributions[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, - array('id' => $dao->id), + ['id' => $dao->id], ts('more'), TRUE, 'contributionpage.action.links', @@ -571,10 +571,10 @@ ORDER BY is_active desc, title asc if ($title) { $clauses[] = "title LIKE %1"; if (strpos($title, '%') !== FALSE) { - $params[1] = array(trim($title), 'String', FALSE); + $params[1] = [trim($title), 'String', FALSE]; } else { - $params[1] = array(trim($title), 'String', TRUE); + $params[1] = [trim($title), 'String', TRUE]; } } @@ -694,7 +694,7 @@ ORDER BY UPPER(LEFT(title, 1)) if (isset($link['class'])) { $classes = $link['class']; } - $link['class'] = array_merge($classes, array('crm-disabled')); + $link['class'] = array_merge($classes, ['crm-disabled']); } } diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 7eec0c77a3..8c7f3d0aa9 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -938,8 +938,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { 'time' => $field->time_format ? $field->time_format * 12 : FALSE, ]; if ($field->is_search_range && $search) { - $qf->add('datepicker', $elementName . '_from', $label, $fieldAttributes + array('placeholder' => ts('From')), FALSE, $params); - $qf->add('datepicker', $elementName . '_to', NULL, $fieldAttributes + array('placeholder' => ts('To')), FALSE, $params); + $qf->add('datepicker', $elementName . '_from', $label, $fieldAttributes + ['placeholder' => ts('From')], FALSE, $params); + $qf->add('datepicker', $elementName . '_to', NULL, $fieldAttributes + ['placeholder' => ts('To')], FALSE, $params); } else { $element = $qf->add('datepicker', $elementName, $label, $fieldAttributes, $useRequired && !$search, $params); @@ -2696,28 +2696,28 @@ WHERE f.id IN ($ids)"; case 'Int': $ruleName = 'integer'; $errorMsg = ts('%1 must be an integer (whole number).', - array(1 => $fieldTitle) + [1 => $fieldTitle] ); break; case 'Money': $ruleName = 'money'; $errorMsg = ts('%1 must in proper money format. (decimal point/comma/space is allowed).', - array(1 => $fieldTitle) + [1 => $fieldTitle] ); break; case 'Float': $ruleName = 'numeric'; $errorMsg = ts('%1 must be a number (with or without decimal point).', - array(1 => $fieldTitle) + [1 => $fieldTitle] ); break; case 'Link': $ruleName = 'wikiURL'; $errorMsg = ts('%1 must be valid Website.', - array(1 => $fieldTitle) + [1 => $fieldTitle] ); break; } diff --git a/CRM/Core/BAO/Note.php b/CRM/Core/BAO/Note.php index 6595969b94..8df7525a98 100644 --- a/CRM/Core/BAO/Note.php +++ b/CRM/Core/BAO/Note.php @@ -167,14 +167,14 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note implements \Civi\Core\HookInte $recentOther = []; if ($noteActions) { - $recentOther = array( + $recentOther = [ 'editUrl' => CRM_Utils_System::url('civicrm/contact/view/note', "reset=1&action=update&cid={$note->entity_id}&id={$note->id}&context=home" ), 'deleteUrl' => CRM_Utils_System::url('civicrm/contact/view/note', "reset=1&action=delete&cid={$note->entity_id}&id={$note->id}&context=home" ), - ); + ]; } // add the recently created Note @@ -327,7 +327,7 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note implements \Civi\Core\HookInte AND entity_id = %1 AND note is not null ORDER BY modified_date desc"; - $params = array(1 => array($id, 'Integer')); + $params = [1 => [$id, 'Integer']]; $dao = CRM_Core_DAO::executeQuery($query, $params); @@ -501,7 +501,7 @@ ORDER BY modified_date desc"; * Contact id whose notes to be deleted. */ public static function cleanContactNotes($contactID) { - $params = array(1 => array($contactID, 'Integer')); + $params = [1 => [$contactID, 'Integer']]; // delete all notes related to contribution $contributeQuery = "DELETE note.* diff --git a/CRM/Core/BAO/Setting.php b/CRM/Core/BAO/Setting.php index 9921e536b7..6e2d809119 100644 --- a/CRM/Core/BAO/Setting.php +++ b/CRM/Core/BAO/Setting.php @@ -288,7 +288,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { } else { $cb = Civi\Core\Resolver::singleton()->get($fieldSpec['validate_callback']); - if (!call_user_func_array($cb, array(&$value, $fieldSpec))) { + if (!call_user_func_array($cb, [&$value, $fieldSpec])) { throw new CRM_Core_Exception("validation failed for {$fieldSpec['name']} = $value based on callback {$fieldSpec['validate_callback']}"); } } diff --git a/CRM/Core/BAO/Tag.php b/CRM/Core/BAO/Tag.php index 152a797c34..cd2a0522e0 100644 --- a/CRM/Core/BAO/Tag.php +++ b/CRM/Core/BAO/Tag.php @@ -91,9 +91,9 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag { } else { if (!isset($refs[$dao->parent_id])) { - $refs[$dao->parent_id] = array( + $refs[$dao->parent_id] = [ 'children' => [], - ); + ]; } $refs[$dao->parent_id]['children'][$dao->id] = &$thisref; } diff --git a/CRM/Core/Block.php b/CRM/Core/Block.php index c9f81dc82b..4e034084f8 100644 --- a/CRM/Core/Block.php +++ b/CRM/Core/Block.php @@ -66,9 +66,9 @@ class CRM_Core_Block { if (!(self::$_properties)) { $config = CRM_Core_Config::singleton(); - self::$_properties = array( + self::$_properties = [ // set status item to 0 to disable block by default (at install) - self::CREATE_NEW => array( + self::CREATE_NEW => [ 'template' => 'CreateNew.tpl', 'info' => ts('CiviCRM Create New Record'), 'subject' => '', @@ -79,8 +79,8 @@ class CRM_Core_Block { 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation(), - ), - self::RECENTLY_VIEWED => array( + ], + self::RECENTLY_VIEWED => [ 'template' => 'RecentlyViewed.tpl', 'info' => ts('CiviCRM Recent Items'), 'subject' => ts('Recent Items'), @@ -91,8 +91,8 @@ class CRM_Core_Block { 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation(), - ), - self::DASHBOARD => array( + ], + self::DASHBOARD => [ 'template' => 'Dashboard.tpl', 'info' => ts('CiviCRM Contact Dashboard'), 'subject' => '', @@ -103,8 +103,8 @@ class CRM_Core_Block { 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation(), - ), - self::ADD => array( + ], + self::ADD => [ 'template' => 'Add.tpl', 'info' => ts('CiviCRM Quick Add'), 'subject' => ts('New Individual'), @@ -115,8 +115,8 @@ class CRM_Core_Block { 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation(), - ), - self::LANGSWITCH => array( + ], + self::LANGSWITCH => [ 'template' => 'LangSwitch.tpl', 'info' => ts('CiviCRM Language Switcher'), 'subject' => '', @@ -128,8 +128,8 @@ class CRM_Core_Block { 'status' => 1, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation(), - ), - self::EVENT => array( + ], + self::EVENT => [ 'template' => 'Event.tpl', 'info' => ts('CiviCRM Upcoming Events'), 'subject' => ts('Upcoming Events'), @@ -141,8 +141,8 @@ class CRM_Core_Block { 'status' => 0, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation(), - ), - self::FULLTEXT_SEARCH => array( + ], + self::FULLTEXT_SEARCH => [ 'template' => 'FullTextSearch.tpl', 'info' => ts('CiviCRM Full-text Search'), 'subject' => ts('Full-text Search'), @@ -153,8 +153,8 @@ class CRM_Core_Block { 'status' => 0, 'pages' => "civicrm\ncivicrm/*", 'region' => $config->userSystem->getDefaultBlockLocation(), - ), - ); + ], + ]; ksort(self::$_properties); } @@ -218,10 +218,10 @@ class CRM_Core_Block { $block = []; foreach (self::properties() as $id => $value) { if ($value['active']) { - if (in_array($id, array( + if (in_array($id, [ self::ADD, self::CREATE_NEW, - ))) { + ])) { $hasAccess = TRUE; if (!CRM_Core_Permission::check('add contacts') && !CRM_Core_Permission::check('edit groups') @@ -245,7 +245,7 @@ class CRM_Core_Block { continue; } - $block[$id] = array( + $block[$id] = [ 'info' => $value['info'], 'cache' => $value['cache'], 'region' => $value['region'], @@ -253,7 +253,7 @@ class CRM_Core_Block { 'pages' => $value['pages'], 'status' => $value['status'], 'weight' => $value['weight'], - ); + ]; } } @@ -281,10 +281,10 @@ class CRM_Core_Block { case self::ADD: $defaultLocation = CRM_Core_BAO_LocationType::getDefault(); $defaultPrimaryLocationId = $defaultLocation->id; - $values = array( + $values = [ 'postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'), 'primaryLocationType' => $defaultPrimaryLocationId, - ); + ]; foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) { $values[$greeting . '_id'] = CRM_Contact_BAO_Contact_Utils::defaultGreeting('Individual', $greeting); @@ -298,22 +298,22 @@ class CRM_Core_Block { case self::LANGSWITCH: // gives the currentPath without trailing empty lcMessages to be completed - $values = array('queryString' => CRM_Utils_System::getLinksUrl('lcMessages', TRUE, FALSE, FALSE)); + $values = ['queryString' => CRM_Utils_System::getLinksUrl('lcMessages', TRUE, FALSE, FALSE)]; self::setProperty(self::LANGSWITCH, 'templateValues', $values); break; case self::FULLTEXT_SEARCH: - $urlArray = array( + $urlArray = [ 'fullTextSearchID' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', 'CRM_Contact_Form_Search_Custom_FullText', 'value', 'name' ), - ); + ]; self::setProperty(self::FULLTEXT_SEARCH, 'templateValues', $urlArray); break; case self::RECENTLY_VIEWED: $recent = CRM_Utils_Recent::get(); - self::setProperty(self::RECENTLY_VIEWED, 'templateValues', array('recentlyViewed' => $recent)); + self::setProperty(self::RECENTLY_VIEWED, 'templateValues', ['recentlyViewed' => $recent]); break; case self::EVENT: @@ -336,14 +336,14 @@ class CRM_Core_Block { } // new activity (select target contact) - $shortCuts = array_merge($shortCuts, array( - array( + $shortCuts = array_merge($shortCuts, [ + [ 'path' => 'civicrm/activity', 'query' => 'action=add&reset=1&context=standalone', 'ref' => 'new-activity', 'title' => ts('Activity'), - ), - )); + ], + ]); $components = CRM_Core_Component::getEnabledComponents(); @@ -357,35 +357,35 @@ class CRM_Core_Block { } // new email (select recipients) - $shortCuts = array_merge($shortCuts, array( - array( + $shortCuts = array_merge($shortCuts, [ + [ 'path' => 'civicrm/activity/email/add', 'query' => 'atype=3&action=add&reset=1&context=standalone', 'ref' => 'new-email', 'title' => ts('Email'), - ), - )); + ], + ]); if (CRM_Core_Permission::check('edit groups')) { - $shortCuts = array_merge($shortCuts, array( - array( + $shortCuts = array_merge($shortCuts, [ + [ 'path' => 'civicrm/group/add', 'query' => 'reset=1', 'ref' => 'new-group', 'title' => ts('Group'), - ), - )); + ], + ]); } if (CRM_Core_Permission::check('manage tags')) { - $shortCuts = array_merge($shortCuts, array( - array( + $shortCuts = array_merge($shortCuts, [ + [ 'path' => 'civicrm/tag', 'query' => 'reset=1&action=add', 'ref' => 'new-tag', 'title' => ts('Tag'), - ), - )); + ], + ]); } if (empty($shortCuts)) { @@ -454,13 +454,13 @@ class CRM_Core_Block { private static function setTemplateDashboardValues() { static $dashboardLinks = []; if (CRM_Core_Permission::check('access Contact Dashboard')) { - $dashboardLinks = array( - array( + $dashboardLinks = [ + [ 'path' => 'civicrm/user', 'query' => 'reset=1', 'title' => ts('My Contact Dashboard'), - ), - ); + ], + ]; } $values = []; @@ -476,7 +476,7 @@ class CRM_Core_Block { $value['key'] = $dash['key'] ?? NULL; $values[] = $value; } - self::setProperty(self::DASHBOARD, 'templateValues', array('dashboardLinks' => $values)); + self::setProperty(self::DASHBOARD, 'templateValues', ['dashboardLinks' => $values]); } /** @@ -486,18 +486,18 @@ class CRM_Core_Block { static $shortCuts = NULL; if (!($shortCuts)) { - $shortCuts = array( - array( + $shortCuts = [ + [ 'path' => 'civicrm/mailing/send', 'query' => 'reset=1', 'title' => ts('Send Mailing'), - ), - array( + ], + [ 'path' => 'civicrm/mailing/browse', 'query' => 'reset=1', 'title' => ts('Browse Sent Mailings'), - ), - ); + ], + ]; } $values = []; @@ -507,7 +507,7 @@ class CRM_Core_Block { $value['title'] = $short['title']; $values[] = $value; } - self::setProperty(self::MAIL, 'templateValues', array('shortCuts' => $values)); + self::setProperty(self::MAIL, 'templateValues', ['shortCuts' => $values]); } /** @@ -529,7 +529,7 @@ class CRM_Core_Block { ); } - self::setProperty(self::EVENT, 'templateValues', array('eventBlock' => $info)); + self::setProperty(self::EVENT, 'templateValues', ['eventBlock' => $info]); } } @@ -602,7 +602,7 @@ class CRM_Core_Block { $block['name'] = 'block-civicrm'; $block['id'] = $block['name'] . '_' . $id; $block['subject'] = self::fetch($id, 'Subject.tpl', - array('subject' => self::getProperty($id, 'subject')) + ['subject' => self::getProperty($id, 'subject')] ); $block['content'] = self::fetch($id, self::getProperty($id, 'template'), self::getProperty($id, 'templateValues') diff --git a/CRM/Core/Region.php b/CRM/Core/Region.php index 7cb7f22254..613b867f2a 100644 --- a/CRM/Core/Region.php +++ b/CRM/Core/Region.php @@ -83,7 +83,7 @@ class CRM_Core_Region implements CRM_Core_Resources_CollectionInterface, CRM_Cor break; case 'callback': - $args = $snippet['arguments'] ?? array(&$snippet, &$html); + $args = $snippet['arguments'] ?? [&$snippet, &$html]; $html .= call_user_func_array($snippet['callback'], $args); break; diff --git a/CRM/Event/Import/Form/MapField.php b/CRM/Event/Import/Form/MapField.php index fe1c4dd2cd..ecdb464455 100644 --- a/CRM/Event/Import/Form/MapField.php +++ b/CRM/Event/Import/Form/MapField.php @@ -64,7 +64,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { */ public function buildQuickForm() { $this->addSavedMappingFields(); - $this->addFormRule(array('CRM_Event_Import_Form_MapField', 'formRule'), $this); + $this->addFormRule(['CRM_Event_Import_Form_MapField', 'formRule'], $this); $this->addMapper(); $this->addFormButtons(); } @@ -92,10 +92,10 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $importKeys[] = $mapperPart[0]; } // FIXME: should use the schema titles, not redeclare them - $requiredFields = array( + $requiredFields = [ 'contact_id' => ts('Contact ID'), 'event_id' => ts('Event ID'), - ); + ]; $contactFieldsBelowWeightMessage = self::validateRequiredContactMatchFields($self->getContactType(), $importKeys); @@ -116,7 +116,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { } elseif (!in_array('event_title', $importKeys)) { $errors['_qf_default'] .= ts('Missing required field: Provide %1 or %2', - array(1 => $title, 2 => 'Event Title') + [1 => $title, 2 => 'Event Title'] ) . '
'; } } diff --git a/CRM/Event/Page/ParticipantListing.php b/CRM/Event/Page/ParticipantListing.php index 23ec405645..7db433372e 100644 --- a/CRM/Event/Page/ParticipantListing.php +++ b/CRM/Event/Page/ParticipantListing.php @@ -41,7 +41,7 @@ class CRM_Event_Page_ParticipantListing extends CRM_Core_Page { $this->_id, 'title' ); - CRM_Utils_System::setTitle(ts('%1 - Participants', array(1 => $this->_eventTitle))); + CRM_Utils_System::setTitle(ts('%1 - Participants', [1 => $this->_eventTitle])); // we do not want to display recently viewed contacts since this is potentially a public page $this->assign('displayRecent', FALSE); @@ -65,7 +65,7 @@ class CRM_Event_Page_ParticipantListing extends CRM_Core_Page { ); if ($className == 'CRM_Event_Page_ParticipantListing') { CRM_Core_Error::statusBounce(ts("Participant listing code file cannot be '%1'", - array(1 => $className) + [1 => $className] )); } diff --git a/CRM/Extension/Browser.php b/CRM/Extension/Browser.php index f61caf3152..5b7b683fd7 100644 --- a/CRM/Extension/Browser.php +++ b/CRM/Extension/Browser.php @@ -209,7 +209,7 @@ class CRM_Extension_Browser { * @throws \CRM_Extension_Exception */ private function grabRemoteJson() { - set_error_handler(array('CRM_Extension_Browser', 'downloadError')); + set_error_handler(['CRM_Extension_Browser', 'downloadError']); if (FALSE === $this->getRepositoryUrl()) { // don't check if the user has configured civi not to check an external diff --git a/CRM/Extension/Container/Default.php b/CRM/Extension/Container/Default.php index 85bec22c4d..ce1d9f562c 100644 --- a/CRM/Extension/Container/Default.php +++ b/CRM/Extension/Container/Default.php @@ -33,26 +33,26 @@ class CRM_Extension_Container_Default extends CRM_Extension_Container_Basic { if (empty($this->baseDir) || !is_dir($this->baseDir)) { $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( + $errors[] = [ 'title' => ts('Invalid Base Directory'), 'message' => ts('The extensions directory is not properly set. Please go to the path setting page and correct it.
', - array( + [ 1 => $url, - ) + ] ), - ); + ]; } if (empty($this->baseUrl)) { $civicrmDestination = urlencode(CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1')); $url = CRM_Utils_System::url('civicrm/admin/setting/url', "reset=1&civicrmDestination={$civicrmDestination}"); - $errors[] = array( + $errors[] = [ 'title' => ts('Invalid Base URL'), 'message' => ts('The extensions URL is not properly set. Please go to the URL setting page and correct it.
', - array( + [ 1 => $url, - ) + ] ), - ); + ]; } return $errors; diff --git a/CRM/Extension/Downloader.php b/CRM/Extension/Downloader.php index dbf689a807..ccd6d20884 100644 --- a/CRM/Extension/Downloader.php +++ b/CRM/Extension/Downloader.php @@ -84,21 +84,21 @@ class CRM_Extension_Downloader { 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( + $errors[] = [ 'title' => ts('Directory Unwritable'), 'message' => ts("Your extensions directory is not set or is not writable. Click here to set the extensions directory.", - array( + [ 1 => $url, - ) + ] ), - ); + ]; } if (!class_exists('ZipArchive')) { - $errors[] = array( + $errors[] = [ 'title' => ts('ZIP Support Required'), 'message' => ts('You will not be able to install extensions at this time because your installation of PHP does not support ZIP archives. Please ask your system administrator to install the standard PHP-ZIP extension.'), - ); + ]; } if ($extensionInfo) { @@ -197,12 +197,12 @@ class CRM_Extension_Downloader { $extractedZipPath = $this->tmpDir . DIRECTORY_SEPARATOR . $zipSubDir; if (is_dir($extractedZipPath)) { if (!CRM_Utils_File::cleanDir($extractedZipPath, TRUE, FALSE)) { - CRM_Core_Session::setStatus(ts('Unable to extract the extension: %1 cannot be cleared', array(1 => $extractedZipPath)), ts('Installation Error'), 'error'); + CRM_Core_Session::setStatus(ts('Unable to extract the extension: %1 cannot be cleared', [1 => $extractedZipPath]), ts('Installation Error'), 'error'); return FALSE; } } if (!$zip->extractTo($this->tmpDir)) { - CRM_Core_Session::setStatus(ts('Unable to extract the extension to %1.', array(1 => $this->tmpDir)), ts('Installation Error'), 'error'); + CRM_Core_Session::setStatus(ts('Unable to extract the extension to %1.', [1 => $this->tmpDir]), ts('Installation Error'), 'error'); return FALSE; } $zip->close(); @@ -227,7 +227,7 @@ class CRM_Extension_Downloader { public function validateFiles($key, $extractedZipPath) { $filename = $extractedZipPath . DIRECTORY_SEPARATOR . CRM_Extension_Info::FILENAME; if (!is_readable($filename)) { - CRM_Core_Session::setStatus(ts('Failed reading data from %1 during installation', array(1 => $filename)), ts('Installation Error'), 'error'); + CRM_Core_Session::setStatus(ts('Failed reading data from %1 during installation', [1 => $filename]), ts('Installation Error'), 'error'); return FALSE; } @@ -235,7 +235,7 @@ class CRM_Extension_Downloader { $newInfo = CRM_Extension_Info::loadFromFile($filename); } catch (Exception $e) { - CRM_Core_Session::setStatus(ts('Failed reading data from %1 during installation', array(1 => $filename)), ts('Installation Error'), 'error'); + CRM_Core_Session::setStatus(ts('Failed reading data from %1 during installation', [1 => $filename]), ts('Installation Error'), 'error'); return FALSE; } diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index 120af8822d..647cbeed92 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -102,18 +102,16 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { // current set id $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); if ($this->_id) { - $breadCrumb = array( - array( + $breadCrumb = [ + [ 'title' => ts('Manage Groups'), - 'url' => CRM_Utils_System::url('civicrm/group', - 'reset=1' - ), - ), - ); + 'url' => CRM_Utils_System::url('civicrm/group', 'reset=1'), + ], + ]; CRM_Utils_System::appendBreadCrumb($breadCrumb); $this->_groupValues = []; - $params = array('id' => $this->_id); + $params = ['id' => $this->_id]; $this->_group = CRM_Contact_BAO_Group::retrieve($params, $this->_groupValues); $this->_title = $this->_groupValues['title']; } @@ -144,18 +142,18 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { CRM_Core_Error::statusBounce(ts('You do not have sufficient permission to change settings for this reserved group.')); } if (isset($this->_id)) { - $groupValues = array( + $groupValues = [ 'id' => $this->_id, 'title' => $this->_title, 'saved_search_id' => $this->_groupValues['saved_search_id'] ?? '', - ); + ]; $this->assign('editSmartGroupURL', isset($this->_groupValues['saved_search_id']) ? CRM_Contact_BAO_SavedSearch::getEditSearchUrl($this->_groupValues['saved_search_id']) : NULL); $groupValues['created_by'] = empty($this->_groupValues['created_id']) ? NULL : CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_groupValues['created_id'], 'sort_name', 'id'); $groupValues['modified_by'] = empty($this->_groupValues['modified_id']) ? NULL : CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_groupValues['modified_id'], 'sort_name', 'id'); $this->assign('group', $groupValues); - $this->setTitle(ts('Group Settings: %1', array(1 => $this->_title))); + $this->setTitle(ts('Group Settings: %1', [1 => $this->_title])); } $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/group', 'reset=1')); @@ -261,12 +259,12 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { $doParentCheck = !($this->_id && CRM_Core_BAO_Domain::isDomainGroup($this->_id)); } - $options = array( + $options = [ 'selfObj' => $this, 'parentGroups' => $parentGroups, 'doParentCheck' => $doParentCheck, - ); - $this->addFormRule(array('CRM_Group_Form_Edit', 'formRule'), $options); + ]; + $this->addFormRule(['CRM_Group_Form_Edit', 'formRule'], $options); } /** @@ -314,16 +312,16 @@ SELECT count(*) FROM civicrm_group WHERE title = %1 "; - $params = array(1 => array($title, 'String')); + $params = [1 => [$title, 'String']]; if ($self->_id) { $query .= "AND id <> %2"; - $params[2] = array($self->_id, 'Integer'); + $params[2] = [$self->_id, 'Integer']; } $grpCnt = CRM_Core_DAO::singleValueQuery($query, $params); if ($grpCnt) { - $errors['title'] = ts('Group \'%1\' already exists.', array(1 => $fields['title'])); + $errors['title'] = ts('Group \'%1\' already exists.', [1 => $fields['title']]); } } @@ -339,7 +337,7 @@ WHERE title = %1 $updateNestingCache = FALSE; if ($this->_action & CRM_Core_Action::DELETE) { CRM_Contact_BAO_Group::discard($this->_id); - CRM_Core_Session::setStatus(ts("The Group '%1' has been deleted.", array(1 => $this->_title)), ts('Group Deleted'), 'success'); + CRM_Core_Session::setStatus(ts("The Group '%1' has been deleted.", [1 => $this->_title]), ts('Group Deleted'), 'success'); $updateNestingCache = TRUE; } else { @@ -373,7 +371,7 @@ WHERE title = %1 // Set the entity id so it is available to postProcess hook consumers $this->setEntityId($group->id); - CRM_Core_Session::setStatus(ts('The Group \'%1\' has been saved.', array(1 => $group->title)), ts('Group Saved'), 'success'); + CRM_Core_Session::setStatus(ts('The Group \'%1\' has been saved.', [1 => $group->title]), ts('Group Saved'), 'success'); // Add context to the session, in case we are adding members to the group if ($this->_action & CRM_Core_Action::ADD) { @@ -433,7 +431,7 @@ WHERE title = %1 else { $required = FALSE; } - $form->add('select', 'parents', ts('Add Parent'), $parentGroupSelectValues, $required, array('class' => 'crm-select2', 'multiple' => TRUE)); + $form->add('select', 'parents', ts('Add Parent'), $parentGroupSelectValues, $required, ['class' => 'crm-select2', 'multiple' => TRUE]); } return $parentGroups; @@ -450,7 +448,7 @@ WHERE title = %1 public static function buildGroupOrganizations(&$form) { if (CRM_Core_Permission::check('administer Multiple Organizations') && CRM_Core_Permission::isMultisiteEnabled()) { //group organization Element - $props = array('api' => array('params' => array('contact_type' => 'Organization'))); + $props = ['api' => ['params' => ['contact_type' => 'Organization']]]; $form->addEntityRef('organization_id', ts('Organization'), $props); } } diff --git a/CRM/Import/Form/MapField.php b/CRM/Import/Form/MapField.php index 0ddea9ae84..ff1c6d0ca1 100644 --- a/CRM/Import/Form/MapField.php +++ b/CRM/Import/Form/MapField.php @@ -193,9 +193,7 @@ abstract class CRM_Import_Form_MapField extends CRM_Import_Forms { $fieldMessage .= ' ' . $field . '(weight ' . $weight . ')'; } if ($weightSum < $threshold) { - return $fieldMessage . ' ' . ts('(Sum of all weights should be greater than or equal to threshold: %1).', array( - 1 => $threshold, - )); + return $fieldMessage . ' ' . ts('(Sum of all weights should be greater than or equal to threshold: %1).', [1 => $threshold]); } return ''; } diff --git a/CRM/Mailing/Event/BAO/MailingEventBounce.php b/CRM/Mailing/Event/BAO/MailingEventBounce.php index 7a2d808ff2..38fecb9b30 100644 --- a/CRM/Mailing/Event/BAO/MailingEventBounce.php +++ b/CRM/Mailing/Event/BAO/MailingEventBounce.php @@ -224,7 +224,7 @@ class CRM_Mailing_Event_BAO_MailingEventBounce extends CRM_Mailing_Event_DAO_Mai $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$dao->contact_id}" ); - $results[] = array( + $results[] = [ 'name' => "{$dao->display_name}", 'email' => $dao->email, // FIXME: translate this @@ -232,7 +232,7 @@ class CRM_Mailing_Event_BAO_MailingEventBounce extends CRM_Mailing_Event_DAO_Mai ), 'reason' => $dao->reason, 'date' => CRM_Utils_Date::customFormat($dao->date), - ); + ]; } return $results; } diff --git a/CRM/Member/Import/Form/MapField.php b/CRM/Member/Import/Form/MapField.php index 50b4b134bd..8d04b84bcf 100644 --- a/CRM/Member/Import/Form/MapField.php +++ b/CRM/Member/Import/Form/MapField.php @@ -59,15 +59,15 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $importKeys[] = $mapperPart; } // FIXME: should use the schema titles, not redeclare them - $requiredFields = array( + $requiredFields = [ 'membership_contact_id' => ts('Contact ID'), 'membership_type_id' => ts('Membership Type'), 'membership_start_date' => ts('Membership Start Date'), - ); - $params = array( + ]; + $params = [ 'used' => 'Unsupervised', 'contact_type' => $self->getContactType(), - ); + ]; [$ruleFields, $threshold] = CRM_Dedupe_BAO_DedupeRuleGroup::dedupeRuleFieldsWeight($params); $weightSum = 0; foreach ($importKeys as $key => $val) { @@ -93,17 +93,17 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { if (!isset($errors['_qf_default'])) { $errors['_qf_default'] = ''; } - $errors['_qf_default'] .= ts('Missing required contact matching fields.') . " $fieldMessage " . ts('(Sum of all weights should be greater than or equal to threshold: %1).', array( + $errors['_qf_default'] .= ts('Missing required contact matching fields.') . " $fieldMessage " . ts('(Sum of all weights should be greater than or equal to threshold: %1).', [ 1 => $threshold, - )) . ' ' . ts('(OR Membership ID if update mode.)') . '
'; + ]) . ' ' . ts('(OR Membership ID if update mode.)') . '
'; } else { if (!isset($errors['_qf_default'])) { $errors['_qf_default'] = ''; } - $errors['_qf_default'] .= ts('Missing required field: %1', array( + $errors['_qf_default'] .= ts('Missing required field: %1', [ 1 => $title, - )) . '
'; + ]) . '
'; } } } diff --git a/CRM/Member/Page/DashBoard.php b/CRM/Member/Page/DashBoard.php index b95596fc68..b9b30216e4 100644 --- a/CRM/Member/Page/DashBoard.php +++ b/CRM/Member/Page/DashBoard.php @@ -55,7 +55,7 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { !checkdate(substr($ym, 4, 2), 1, substr($ym, 0, 4)) || substr($ym, 0, 1) == 0 ) { - CRM_Core_Error::statusBounce(ts('Invalid date query "%1" in URL (valid syntax is yyyymm).', array(1 => $ym))); + CRM_Core_Error::statusBounce(ts('Invalid date query "%1" in URL (valid syntax is yyyymm).', [1 => $ym])); } $isPreviousMonth = 0; @@ -82,94 +82,94 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { foreach ($membershipTypes as $key => $value) { - $membershipSummary[$key]['premonth']['new'] = array( + $membershipSummary[$key]['premonth']['new'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipJoins($key, $preMonth, $preMonthEnd), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['premonth']['renew'] = array( + $membershipSummary[$key]['premonth']['renew'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipRenewals($key, $preMonth, $preMonthEnd), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['premonth']['total'] = array( + $membershipSummary[$key]['premonth']['total'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $preMonth, $preMonthEnd), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['month']['new'] = array( + $membershipSummary[$key]['month']['new'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipJoins($key, $monthStart, $ymd), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['month']['renew'] = array( + $membershipSummary[$key]['month']['renew'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipRenewals($key, $monthStart, $ymd), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['month']['total'] = array( + $membershipSummary[$key]['month']['total'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $monthStart, $ymd), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['year']['new'] = array( + $membershipSummary[$key]['year']['new'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipJoins($key, $yearStart, $ymd), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['year']['renew'] = array( + $membershipSummary[$key]['year']['renew'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipRenewals($key, $yearStart, $ymd), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['year']['total'] = array( + $membershipSummary[$key]['year']['total'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $yearStart, $ymd), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['current']['total'] = array( + $membershipSummary[$key]['current']['total'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipCount($key, $current), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['total']['total'] = array('count' => CRM_Member_BAO_Membership::getMembershipCount($key, $ymd)); + $membershipSummary[$key]['total']['total'] = ['count' => CRM_Member_BAO_Membership::getMembershipCount($key, $ymd)]; //LCD also get summary stats for membership owners - $membershipSummary[$key]['premonth_owner']['premonth_owner'] = array( + $membershipSummary[$key]['premonth_owner']['premonth_owner'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $preMonth, $preMonthEnd, 0, 1), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['month_owner']['month_owner'] = array( + $membershipSummary[$key]['month_owner']['month_owner'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $monthStart, $ymd, 0, 1), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['year_owner']['year_owner'] = array( + $membershipSummary[$key]['year_owner']['year_owner'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $yearStart, $ymd, 0, 1), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['current_owner']['current_owner'] = array( + $membershipSummary[$key]['current_owner']['current_owner'] = [ 'count' => CRM_Member_BAO_Membership::getMembershipCount($key, $current, 0, 1), 'name' => $value, 'url' => FALSE, - ); + ]; - $membershipSummary[$key]['total_owner']['total_owner'] = array('count' => CRM_Member_BAO_Membership::getMembershipCount($key, $ymd, 0, 1)); + $membershipSummary[$key]['total_owner']['total_owner'] = ['count' => CRM_Member_BAO_Membership::getMembershipCount($key, $ymd, 0, 1)]; //LCD end } @@ -221,113 +221,113 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { $totalCountTotal_owner = $totalCountTotal_owner + $value['total_owner']['total_owner']['count']; } - $totalCount['premonth']['new'] = array( + $totalCount['premonth']['new'] = [ 'count' => $newCountPreMonth, 'url' => FALSE, - ); + ]; - $totalCount['premonth']['renew'] = array( + $totalCount['premonth']['renew'] = [ 'count' => $renewCountPreMonth, 'url' => FALSE, - ); + ]; - $totalCount['premonth']['total'] = array( + $totalCount['premonth']['total'] = [ 'count' => $totalCountPreMonth, 'url' => FALSE, - ); + ]; - $totalCount['month']['new'] = array( + $totalCount['month']['new'] = [ 'count' => $newCountMonth, 'url' => FALSE, - ); + ]; - $totalCount['month']['renew'] = array( + $totalCount['month']['renew'] = [ 'count' => $renewCountMonth, 'url' => FALSE, - ); + ]; - $totalCount['month']['total'] = array( + $totalCount['month']['total'] = [ 'count' => $totalCountMonth, 'url' => FALSE, - ); + ]; - $totalCount['year']['new'] = array( + $totalCount['year']['new'] = [ 'count' => $newCountYear, 'url' => FALSE, - ); + ]; - $totalCount['year']['renew'] = array( + $totalCount['year']['renew'] = [ 'count' => $renewCountYear, 'url' => FALSE, - ); + ]; - $totalCount['year']['total'] = array( + $totalCount['year']['total'] = [ 'count' => $totalCountYear, 'url' => FALSE, - ); + ]; - $totalCount['current']['total'] = array( + $totalCount['current']['total'] = [ 'count' => $totalCountCurrent, 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&membership_status_id=$status" ), - ); + ]; - $totalCount['total']['total'] = array( + $totalCount['total']['total'] = [ 'count' => $totalCountTotal, 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&membership_status_id=$status" ), - ); + ]; if (!$isCurrentMonth) { - $totalCount['total']['total'] = array( + $totalCount['total']['total'] = [ 'count' => $totalCountTotal, 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&membership_status_id=$status&start=&end=$ymd" ), - ); + ]; } // Activity search also unable to handle owner vs. inherited //LCD add owner values - $totalCount['premonth_owner']['premonth_owner'] = array( + $totalCount['premonth_owner']['premonth_owner'] = [ 'count' => $totalCountPreMonth_owner, 'url' => FALSE, // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&membership_status_id=$status&start=$preMonth&end=$preMonthEnd&owner=1"), - ); + ]; - $totalCount['month_owner']['month_owner'] = array( + $totalCount['month_owner']['month_owner'] = [ 'count' => $totalCountMonth_owner, 'url' => FALSE, // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&membership_status_id=$status&start=$monthStart&end=$ymd&owner=1"), - ); + ]; - $totalCount['year_owner']['year_owner'] = array( + $totalCount['year_owner']['year_owner'] = [ 'count' => $totalCountYear_owner, 'url' => FALSE, // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&membership_status_id=$status&start=$yearStart&end=$ymd&owner=1"), - ); + ]; - $totalCount['current_owner']['current_owner'] = array( + $totalCount['current_owner']['current_owner'] = [ 'count' => $totalCountCurrent_owner, 'url' => FALSE, // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&membership_status_id=$status&owner=1"), - ); + ]; - $totalCount['total_owner']['total_owner'] = array( + $totalCount['total_owner']['total_owner'] = [ 'count' => $totalCountTotal_owner, 'url' => FALSE, // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&membership_status_id=$status&owner=1"), - ); + ]; if (!$isCurrentMonth) { - $totalCount['total_owner']['total_owner'] = array( + $totalCount['total_owner']['total_owner'] = [ 'count' => $totalCountTotal_owner, 'url' => FALSE, // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&membership_status_id=$status&start=&end=$ymd&owner=1"), - ); + ]; } //LCD end diff --git a/CRM/Pledge/BAO/PledgeBlock.php b/CRM/Pledge/BAO/PledgeBlock.php index 37411474cc..c26bccc3e6 100644 --- a/CRM/Pledge/BAO/PledgeBlock.php +++ b/CRM/Pledge/BAO/PledgeBlock.php @@ -122,12 +122,12 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { if (!empty($form->_values['pledge_id'])) { //get all payments required details. $allPayments = []; - $returnProperties = array( + $returnProperties = [ 'status_id', 'scheduled_date', 'scheduled_amount', 'currency', - ); + ]; CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_PledgePayment', 'pledge_id', $form->_values['pledge_id'], $allPayments, $returnProperties ); @@ -139,27 +139,27 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $overduePayments = []; foreach ($allPayments as $payID => $value) { if ($allStatus[$value['status_id']] == 'Overdue') { - $overduePayments[$payID] = array( + $overduePayments[$payID] = [ 'id' => $payID, 'scheduled_amount' => CRM_Utils_Rule::cleanMoney($value['scheduled_amount']), 'scheduled_amount_currency' => $value['currency'], 'scheduled_date' => CRM_Utils_Date::customFormat($value['scheduled_date'], '%B %d' ), - ); + ]; } elseif (!$isNextPayment && $allStatus[$value['status_id']] == 'Pending' ) { // get the next payment. - $nextPayment = array( + $nextPayment = [ 'id' => $payID, 'scheduled_amount' => CRM_Utils_Rule::cleanMoney($value['scheduled_amount']), 'scheduled_amount_currency' => $value['currency'], 'scheduled_date' => CRM_Utils_Date::customFormat($value['scheduled_date'], '%B %d' ), - ); + ]; $isNextPayment = TRUE; } } @@ -168,22 +168,22 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $payments = []; if (!empty($overduePayments)) { foreach ($overduePayments as $id => $payment) { - $label = ts("%1 - due on %2 (overdue)", array( + $label = ts("%1 - due on %2 (overdue)", [ 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $payment), CRM_Utils_Array::value('scheduled_amount_currency', $payment)), 2 => $payment['scheduled_date'] ?? NULL, - )); + ]); $paymentID = $payment['id'] ?? NULL; - $payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, array('amount' => CRM_Utils_Array::value('scheduled_amount', $payment))); + $payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, ['amount' => CRM_Utils_Array::value('scheduled_amount', $payment)]); } } if (!empty($nextPayment)) { - $label = ts("%1 - due on %2", array( + $label = ts("%1 - due on %2", [ 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $nextPayment), CRM_Utils_Array::value('scheduled_amount_currency', $nextPayment)), 2 => $nextPayment['scheduled_date'] ?? NULL, - )); + ]); $paymentID = $nextPayment['id'] ?? NULL; - $payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, array('amount' => CRM_Utils_Array::value('scheduled_amount', $nextPayment))); + $payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, ['amount' => CRM_Utils_Array::value('scheduled_amount', $nextPayment)]); } // give error if empty or build form for payment. if (empty($payments)) { @@ -199,12 +199,12 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $pledgeBlock = self::getPledgeBlock($form->_id); // build form for pledge creation. - $pledgeOptions = array( + $pledgeOptions = [ '0' => ts('I want to make a one-time contribution'), '1' => ts('I pledge to contribute this amount every'), - ); + ]; $form->addRadio('is_pledge', ts('Pledge Frequency Interval'), $pledgeOptions, - NULL, array('
') + NULL, ['
'] ); $form->addElement('text', 'pledge_installments', ts('Installments'), ['size' => 3, 'aria-label' => ts('Installments')]); @@ -264,7 +264,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $form->assign('start_date_editable', TRUE); if ($field == 'calendar_month') { $form->assign('is_date', FALSE); - $form->setDefaults(array('start_date' => $value)); + $form->setDefaults(['start_date' => $value]); } } } diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index e175cfafd9..22c92527f3 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1426,7 +1426,7 @@ class CRM_Report_Form extends CRM_Core_Form { $fieldName === 'state_province_id' || $fieldName === 'county_id' ) { $element = $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations, - array('onchange' => "return showHideMaxMinVal( '$fieldName', this.value );") + ['onchange' => "return showHideMaxMinVal( '$fieldName', this.value );"] ); if (count($operations) <= 1) { diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index 32ccc01804..cd5f64153c 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -24,14 +24,14 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { protected $_summary = NULL; protected $_customGroupGroupBy = FALSE; - protected $_customGroupExtends = array( + protected $_customGroupExtends = [ 'Contact', 'Individual', 'Household', 'Organization', 'Activity', - ); - public $_drilldownReport = array('contact/detail' => 'Link to Detail Report'); + ]; + public $_drilldownReport = ['contact/detail' => 'Link to Detail Report']; private static $_surveyRespondentStatus; @@ -49,7 +49,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { */ public function __construct() { //filter options for survey activity status. - $responseStatus = array('' => ts('- Any -')); + $responseStatus = ['' => ts('- Any -')]; self::$_surveyRespondentStatus = []; $activityStatus = CRM_Core_PseudoConstant::activityStatus('name'); if ($statusId = array_search('Scheduled', $activityStatus)) { @@ -78,139 +78,139 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { //get all interviewers. $allSurveyInterviewers = CRM_Campaign_BAO_Survey::getInterviewers(); - $this->_columns = array( - 'civicrm_activity_contact' => array( + $this->_columns = [ + 'civicrm_activity_contact' => [ 'dao' => 'CRM_Activity_DAO_ActivityContact', - 'fields' => array('contact_id' => array('title' => ts('Interviewer Name'))), - 'filters' => array( - 'contact_id' => array( + 'fields' => ['contact_id' => ['title' => ts('Interviewer Name')]], + 'filters' => [ + 'contact_id' => [ 'name' => 'contact_id', 'title' => ts('Interviewer Name'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, - 'options' => array( + 'options' => [ '' => ts('- any interviewer -'), - ) + $allSurveyInterviewers, - ), - ), + ] + $allSurveyInterviewers, + ], + ], 'grouping' => 'survey-interviewer-fields', - ), - 'civicrm_contact' => array( + ], + 'civicrm_contact' => [ 'dao' => 'CRM_Contact_DAO_Contact', - 'fields' => array( - 'id' => array( + 'fields' => [ + 'id' => [ 'title' => ts('Contact ID'), 'no_display' => TRUE, 'required' => TRUE, - ), - 'sort_name' => array( + ], + 'sort_name' => [ 'title' => ts('Respondent Name'), 'required' => TRUE, 'no_repeat' => TRUE, - ), - ), - 'filters' => array( - 'sort_name' => array( + ], + ], + 'filters' => [ + 'sort_name' => [ 'title' => ts('Respondent Name'), 'operator' => 'like', - ), - ), + ], + ], 'grouping' => 'contact-fields', - 'order_bys' => array( - 'sort_name' => array( + 'order_bys' => [ + 'sort_name' => [ 'title' => ts('Respondent Name'), 'required' => TRUE, - ), - ), - ), - 'civicrm_phone' => array( + ], + ], + ], + 'civicrm_phone' => [ 'dao' => 'CRM_Core_DAO_Phone', - 'fields' => array( - 'phone' => array( + 'fields' => [ + 'phone' => [ 'name' => 'phone', 'title' => ts('Phone'), - ), - ), + ], + ], 'grouping' => 'location-fields', - ), - 'civicrm_email' => array( + ], + 'civicrm_email' => [ 'dao' => 'CRM_Core_DAO_Email', - 'fields' => array( - 'email' => array( + 'fields' => [ + 'email' => [ 'name' => 'email', 'title' => ts('Email'), - ), - ), + ], + ], 'grouping' => 'location-fields', - ), - ) + $this->getAddressColumns() + - array( - 'civicrm_activity' => array( + ], + ] + $this->getAddressColumns() + + [ + 'civicrm_activity' => [ 'dao' => 'CRM_Activity_DAO_Activity', 'alias' => 'survey_activity', - 'fields' => array( - 'survey_id' => array( + 'fields' => [ + 'survey_id' => [ 'name' => 'source_record_id', 'title' => ts('Survey'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Campaign_BAO_Survey::getSurveys(), - ), - 'survey_response' => array( + ], + 'survey_response' => [ 'name' => 'survey_response', 'title' => ts('Survey Responses'), - ), - 'details' => array( + ], + 'details' => [ 'name' => 'details', 'title' => ts('Note'), 'type' => 1, - ), - 'result' => array( + ], + 'result' => [ 'name' => 'result', 'required' => TRUE, 'title' => ts('Survey Result'), - ), - 'activity_date_time' => array( + ], + 'activity_date_time' => [ 'name' => 'activity_date_time', 'title' => ts('Date'), 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - ), - ), - 'filters' => array( - 'survey_id' => array( + ], + ], + 'filters' => [ + 'survey_id' => [ 'name' => 'source_record_id', 'title' => ts('Survey'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Campaign_BAO_Survey::getSurveys(), - ), - 'status_id' => array( + ], + 'status_id' => [ 'name' => 'status_id', 'title' => ts('Respondent Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $responseStatus, - ), - 'result' => array( + ], + 'result' => [ 'title' => ts('Survey Result'), 'type' => CRM_Utils_Type::T_STRING, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $resultOptions, - ), - 'activity_date_time' => array( + ], + 'activity_date_time' => [ 'title' => ts('Date'), 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, 'operatorType' => CRM_Report_Form::OP_DATE, - ), - ), + ], + ], 'grouping' => 'survey-activity-fields', - 'order_bys' => array( - 'activity_date_time' => array( + 'order_bys' => [ + 'activity_date_time' => [ 'title' => ts('Date'), - ), - ), - ), - ); + ], + ], + ], + ]; parent::__construct(); } @@ -386,11 +386,11 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { $fldId = substr($name, 7); $fieldIds[$fldId] = $fldId; $title = CRM_Utils_Array::value('label', $field, $field['title']); - $surveyResponseFields[$name] = array( + $surveyResponseFields[$name] = [ 'id' => $fldId, 'title' => $title, 'name' => "{$tableName}_{$name}", - ); + ]; } } } @@ -499,7 +499,7 @@ INNER JOIN civicrm_option_value val ON ( val.option_group_id = survey.result_id $surveyIds = $this->_params['survey_id_value'] ?? NULL; if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['result']) || - !in_array($this->_outputMode, array('print', 'pdf')) + !in_array($this->_outputMode, ['print', 'pdf']) ) { return; } @@ -610,13 +610,13 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) $responseFields = []; $fieldValueMap = []; - $properties = array( + $properties = [ 'id', 'data_type', 'html_type', 'column_name', 'option_group_id', - ); + ]; $responseField = CRM_Core_DAO::executeQuery($query); while ($responseField->fetch()) { @@ -628,10 +628,10 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) if ($responseField->option_group_id) { //show value for print and pdf. $value = $responseField->label; - if (in_array($this->_outputMode, array( + if (in_array($this->_outputMode, [ 'print', 'pdf', - ))) { + ])) { $value = $responseField->value; } $fieldValueMap[$responseField->option_group_id][$responseField->value] = $value; @@ -651,7 +651,7 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) } $hasData = TRUE; if ($respondentStatus == 'Reserved' && - in_array($this->_outputMode, array('print', 'pdf')) + in_array($this->_outputMode, ['print', 'pdf']) ) { $optGrpId = $responseFields[$name]['option_group_id'] ?? NULL; $options = CRM_Utils_Array::value($optGrpId, $fieldValueMap, []); @@ -684,18 +684,18 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) foreach ($responseFields as $key => $value) { if (substr($key, 0, 5) == 'phone' && !empty($value['location_type_id'])) { $fName = str_replace('-', '_', $key); - $this->_columns["civicrm_{$fName}"] = array( + $this->_columns["civicrm_{$fName}"] = [ 'dao' => 'CRM_Core_DAO_Phone', 'alias' => "phone_civireport_{$fName}", - 'fields' => array( - $fName => array_merge($value, array( + 'fields' => [ + $fName => array_merge($value, [ 'is_required' => '1', 'alias' => "phone_civireport_{$fName}", 'dbAlias' => "phone_civireport_{$fName}.phone", 'no_display' => TRUE, - )), - ), - ); + ]), + ], + ]; $this->_aliases["civicrm_phone_{$fName}"] = $this->_columns["civicrm_{$fName}"]['alias']; $this->_locationBasedPhoneField = TRUE; } @@ -759,7 +759,7 @@ INNER JOIN civicrm_custom_field cf ON ( cg.id = cf.custom_group_id ) if ($response->time_format) { $fldType = CRM_Utils_Type::T_TIMESTAMP; } - $field = array( + $field = [ 'name' => $response->column_name, 'type' => $fldType, 'title' => $title, @@ -773,7 +773,7 @@ INNER JOIN civicrm_custom_field cf ON ( cg.id = cf.custom_group_id ) $response->column_name, 'no_display' => TRUE, 'isSurveyResponseField' => TRUE, - ); + ]; $this->_columns[$resTable]['fields'][$fieldName] = $field; $this->_aliases[$resTable] = $this->_columns[$resTable]['alias']; diff --git a/CRM/Report/Form/Contact/Summary.php b/CRM/Report/Form/Contact/Summary.php index 4e658da660..f113667736 100644 --- a/CRM/Report/Form/Contact/Summary.php +++ b/CRM/Report/Form/Contact/Summary.php @@ -22,14 +22,14 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { protected $_phoneField = FALSE; - protected $_customGroupExtends = array( + protected $_customGroupExtends = [ 'Contact', 'Individual', 'Household', 'Organization', - ); + ]; - public $_drilldownReport = array('contact/detail' => 'Link to Detail Report'); + public $_drilldownReport = ['contact/detail' => 'Link to Detail Report']; /** * This report has not been optimised for group filtering. @@ -48,73 +48,73 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { */ public function __construct() { $this->_autoIncludeIndexedFieldsAsOrderBys = 1; - $this->_columns = array( - 'civicrm_contact' => array( + $this->_columns = [ + 'civicrm_contact' => [ 'dao' => 'CRM_Contact_DAO_Contact', 'fields' => array_merge( $this->getBasicContactFields(), - array( - 'modified_date' => array( + [ + 'modified_date' => [ 'title' => ts('Modified Date'), 'default' => FALSE, - ), - ) + ], + ] ), 'filters' => $this->getBasicContactFilters(), 'grouping' => 'contact-fields', - 'order_bys' => array( - 'sort_name' => array( + 'order_bys' => [ + 'sort_name' => [ 'title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC', - ), - 'first_name' => array( + ], + 'first_name' => [ 'name' => 'first_name', 'title' => ts('First Name'), - ), - 'gender_id' => array( + ], + 'gender_id' => [ 'name' => 'gender_id', 'title' => ts('Gender'), - ), - 'birth_date' => array( + ], + 'birth_date' => [ 'name' => 'birth_date', 'title' => ts('Birth Date'), - ), - 'contact_type' => array( + ], + 'contact_type' => [ 'title' => ts('Contact Type'), - ), - 'contact_sub_type' => array( + ], + 'contact_sub_type' => [ 'title' => ts('Contact Subtype'), - ), - ), - ), - 'civicrm_email' => array( + ], + ], + ], + 'civicrm_email' => [ 'dao' => 'CRM_Core_DAO_Email', - 'fields' => array( - 'email' => array( + 'fields' => [ + 'email' => [ 'title' => ts('Email'), 'no_repeat' => TRUE, - ), - ), + ], + ], 'grouping' => 'contact-fields', - 'order_bys' => array( - 'email' => array( + 'order_bys' => [ + 'email' => [ 'title' => ts('Email'), - ), - ), - ), - 'civicrm_phone' => array( + ], + ], + ], + 'civicrm_phone' => [ 'dao' => 'CRM_Core_DAO_Phone', - 'fields' => array( + 'fields' => [ 'phone' => NULL, - 'phone_ext' => array( + 'phone_ext' => [ 'title' => ts('Phone Extension'), - ), - ), + ], + ], 'grouping' => 'contact-fields', - ), - ) + $this->getAddressColumns(array('group_bys' => FALSE)); + ], + ] + $this->getAddressColumns(['group_bys' => FALSE]); $this->_groupFilter = TRUE; $this->_tagFilter = TRUE; diff --git a/CRM/Report/Form/Contribute/Repeat.php b/CRM/Report/Form/Contribute/Repeat.php index 54656a0528..f8be583a37 100644 --- a/CRM/Report/Form/Contribute/Repeat.php +++ b/CRM/Report/Form/Contribute/Repeat.php @@ -17,12 +17,12 @@ class CRM_Report_Form_Contribute_Repeat extends CRM_Report_Form { protected $_amountClauseWithAND = NULL; - protected $_customGroupExtends = array( + protected $_customGroupExtends = [ 'Contact', 'Individual', - ); + ]; - public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report'); + public $_drilldownReport = ['contribute/detail' => 'Link to Detail Report']; /** * Temp table for first time frame. @@ -78,72 +78,72 @@ class CRM_Report_Form_Contribute_Repeat extends CRM_Report_Form { * Class constructor. */ public function __construct() { - $this->_columns = array( - 'civicrm_contact' => array( + $this->_columns = [ + 'civicrm_contact' => [ 'dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-fields', 'fields' => array_merge( $this->getBasicContactFields(), - array( - 'sort_name' => array( + [ + 'sort_name' => [ 'title' => ts('Contact Name'), 'no_repeat' => TRUE, 'default' => TRUE, - ), - ) + ], + ] ), 'filters' => array_merge( - $this->getBasicContactFilters(array('deceased' => NULL)), - array( - 'percentage_change' => array( + $this->getBasicContactFilters(['deceased' => NULL]), + [ + 'percentage_change' => [ 'title' => ts('Percentage Change'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_INT, 'name' => 'percentage_change', 'dbAlias' => '( ( contribution_civireport2.total_amount_sum - contribution_civireport1.total_amount_sum ) * 100 / contribution_civireport1.total_amount_sum )', - ), - ) + ], + ] ), - 'group_bys' => array( - 'id' => array( + 'group_bys' => [ + 'id' => [ 'title' => ts('Contact'), 'default' => TRUE, - ), - ), - 'order_bys' => array( - 'sort_name' => array( + ], + ], + 'order_bys' => [ + 'sort_name' => [ 'title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC', - ), - 'first_name' => array( + ], + 'first_name' => [ 'title' => ts('First Name'), - ), - 'gender_id' => array( + ], + 'gender_id' => [ 'name' => 'gender_id', 'title' => ts('Gender'), - ), - 'birth_date' => array( + ], + 'birth_date' => [ 'name' => 'birth_date', 'title' => ts('Birth Date'), - ), - 'contact_type' => array( + ], + 'contact_type' => [ 'title' => ts('Contact Type'), - ), - 'contact_sub_type' => array( + ], + 'contact_sub_type' => [ 'title' => ts('Contact Subtype'), - ), - ), - ), - 'civicrm_email' => array( + ], + ], + ], + 'civicrm_email' => [ 'dao' => 'CRM_Core_DAO_Email', - 'fields' => array( - 'email' => array( + 'fields' => [ + 'email' => [ 'title' => ts('Email'), 'no_repeat' => TRUE, - ), - ), + ], + ], 'filters' => [ 'on_hold' => [ 'title' => ts('On Hold'), @@ -153,33 +153,33 @@ class CRM_Report_Form_Contribute_Repeat extends CRM_Report_Form { ], ], 'grouping' => 'contact-fields', - ), - 'civicrm_phone' => array( + ], + 'civicrm_phone' => [ 'dao' => 'CRM_Core_DAO_Phone', - 'fields' => array( - 'phone' => array( + 'fields' => [ + 'phone' => [ 'title' => ts('Phone'), 'no_repeat' => TRUE, - ), - ), + ], + ], 'grouping' => 'contact-fields', - ), - 'civicrm_financial_type' => array( + ], + 'civicrm_financial_type' => [ 'dao' => 'CRM_Financial_DAO_FinancialType', - 'fields' => array('financial_type' => array('title' => ts('Financial Type'))), + 'fields' => ['financial_type' => ['title' => ts('Financial Type')]], 'grouping' => 'contri-fields', - 'group_bys' => array( - 'financial_type' => array( + 'group_bys' => [ + 'financial_type' => [ 'name' => 'id', 'title' => ts('Financial Type'), - ), - ), - ), - 'civicrm_contribution' => array( + ], + ], + ], + 'civicrm_contribution' => [ 'dao' => 'CRM_Contribute_DAO_Contribution', - 'fields' => array( + 'fields' => [ 'contribution_source' => NULL, - 'total_amount1' => array( + 'total_amount1' => [ 'name' => 'total_amount', 'alias' => 'contribution1', 'title' => ts('Range One Stat'), @@ -187,8 +187,8 @@ class CRM_Report_Form_Contribute_Repeat extends CRM_Report_Form { 'default' => TRUE, 'required' => TRUE, 'clause' => 'contribution_civireport1.total_amount_count as contribution1_total_amount_count, contribution_civireport1.total_amount_sum as contribution1_total_amount_sum', - ), - 'total_amount2' => array( + ], + 'total_amount2' => [ 'name' => 'total_amount', 'alias' => 'contribution2', 'title' => ts('Range Two Stat'), @@ -196,50 +196,50 @@ class CRM_Report_Form_Contribute_Repeat extends CRM_Report_Form { 'default' => TRUE, 'required' => TRUE, 'clause' => 'contribution_civireport2.total_amount_count as contribution2_total_amount_count, contribution_civireport2.total_amount_sum as contribution2_total_amount_sum', - ), - ), + ], + ], 'grouping' => 'contri-fields', - 'filters' => array( - 'receive_date1' => array( + 'filters' => [ + 'receive_date1' => [ 'title' => ts('Initial Date Range'), 'default' => 'previous.year', 'operatorType' => CRM_Report_Form::OP_DATE, 'name' => 'receive_date', - ), - 'receive_date2' => array( + ], + 'receive_date2' => [ 'title' => ts('Second Date Range'), 'default' => 'this.year', 'operatorType' => CRM_Report_Form::OP_DATE, 'name' => 'receive_date', - ), - 'total_amount1' => array( + ], + 'total_amount1' => [ 'title' => ts('Range One Amount'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_INT, 'name' => 'total_amount', - ), - 'total_amount2' => array( + ], + 'total_amount2' => [ 'title' => ts('Range Two Amount'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_INT, 'name' => 'total_amount', - ), - 'financial_type_id' => array( + ], + 'financial_type_id' => [ 'title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_BAO_Contribution::buildOptions('financial_type_id', 'search'), - ), - 'contribution_status_id' => array( + ], + 'contribution_status_id' => [ 'title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id', 'search'), - 'default' => array('1'), - ), - ), - 'group_bys' => array('contribution_source' => NULL), - ), - ) + $this->addAddressFields(TRUE, FALSE, TRUE, array('country_id' => FALSE)); + 'default' => ['1'], + ], + ], + 'group_bys' => ['contribution_source' => NULL], + ], + ] + $this->addAddressFields(TRUE, FALSE, TRUE, ['country_id' => FALSE]); $this->_groupFilter = TRUE; $this->_tagFilter = TRUE; @@ -388,10 +388,10 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 * @return mixed|string */ public function whereContribution($replaceAliasWith = 'contribution1') { - $clauses = array( + $clauses = [ "is_test" => "{$this->_aliases['civicrm_contribution']}.is_test = 0", "is_template" => "{$this->_aliases['civicrm_contribution']}.is_template = 0", - ); + ]; foreach ($this->_columns['civicrm_contribution']['filters'] as $fieldName => $field) { $clause = NULL; @@ -452,7 +452,7 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 $this->_amountClauseWithAND = "!({$this->_aliases['civicrm_contribution']}1.total_amount_count IS NULL AND {$this->_aliases['civicrm_contribution']}2.total_amount_count IS NULL)"; } - $clauses = array("atleast_one_amount" => $this->_amountClauseWithAND); + $clauses = ["atleast_one_amount" => $this->_amountClauseWithAND]; foreach ($this->_columns as $tableName => $table) { if (array_key_exists('filters', $table) && @@ -490,8 +490,8 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 $errors = $checkDate = $errorCount = []; - $rules = array( - 'id' => array( + $rules = [ + 'id' => [ 'sort_name', 'exposed_id', 'display_name', @@ -535,14 +535,14 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 'is_opt_out', 'is_deceased', 'preferred_language', - ), - 'country_id' => array('country_id'), - 'state_province_id' => array('country_id', 'state_province_id'), - 'contribution_source' => array('contribution_source'), - 'financial_type' => array('financial_type'), - ); - - $idMapping = array( + ], + 'country_id' => ['country_id'], + 'state_province_id' => ['country_id', 'state_province_id'], + 'contribution_source' => ['contribution_source'], + 'financial_type' => ['financial_type'], + ]; + + $idMapping = [ 'id' => ts('Contact'), 'exposed_id' => ts('Contact'), 'country_id' => ts('Country'), @@ -552,7 +552,7 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 'sort_name' => ts('Contact Name'), 'email' => ts('Email'), 'phone' => ts('Phone'), - ); + ]; if (empty($fields['group_bys'])) { $errors['fields'] = ts('Please select at least one Group by field.'); @@ -580,10 +580,10 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 } if (!$found) { $erorrGrps = implode(',', $invlidGroups); - $tempErrors[] = ts("Do not select field %1 with Group by %2.", array( + $tempErrors[] = ts("Do not select field %1 with Group by %2.", [ 1 => $idMapping[$fld_id], 2 => $erorrGrps, - )); + ]); } } } @@ -683,10 +683,10 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 //store contributions in array 'contact_sums' for comparison $contact_sums = []; while ($dao->fetch()) { - $contact_sums[$dao->contact_civireport_id] = array( + $contact_sums[$dao->contact_civireport_id] = [ 'contribution1_total_amount_sum' => $dao->contribution1_total_amount_sum, 'contribution2_total_amount_sum' => $dao->contribution2_total_amount_sum, - ); + ]; } $total_distinct_contacts = count($contact_sums); @@ -729,26 +729,26 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 $lapsed = ($lapsed / $total_distinct_contacts) * 100; } //display percentages for new, lapsed, upgraded, downgraded, and maintained contributors - $statistics['counts']['count_new'] = array( + $statistics['counts']['count_new'] = [ 'value' => $new, 'title' => ts('% New Donors'), - ); - $statistics['counts']['count_lapsed'] = array( + ]; + $statistics['counts']['count_lapsed'] = [ 'value' => $lapsed, 'title' => ts('% Lapsed Donors'), - ); - $statistics['counts']['count_upgraded'] = array( + ]; + $statistics['counts']['count_upgraded'] = [ 'value' => $upgraded, 'title' => ts('% Upgraded Donors'), - ); - $statistics['counts']['count_downgraded'] = array( + ]; + $statistics['counts']['count_downgraded'] = [ 'value' => $downgraded, 'title' => ts('% Downgraded Donors'), - ); - $statistics['counts']['count_maintained'] = array( + ]; + $statistics['counts']['count_maintained'] = [ 'value' => $maintained, 'title' => ts('% Maintained Donors'), - ); + ]; $select = " SELECT COUNT({$this->_aliases['civicrm_contribution']}1.total_amount_count ) as count, @@ -783,38 +783,38 @@ GROUP BY currency $count2 += $dao->count2; } - $statistics['counts']['range_one_title'] = array('title' => ts('Initial Date Range:')); - $statistics['counts']['amount'] = array( + $statistics['counts']['range_one_title'] = ['title' => ts('Initial Date Range:')]; + $statistics['counts']['amount'] = [ 'value' => implode(', ', $amount), 'title' => ts('Total Amount'), 'type' => CRM_Utils_Type::T_STRING, - ); - $statistics['counts']['count'] = array( + ]; + $statistics['counts']['count'] = [ 'value' => $count, 'title' => ts('Total Donations'), - ); - $statistics['counts']['avg'] = array( + ]; + $statistics['counts']['avg'] = [ 'value' => implode(', ', $average), 'title' => ts('Average'), 'type' => CRM_Utils_Type::T_STRING, - ); - $statistics['counts']['range_two_title'] = array( + ]; + $statistics['counts']['range_two_title'] = [ 'title' => ts('Second Date Range:'), - ); - $statistics['counts']['amount2'] = array( + ]; + $statistics['counts']['amount2'] = [ 'value' => implode(', ', $amount2), 'title' => ts('Total Amount'), 'type' => CRM_Utils_Type::T_STRING, - ); - $statistics['counts']['count2'] = array( + ]; + $statistics['counts']['count2'] = [ 'value' => $count2, 'title' => ts('Total Donations'), - ); - $statistics['counts']['avg2'] = array( + ]; + $statistics['counts']['avg2'] = [ 'value' => implode(', ', $average2), 'title' => ts('Average'), 'type' => CRM_Utils_Type::T_STRING, - ); + ]; return $statistics; } @@ -870,25 +870,25 @@ GROUP BY currency " ({$row['contribution2_total_amount_count']})"; } } - $this->_columnHeaders['change'] = array( + $this->_columnHeaders['change'] = [ 'title' => ts('% Change'), 'type' => CRM_Utils_Type::T_INT, - ); + ]; // hack to fix title list($from1, $to1) = $this->getFromTo(CRM_Utils_Array::value("receive_date1_relative", $this->_params), CRM_Utils_Array::value("receive_date1_from", $this->_params), CRM_Utils_Array::value("receive_date1_to", $this->_params) ); - $from1 = CRM_Utils_Date::customFormat($from1, NULL, array('d')); - $to1 = CRM_Utils_Date::customFormat($to1, NULL, array('d')); + $from1 = CRM_Utils_Date::customFormat($from1, NULL, ['d']); + $to1 = CRM_Utils_Date::customFormat($to1, NULL, ['d']); list($from2, $to2) = $this->getFromTo(CRM_Utils_Array::value("receive_date2_relative", $this->_params), CRM_Utils_Array::value("receive_date2_from", $this->_params), CRM_Utils_Array::value("receive_date2_to", $this->_params) ); - $from2 = CRM_Utils_Date::customFormat($from2, NULL, array('d')); - $to2 = CRM_Utils_Date::customFormat($to2, NULL, array('d')); + $from2 = CRM_Utils_Date::customFormat($from2, NULL, ['d']); + $to2 = CRM_Utils_Date::customFormat($to2, NULL, ['d']); $this->_columnHeaders['contribution1_total_amount_sum']['title'] = "$from1 - $to1"; $this->_columnHeaders['contribution2_total_amount_sum']['title'] = "$from2 - $to2"; diff --git a/CRM/Report/Form/Event/ParticipantListing.php b/CRM/Report/Form/Event/ParticipantListing.php index f9488cd41f..63c7bd3dc9 100644 --- a/CRM/Report/Form/Event/ParticipantListing.php +++ b/CRM/Report/Form/Event/ParticipantListing.php @@ -23,14 +23,14 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form { protected $_tagFilter = TRUE; protected $_balance = FALSE; - protected $_customGroupExtends = array( + protected $_customGroupExtends = [ 'Participant', 'Contact', 'Individual', 'Event', - ); + ]; - public $_drilldownReport = array('event/income' => 'Link to Detail Report'); + public $_drilldownReport = ['event/income' => 'Link to Detail Report']; /** * Class constructor. @@ -38,353 +38,353 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form { public function __construct() { $this->_autoIncludeIndexedFieldsAsOrderBys = 1; - $this->_columns = array( - 'civicrm_contact' => array( + $this->_columns = [ + 'civicrm_contact' => [ 'dao' => 'CRM_Contact_DAO_Contact', - 'fields' => array_merge(array( + 'fields' => array_merge([ // CRM-17115 - to avoid changing report output at this stage re-instate // old field name for sort name - 'sort_name_linked' => array( + 'sort_name_linked' => [ 'title' => ts('Participant Name'), 'required' => TRUE, 'no_repeat' => TRUE, 'dbAlias' => 'contact_civireport.sort_name', - ), - ), + ], + ], $this->getBasicContactFields(), - array( - 'age_at_event' => array( + [ + 'age_at_event' => [ 'title' => ts('Age at Event'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, event_civireport.start_date)', - ), - ) + ], + ] ), 'grouping' => 'contact-fields', - 'order_bys' => array( - 'sort_name' => array( + 'order_bys' => [ + 'sort_name' => [ 'title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC', - ), - 'first_name' => array( + ], + 'first_name' => [ 'name' => 'first_name', 'title' => ts('First Name'), - ), - 'gender_id' => array( + ], + 'gender_id' => [ 'name' => 'gender_id', 'title' => ts('Gender'), - ), - 'birth_date' => array( + ], + 'birth_date' => [ 'name' => 'birth_date', 'title' => ts('Birth Date'), - ), - 'age_at_event' => array( + ], + 'age_at_event' => [ 'name' => 'age_at_event', 'title' => ts('Age at Event'), - ), - 'contact_type' => array( + ], + 'contact_type' => [ 'title' => ts('Contact Type'), - ), - 'contact_sub_type' => array( + ], + 'contact_sub_type' => [ 'title' => ts('Contact Subtype'), - ), - ), + ], + ], 'filters' => CRM_Report_Form::getBasicContactFilters(), - ), - 'civicrm_email' => array( + ], + 'civicrm_email' => [ 'dao' => 'CRM_Core_DAO_Email', - 'fields' => array( - 'email' => array( + 'fields' => [ + 'email' => [ 'title' => ts('Email'), 'no_repeat' => TRUE, - ), - ), + ], + ], 'grouping' => 'contact-fields', - 'filters' => array( - 'email' => array( + 'filters' => [ + 'email' => [ 'title' => ts('Participant E-mail'), 'operator' => 'like', - ), - ), - ), - ); + ], + ], + ], + ]; $this->_columns += $this->getAddressColumns(); - $this->_columns += array( - 'civicrm_participant' => array( + $this->_columns += [ + 'civicrm_participant' => [ 'dao' => 'CRM_Event_DAO_Participant', - 'fields' => array( - 'participant_id' => array('title' => ts('Participant ID')), - 'participant_record' => array( + 'fields' => [ + 'participant_id' => ['title' => ts('Participant ID')], + 'participant_record' => [ 'name' => 'id', 'no_display' => TRUE, 'required' => TRUE, - ), - 'event_id' => array( + ], + 'event_id' => [ 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING, - ), - 'status_id' => array( + ], + 'status_id' => [ 'title' => ts('Status'), 'default' => TRUE, - ), - 'role_id' => array( + ], + 'role_id' => [ 'title' => ts('Role'), 'default' => TRUE, - ), - 'fee_currency' => array( + ], + 'fee_currency' => [ 'required' => TRUE, 'no_display' => TRUE, - ), - 'registered_by_id' => array( + ], + 'registered_by_id' => [ 'title' => ts('Registered by Participant ID'), - ), - 'registered_by_name' => array( + ], + 'registered_by_name' => [ 'title' => ts('Registered by Participant Name'), 'name' => 'registered_by_id', - ), - 'created_id' => array( + ], + 'created_id' => [ 'title' => ts('Registered by Contact ID'), - ), - 'registered_by_contact_name' => array( + ], + 'registered_by_contact_name' => [ 'title' => ts('Registered by Contact Name'), 'name' => 'created_id', - ), - 'source' => array( + ], + 'source' => [ 'title' => ts('Participant Source'), - ), + ], 'participant_fee_level' => NULL, - 'participant_fee_amount' => array('title' => ts('Participant Fee')), - 'participant_register_date' => array('title' => ts('Registration Date')), - 'total_paid' => array( + 'participant_fee_amount' => ['title' => ts('Participant Fee')], + 'participant_register_date' => ['title' => ts('Registration Date')], + 'total_paid' => [ 'title' => ts('Total Paid'), 'dbAlias' => 'IFNULL(SUM(ft.total_amount), 0)', 'type' => 1024, - ), - 'balance' => array( + ], + 'balance' => [ 'title' => ts('Balance'), 'dbAlias' => 'participant_civireport.fee_amount - IFNULL(SUM(ft.total_amount), 0)', 'type' => 1024, - ), - ), + ], + ], 'grouping' => 'event-fields', - 'filters' => array( - 'event_id' => array( + 'filters' => [ + 'event_id' => [ 'name' => 'event_id', 'title' => ts('Event'), 'operatorType' => CRM_Report_Form::OP_ENTITYREF, 'type' => CRM_Utils_Type::T_INT, - 'attributes' => array( + 'attributes' => [ 'entity' => 'Event', - 'select' => array('minimumInputLength' => 0), - ), - ), - 'sid' => array( + 'select' => ['minimumInputLength' => 0], + ], + ], + 'sid' => [ 'name' => 'status_id', 'title' => ts('Participant Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'), - ), - 'rid' => array( + ], + 'rid' => [ 'name' => 'role_id', 'title' => ts('Participant Role'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantRole(), - ), - 'participant_register_date' => array( + ], + 'participant_register_date' => [ 'title' => ts('Registration Date'), 'operatorType' => CRM_Report_Form::OP_DATE, - ), - 'fee_currency' => array( + ], + 'fee_currency' => [ 'title' => ts('Fee Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING, - ), - 'registered_by_id' => array( + ], + 'registered_by_id' => [ 'title' => ts('Registered by Participant ID'), 'type' => CRM_Utils_Type::T_STRING, 'operator' => 'like', - ), - 'source' => array( + ], + 'source' => [ 'title' => ts('Participant Source'), 'type' => CRM_Utils_Type::T_STRING, 'operator' => 'like', - ), + ], 'is_test' => [ 'title' => ts('Is Test'), 'type' => CRM_Utils_Type::T_BOOLEAN, 'default' => 0, ], - ), - 'order_bys' => array( - 'participant_register_date' => array( + ], + 'order_bys' => [ + 'participant_register_date' => [ 'title' => ts('Registration Date'), 'default_weight' => '1', 'default_order' => 'ASC', - ), - 'event_id' => array( + ], + 'event_id' => [ 'title' => ts('Event'), 'default_weight' => '1', 'default_order' => 'ASC', - ), - ), - ), - 'civicrm_phone' => array( + ], + ], + ], + 'civicrm_phone' => [ 'dao' => 'CRM_Core_DAO_Phone', - 'fields' => array( - 'phone' => array( + 'fields' => [ + 'phone' => [ 'title' => ts('Phone'), 'default' => TRUE, 'no_repeat' => TRUE, - ), - ), + ], + ], 'grouping' => 'contact-fields', - ), - 'civicrm_event' => array( + ], + 'civicrm_event' => [ 'dao' => 'CRM_Event_DAO_Event', - 'fields' => array( - 'event_type_id' => array( + 'fields' => [ + 'event_type_id' => [ 'title' => ts('Event Type'), - ), - 'event_start_date' => array( + ], + 'event_start_date' => [ 'title' => ts('Event Start Date'), - ), - 'event_end_date' => array( + ], + 'event_end_date' => [ 'title' => ts('Event End Date'), - ), - ), + ], + ], 'grouping' => 'event-fields', - 'filters' => array( - 'eid' => array( + 'filters' => [ + 'eid' => [ 'name' => 'event_type_id', 'title' => ts('Event Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('event_type'), - ), - 'event_start_date' => array( + ], + 'event_start_date' => [ 'title' => ts('Event Start Date'), 'operatorType' => CRM_Report_Form::OP_DATE, - ), - 'event_end_date' => array( + ], + 'event_end_date' => [ 'title' => ts('Event End Date'), 'operatorType' => CRM_Report_Form::OP_DATE, - ), - ), - 'order_bys' => array( - 'event_type_id' => array( + ], + ], + 'order_bys' => [ + 'event_type_id' => [ 'title' => ts('Event Type'), 'default_weight' => '2', 'default_order' => 'ASC', - ), - 'event_start_date' => array( + ], + 'event_start_date' => [ 'title' => ts('Event Start Date'), - ), - ), - ), - 'civicrm_note' => array( + ], + ], + ], + 'civicrm_note' => [ 'dao' => 'CRM_Core_DAO_Note', - 'fields' => array( - 'participant_note' => array( + 'fields' => [ + 'participant_note' => [ 'name' => 'note', 'title' => ts('Participant Note'), - ), - ), - ), - 'civicrm_contribution' => array( + ], + ], + ], + 'civicrm_contribution' => [ 'dao' => 'CRM_Contribute_DAO_Contribution', - 'fields' => array( - 'contribution_id' => array( + 'fields' => [ + 'contribution_id' => [ 'name' => 'id', 'no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contribution ID'), - ), - 'financial_type_id' => array('title' => ts('Financial Type')), - 'receive_date' => array('title' => ts('Payment Date')), - 'contribution_status_id' => array('title' => ts('Contribution Status')), - 'payment_instrument_id' => array('title' => ts('Payment Type')), - 'contribution_source' => array( + ], + 'financial_type_id' => ['title' => ts('Financial Type')], + 'receive_date' => ['title' => ts('Payment Date')], + 'contribution_status_id' => ['title' => ts('Contribution Status')], + 'payment_instrument_id' => ['title' => ts('Payment Type')], + 'contribution_source' => [ 'name' => 'source', 'title' => ts('Contribution Source'), - ), - 'currency' => array( + ], + 'currency' => [ 'required' => TRUE, 'no_display' => TRUE, - ), + ], 'trxn_id' => NULL, - 'fee_amount' => array('title' => ts('Transaction Fee')), + 'fee_amount' => ['title' => ts('Transaction Fee')], 'net_amount' => NULL, - ), + ], 'grouping' => 'contrib-fields', - 'filters' => array( - 'receive_date' => array( + 'filters' => [ + 'receive_date' => [ 'title' => ts('Payment Date'), 'operatorType' => CRM_Report_Form::OP_DATE, - ), - 'financial_type_id' => array( + ], + 'financial_type_id' => [ 'title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType(), - ), - 'currency' => array( + ], + 'currency' => [ 'title' => ts('Contribution Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING, - ), - 'payment_instrument_id' => array( + ], + 'payment_instrument_id' => [ 'title' => ts('Payment Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument(), - ), - 'contribution_status_id' => array( + ], + 'contribution_status_id' => [ 'title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id', 'search'), 'default' => NULL, - ), - ), - ), - 'civicrm_line_item' => array( + ], + ], + ], + 'civicrm_line_item' => [ 'dao' => 'CRM_Price_DAO_LineItem', 'grouping' => 'priceset-fields', - 'filters' => array( - 'price_field_value_id' => array( + 'filters' => [ + 'price_field_value_id' => [ 'name' => 'price_field_value_id', 'title' => ts('Fee Level'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->getPriceLevels(), - ), - ), - ), - ); + ], + ], + ], + ]; - $this->_options = array( - 'blank_column_begin' => array( + $this->_options = [ + 'blank_column_begin' => [ 'title' => ts('Blank column at the Begining'), 'type' => 'checkbox', - ), - 'blank_column_end' => array( + ], + 'blank_column_end' => [ 'title' => ts('Blank column at the End'), 'type' => 'select', - 'options' => array( + 'options' => [ '' => ts('-select-'), 1 => ts('One'), 2 => ts('Two'), 3 => ts('Three'), - ), - ), - ); + ], + ], + ]; // CRM-17115 avoid duplication of sort_name - would be better to standardise name // & behaviour across reports but trying for no change at this point. diff --git a/CRM/SMS/Page/Provider.php b/CRM/SMS/Page/Provider.php index 5364178c14..cea624e2a1 100644 --- a/CRM/SMS/Page/Provider.php +++ b/CRM/SMS/Page/Provider.php @@ -42,14 +42,14 @@ class CRM_SMS_Page_Provider extends CRM_Core_Page_Basic { public function run() { // set title and breadcrumb CRM_Utils_System::setTitle(ts('Settings - SMS Provider')); - $breadCrumb = array( - array( + $breadCrumb = [ + [ 'title' => ts('SMS Provider'), 'url' => CRM_Utils_System::url('civicrm/admin/sms/provider', 'reset=1' ), - ), - ); + ], + ]; CRM_Utils_System::appendBreadCrumb($breadCrumb); $this->_id = CRM_Utils_Request::retrieve('id', 'String', @@ -84,7 +84,7 @@ class CRM_SMS_Page_Provider extends CRM_Core_Page_Basic { $provider['api_type'] = $apiTypes[$provider['api_type']]; $provider['action'] = CRM_Core_Action::formLink(self::links(), $action, - array('id' => $provider['id']), + ['id' => $provider['id']], ts('more'), FALSE, 'sms.provider.row', diff --git a/CRM/SMS/Provider.php b/CRM/SMS/Provider.php index 9cb40538cd..b711f2afb8 100644 --- a/CRM/SMS/Provider.php +++ b/CRM/SMS/Provider.php @@ -98,7 +98,7 @@ abstract class CRM_SMS_Provider { $sql = " SELECT scheduled_id FROM civicrm_mailing m INNER JOIN civicrm_mailing_job mj ON mj.mailing_id = m.id AND mj.id = %1"; - $sourceContactID = CRM_Core_DAO::singleValueQuery($sql, array(1 => array($jobID, 'Integer'))); + $sourceContactID = CRM_Core_DAO::singleValueQuery($sql, [1 => [$jobID, 'Integer']]); } elseif ($userID) { $sourceContactID = $userID; @@ -116,14 +116,14 @@ INNER JOIN civicrm_mailing_job mj ON mj.mailing_id = m.id AND mj.id = %1"; } // note: lets not pass status here, assuming status will be updated by callback - $activityParams = array( + $activityParams = [ 'source_contact_id' => $sourceContactID, 'target_contact_id' => $headers['contact_id'], 'activity_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'SMS delivery'), 'activity_date_time' => date('YmdHis'), 'details' => $message, 'result' => $apiMsgID, - ); + ]; return CRM_Activity_BAO_Activity::create($activityParams); } @@ -170,9 +170,9 @@ INNER JOIN civicrm_mailing_job mj ON mj.mailing_id = m.id AND mj.id = %1"; if (!$message->fromContactID) { // find sender by phone number if $fromContactID not set by hook $formatFrom = '%' . $this->formatPhone($this->stripPhone($message->from), $like, "like"); - $message->fromContactID = CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM civicrm_phone JOIN civicrm_contact ON civicrm_contact.id = civicrm_phone.contact_id WHERE !civicrm_contact.is_deleted AND phone LIKE %1", array( - 1 => array($formatFrom, 'String'), - )); + $message->fromContactID = CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM civicrm_phone JOIN civicrm_contact ON civicrm_contact.id = civicrm_phone.contact_id WHERE !civicrm_contact.is_deleted AND phone LIKE %1", [ + 1 => [$formatFrom, 'String'], + ]); } if (!$message->fromContactID) { @@ -184,22 +184,22 @@ INNER JOIN civicrm_mailing_job mj ON mj.mailing_id = m.id AND mj.id = %1"; $phoneloc = array_search('Home', $locationTypes); $phonetype = array_search('Mobile', $phoneTypes); $stripFrom = $this->stripPhone($message->from); - $contactparams = array( + $contactparams = [ 'contact_type' => 'Individual', - 'email' => array( - 1 => array( + 'email' => [ + 1 => [ 'location_type_id' => $phoneloc, 'email' => $stripFrom . '@mobile.sms', - ), - ), - 'phone' => array( - 1 => array( + ], + ], + 'phone' => [ + 1 => [ 'phone_type_id' => $phonetype, 'location_type_id' => $phoneloc, 'phone' => $stripFrom, - ), - ), - ); + ], + ], + ]; $fromContact = CRM_Contact_BAO_Contact::create($contactparams, FALSE, TRUE, FALSE); $message->fromContactID = $fromContact->id; } @@ -207,9 +207,9 @@ INNER JOIN civicrm_mailing_job mj ON mj.mailing_id = m.id AND mj.id = %1"; if (!$message->toContactID) { // find recipient if $toContactID not set by hook if ($message->to) { - $message->toContactID = CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM civicrm_phone JOIN civicrm_contact ON civicrm_contact.id = civicrm_phone.contact_id WHERE !civicrm_contact.is_deleted AND phone LIKE %1", array( - 1 => array('%' . $message->to, 'String'), - )); + $message->toContactID = CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM civicrm_phone JOIN civicrm_contact ON civicrm_contact.id = civicrm_phone.contact_id WHERE !civicrm_contact.is_deleted AND phone LIKE %1", [ + 1 => ['%' . $message->to, 'String'], + ]); } else { $message->toContactID = $message->fromContactID; @@ -218,7 +218,7 @@ INNER JOIN civicrm_mailing_job mj ON mj.mailing_id = m.id AND mj.id = %1"; if ($message->fromContactID) { // note: lets not pass status here, assuming status will be updated by callback - $activityParams = array( + $activityParams = [ 'source_contact_id' => $message->toContactID, 'target_contact_id' => $message->fromContactID, 'activity_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Inbound SMS'), @@ -226,7 +226,7 @@ INNER JOIN civicrm_mailing_job mj ON mj.mailing_id = m.id AND mj.id = %1"; 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Completed'), 'details' => $message->body, 'phone_number' => $message->from, - ); + ]; if ($message->trackID) { $activityParams['result'] = CRM_Utils_Type::escape($message->trackID, 'String'); } diff --git a/CRM/Upgrade/Incremental/php/FiveSixteen.php b/CRM/Upgrade/Incremental/php/FiveSixteen.php index 90ff9e2c78..b11d07ee6a 100644 --- a/CRM/Upgrade/Incremental/php/FiveSixteen.php +++ b/CRM/Upgrade/Incremental/php/FiveSixteen.php @@ -20,7 +20,7 @@ class CRM_Upgrade_Incremental_php_FiveSixteen extends CRM_Upgrade_Incremental_Ba * @param string $rev */ public function upgrade_5_16_alpha1($rev) { - $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); + $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); $this->addTask('Update smart groups to rename filters on contribution_date to receive_date', 'updateSmartGroups', [ 'renameField' => [ ['old' => 'contribution_date', 'new' => 'receive_date'], diff --git a/CRM/Upgrade/Incremental/php/TimezoneRevertTrait.php b/CRM/Upgrade/Incremental/php/TimezoneRevertTrait.php index 418f7d3c49..c4c7945374 100644 --- a/CRM/Upgrade/Incremental/php/TimezoneRevertTrait.php +++ b/CRM/Upgrade/Incremental/php/TimezoneRevertTrait.php @@ -277,7 +277,7 @@ trait CRM_Upgrade_Incremental_php_TimezoneRevertTrait { 1 => ['upgrade%' . $highVersion . '.upgrade', 'String'], ]); $highLogId = $highLog->fetch() ? $highLog->id : CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_log'); - return array($lowLogId, $highLogId); + return [$lowLogId, $highLogId]; } /** diff --git a/CRM/Utils/Check/Component.php b/CRM/Utils/Check/Component.php index f09877f284..79cecd1be7 100644 --- a/CRM/Utils/Check/Component.php +++ b/CRM/Utils/Check/Component.php @@ -133,9 +133,9 @@ abstract class CRM_Utils_Check_Component { $fileExists = FALSE; try { $guzzleClient = new GuzzleHttp\Client(); - $guzzleResponse = $guzzleClient->request('GET', $url, array( + $guzzleResponse = $guzzleClient->request('GET', $url, [ 'timeout' => $timeoutOverride, - )); + ]); $fileExists = ($guzzleResponse->getStatusCode() == 200); } catch (Exception $e) { diff --git a/CRM/Utils/Hook/Joomla.php b/CRM/Utils/Hook/Joomla.php index 4f95215cd6..83ca6ac83d 100644 --- a/CRM/Utils/Hook/Joomla.php +++ b/CRM/Utils/Hook/Joomla.php @@ -81,7 +81,7 @@ class CRM_Utils_Hook_Joomla extends CRM_Utils_Hook { } } - $result = $app->triggerEvent($fnSuffix, array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6)); + $result = $app->triggerEvent($fnSuffix, [&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6]); $moduleResult = $this->commonInvoke($numParams, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, diff --git a/CRM/Utils/Hook/UnitTests.php b/CRM/Utils/Hook/UnitTests.php index 71babb86f8..1e5d3248d1 100644 --- a/CRM/Utils/Hook/UnitTests.php +++ b/CRM/Utils/Hook/UnitTests.php @@ -87,7 +87,7 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook { $numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, $fnSuffix) { - $params = array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6); + $params = [&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6]; $fResult2 = $fResult3 = NULL; diff --git a/CRM/Utils/Hook/WordPress.php b/CRM/Utils/Hook/WordPress.php index 6d9a7e9224..d43328a0b5 100644 --- a/CRM/Utils/Hook/WordPress.php +++ b/CRM/Utils/Hook/WordPress.php @@ -93,7 +93,7 @@ class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook { // only pass the arguments that have values $args = array_slice( - array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6), + [&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6], 0, $numParams ); diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php index 5536e59344..c866e67d96 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -292,11 +292,11 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase { // Not all links that CiviCRM generates are Drupal routes, so we use the weaker ::fromUri method. try { - $url = \Drupal\Core\Url::fromUri("{$base}{$url['path']}", array( + $url = \Drupal\Core\Url::fromUri("{$base}{$url['path']}", [ 'query' => $url['query'], 'fragment' => $fragment, 'absolute' => $absolute, - ))->toString(); + ])->toString(); } catch (Exception $e) { \Drupal::logger('civicrm')->error($e->getMessage()); diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index d972ecc57a..30b29cf720 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -1251,10 +1251,10 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { $contactMatching = 0; // Previously used the $wpdb global - which means WordPress *must* be bootstrapped. - $wpUsers = get_users(array( + $wpUsers = get_users([ 'blog_id' => get_current_blog_id(), 'number' => -1, - )); + ]); foreach ($wpUsers as $wpUserData) { $contactCount++; diff --git a/Civi/Core/Themes.php b/Civi/Core/Themes.php index baf07c7c75..ebf6982227 100644 --- a/Civi/Core/Themes.php +++ b/Civi/Core/Themes.php @@ -176,7 +176,7 @@ class Themes extends \Civi\Core\Service\AutoService { } else { $result = Civi\Core\Resolver::singleton() - ->call($all[$themeKey]['url_callback'], array($this, $themeKey, $cssExt, $cssFile)); + ->call($all[$themeKey]['url_callback'], [$this, $themeKey, $cssExt, $cssFile]); } if ($result !== self::PASSTHRU) { @@ -195,35 +195,35 @@ class Themes extends \Civi\Core\Service\AutoService { * @see CRM_Utils_Hook::themes */ protected function buildAll() { - $themes = array( - 'default' => array( + $themes = [ + 'default' => [ 'ext' => 'civicrm', 'title' => ts('Automatic'), 'help' => ts('Determine a system default automatically'), // This is an alias. url_callback, search_order don't matter. - ), - 'greenwich' => array( + ], + 'greenwich' => [ 'ext' => 'civicrm', 'title' => 'Greenwich', 'help' => ts('CiviCRM 4.x look-and-feel'), - ), - 'none' => array( + ], + 'none' => [ 'ext' => 'civicrm', 'title' => ts('None (Unstyled)'), 'help' => ts('Disable CiviCRM\'s built-in CSS files.'), - 'search_order' => array('none', self::FALLBACK_THEME), - 'excludes' => array( + 'search_order' => ['none', self::FALLBACK_THEME], + 'excludes' => [ "css/civicrm.css", "css/bootstrap.css", - ), - ), - self::FALLBACK_THEME => array( + ], + ], + self::FALLBACK_THEME => [ 'ext' => 'civicrm', 'title' => 'Fallback (Abstract Base Theme)', 'url_callback' => '\Civi\Core\Themes\Resolvers::fallback', - 'search_order' => array(self::FALLBACK_THEME), - ), - ); + 'search_order' => [self::FALLBACK_THEME], + ], + ]; \CRM_Utils_Hook::themes($themes); @@ -246,11 +246,11 @@ class Themes extends \Civi\Core\Service\AutoService { * @see CRM_Utils_Hook::themes */ protected function build($themeKey, $theme) { - $defaults = array( + $defaults = [ 'name' => $themeKey, 'url_callback' => '\Civi\Core\Themes\Resolvers::simple', - 'search_order' => array($themeKey, self::FALLBACK_THEME), - ); + 'search_order' => [$themeKey, self::FALLBACK_THEME], + ]; $theme = array_merge($defaults, $theme); return $theme; diff --git a/Civi/Core/Themes/Resolvers.php b/Civi/Core/Themes/Resolvers.php index 194f88e7e2..ffebd99059 100644 --- a/Civi/Core/Themes/Resolvers.php +++ b/Civi/Core/Themes/Resolvers.php @@ -51,7 +51,7 @@ class Resolvers { $file = $res->filterMinify($theme['ext'], $file); if ($res->getPath($theme['ext'], $file)) { - return array($res->getUrl($theme['ext'], $file, TRUE)); + return [$res->getUrl($theme['ext'], $file, TRUE)]; } else { return Civi\Core\Themes::PASSTHRU; @@ -75,7 +75,7 @@ class Resolvers { */ public static function fallback($themes, $themeKey, $cssExt, $cssFile) { $res = Civi::resources(); - return array($res->getUrl($cssExt, $cssFile, TRUE)); + return [$res->getUrl($cssExt, $cssFile, TRUE)]; } } diff --git a/Civi/Test/MailingTestTrait.php b/Civi/Test/MailingTestTrait.php index b6ee14d872..17f1320254 100644 --- a/Civi/Test/MailingTestTrait.php +++ b/Civi/Test/MailingTestTrait.php @@ -19,12 +19,12 @@ trait MailingTestTrait { * @return int */ public function createMailing($params = []) { - $params = array_merge(array( + $params = array_merge([ 'subject' => 'maild' . rand(), 'body_text' => 'bdkfhdskfhduew{domain.address}{action.optOutUrl}', 'name' => 'mailing name' . rand(), 'created_id' => 1, - ), $params); + ], $params); $result = $this->callAPISuccess('Mailing', 'create', $params); return $result['id']; @@ -35,9 +35,9 @@ trait MailingTestTrait { * @param $id */ public function deleteMailing($id) { - $params = array( + $params = [ 'id' => $id, - ); + ]; $this->callAPISuccess('Mailing', 'delete', $params); } diff --git a/Civi/Test/TAP7.php b/Civi/Test/TAP7.php index 3497167e02..fe233b73ad 100644 --- a/Civi/Test/TAP7.php +++ b/Civi/Test/TAP7.php @@ -70,20 +70,20 @@ class TAP7 extends \PHPUnit\Util\Printer implements \PHPUnit\Framework\TestListe $this ->writeNotOk($test, 'Failure'); $message = explode("\n", \PHPUnit\Framework\TestFailure::exceptionToString($e)); - $diagnostic = array( + $diagnostic = [ 'message' => $message[0], 'severity' => 'fail', - ); + ]; if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) { $cf = $e ->getComparisonFailure(); if ($cf !== NULL) { - $diagnostic['data'] = array( + $diagnostic['data'] = [ 'got' => $cf ->getActual(), 'expected' => $cf ->getExpected(), - ); + ]; } } diff --git a/Civi/Test/TAP9.php b/Civi/Test/TAP9.php index 7b39c6bbfe..d177848622 100644 --- a/Civi/Test/TAP9.php +++ b/Civi/Test/TAP9.php @@ -78,20 +78,20 @@ class TAP9 extends Printer implements ResultPrinter { $this ->writeNotOk($test, 'Failure'); $message = explode("\n", \PHPUnit\Framework\TestFailure::exceptionToString($e)); - $diagnostic = array( + $diagnostic = [ 'message' => $message[0], 'severity' => 'fail', - ); + ]; if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) { $cf = $e ->getComparisonFailure(); if ($cf !== NULL) { - $diagnostic['data'] = array( + $diagnostic['data'] = [ 'got' => $cf ->getActual(), 'expected' => $cf ->getExpected(), - ); + ]; } } diff --git a/Civi/Test/TAPLegacy.php b/Civi/Test/TAPLegacy.php index 7da5659f54..36a6fcfa61 100644 --- a/Civi/Test/TAPLegacy.php +++ b/Civi/Test/TAPLegacy.php @@ -67,20 +67,20 @@ class TAPLegacy extends \PHPUnit\Util\Printer implements \PHPUnit\Framework\Test $this ->writeNotOk($test, 'Failure'); $message = explode("\n", \PHPUnit\Framework\TestFailure::exceptionToString($e)); - $diagnostic = array( + $diagnostic = [ 'message' => $message[0], 'severity' => 'fail', - ); + ]; if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) { $cf = $e ->getComparisonFailure(); if ($cf !== NULL) { - $diagnostic['data'] = array( + $diagnostic['data'] = [ 'got' => $cf ->getActual(), 'expected' => $cf ->getExpected(), - ); + ]; } } diff --git a/ext/ewaysingle/CRM/Core/Payment/eWAY.mgd.php b/ext/ewaysingle/CRM/Core/Payment/eWAY.mgd.php index 978303bc60..323874a3f8 100644 --- a/ext/ewaysingle/CRM/Core/Payment/eWAY.mgd.php +++ b/ext/ewaysingle/CRM/Core/Payment/eWAY.mgd.php @@ -3,11 +3,11 @@ // The record will be automatically inserted, updated, or deleted from the // database as appropriate. For more details, see "hook_civicrm_managed" at: // http://wiki.civicrm.org/confluence/display/CRMDOC42/Hook+Reference -return array( - 0 => array( +return [ + 0 => [ 'name' => 'eWAY', 'entity' => 'PaymentProcessorType', - 'params' => array( + 'params' => [ 'version' => 3, 'name' => 'eWAY', 'title' => 'eWAY (Single Currency)', @@ -19,6 +19,6 @@ return array( 'payment_type' => 1, 'is_recur' => 0, 'url_site_test_default' => 'https://www.eway.com.au/gateway_cvn/xmltest/testpage.asp', - ), - ), -); + ], + ], +]; diff --git a/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom.php b/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom.php index 8380d5f3bc..2e5d19a28e 100644 --- a/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom.php +++ b/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom.php @@ -49,14 +49,14 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search { } // set breadcrumb to return to Custom Search listings page - $breadCrumb = array( - array( + $breadCrumb = [ + [ 'title' => ts('Custom Searches'), 'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1' ), - ), - ); + ], + ]; CRM_Utils_System::appendBreadCrumb($breadCrumb); // use the custom selector @@ -70,7 +70,7 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search { // instantiate the new class $this->_customClass = new $this->_customSearchClass($this->_formValues); - $this->addFormRule(array($this->_customClass, 'formRule'), $this); + $this->addFormRule([$this->_customClass, 'formRule'], $this); // CRM-12747 if (isset($this->_customClass->_permissionedComponent) && @@ -84,7 +84,7 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search { * Add local and global form rules. */ public function addRules() { - $this->addFormRule(array($this->_customClass, 'formRule')); + $this->addFormRule([$this->_customClass, 'formRule']); } /** diff --git a/ext/oauth-client/tests/phpunit/CRM/OAuth/MailSetupTest.php b/ext/oauth-client/tests/phpunit/CRM/OAuth/MailSetupTest.php index d5f8e9a858..5b1756c86c 100644 --- a/ext/oauth-client/tests/phpunit/CRM/OAuth/MailSetupTest.php +++ b/ext/oauth-client/tests/phpunit/CRM/OAuth/MailSetupTest.php @@ -27,7 +27,7 @@ class CRM_OAuth_MailSetupTest extends \PHPUnit\Framework\TestCase implements Hea } public function testEvalArrayTemplate(): void { - $vars = array( + $vars = [ 'token' => [ 'client_id' => 10, 'resource_owner' => ['mail' => 'foo@bar.com'], @@ -65,7 +65,7 @@ class CRM_OAuth_MailSetupTest extends \PHPUnit\Framework\TestCase implements Hea ], 'class' => 'Civi\\OAuth\\CiviGenericProvider', ], - ); + ]; $expected = [ 'name' => 'Foozball Association: foo@bar.com', 'domain' => 'bar.com', diff --git a/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/AbstractRunActionTest.php b/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/AbstractRunActionTest.php index 053d51d33b..f453238050 100644 --- a/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/AbstractRunActionTest.php +++ b/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/AbstractRunActionTest.php @@ -43,10 +43,9 @@ class AbstractRunActionTest extends \PHPUnit\Framework\TestCase implements Headl $entity = 'SearchDisplay'; $action = 'run'; - $params = array( + $params = [ 'return' => 'page:1', - 'savedSearch' => - array( + 'savedSearch' => [ 'id' => 1, 'name' => 'Multi_Select_Test', 'label' => 'Multi Select Test', @@ -54,185 +53,153 @@ class AbstractRunActionTest extends \PHPUnit\Framework\TestCase implements Headl 'mapping_id' => NULL, 'search_custom_id' => NULL, 'api_entity' => 'Contact', - 'api_params' => - array( + 'api_params' => [ 'version' => 4, - 'select' => - array( - 0 => 'display_name', - 1 => 'Foods.I_Like:label', - ), - 'orderBy' => - array(), - 'where' => - array( - 0 => - array( - 0 => 'contact_type:name', - 1 => '=', - 2 => 'Individual', - ), - 1 => - array( - 0 => 'Foods.I_Like:name', - 1 => 'IS NOT EMPTY', - ), - ), - 'groupBy' => - array( - 0 => 'id', - ), - 'having' => - array(), - ), + 'select' => [ + 'display_name', + 'Foods.I_Like:label', + ], + 'orderBy' => [], + 'where' => [ + [ + 'contact_type:name', + '=', + 'Individual', + ], + [ + 'Foods.I_Like:name', + 'IS NOT EMPTY', + ], + ], + 'groupBy' => [ + 'id', + ], + 'having' => [], + ], 'created_id' => 203, 'modified_id' => 203, 'expires_date' => NULL, 'created_date' => '2022-08-12 13:49:17', 'modified_date' => '2022-08-12 17:18:24', 'description' => NULL, - 'tag_id' => - array(), - 'groups' => - array(), - 'displays' => - array( - 0 => - array( + 'tag_id' => [], + 'groups' => [], + 'displays' => [ + [ 'id' => 1, 'name' => 'Contacts_Table_1', 'label' => 'Contacts Table 1', 'saved_search_id' => 1, 'type' => 'table', - 'settings' => - array( + 'settings' => [ 'actions' => TRUE, 'limit' => 50, - 'classes' => - array( - 0 => 'table', - 1 => 'table-striped', - ), - 'pager' => - array(), + 'classes' => [ + 'table', + 'table-striped', + ], + 'pager' => [], 'placeholder' => 5, - 'sort' => - array( - 0 => - array( - 0 => 'sort_name', - 1 => 'ASC', - ), - ), - 'columns' => - array( - 0 => - array( + 'sort' => [ + [ + 'sort_name', + 'ASC', + ], + ], + 'columns' => [ + [ 'type' => 'field', 'key' => 'display_name', 'dataType' => 'String', 'label' => 'Display Name', 'sortable' => TRUE, 'link' => - array( + [ 'path' => '', 'entity' => 'Contact', 'action' => 'view', 'join' => '', 'target' => '_blank', - ), + ], 'title' => 'View Contact', - ), - 1 => - array( + ], + [ 'type' => 'field', 'key' => 'Foods.I_Like:label', 'dataType' => 'String', 'label' => 'Foods: I Like', 'sortable' => TRUE, 'rewrite' => '[Foods.I_Like:label]', - ), - ), - ), + ], + ], + ], 'acl_bypass' => FALSE, - ), - ), - ), - 'display' => - array( + ], + ], + ], + 'display' => [ 'id' => 1, 'name' => 'Contacts_Table_1', 'label' => 'Contacts Table 1', 'saved_search_id' => 1, 'type' => 'table', - 'settings' => - array( + 'settings' => [ 'actions' => TRUE, 'limit' => 50, - 'classes' => - array( - 0 => 'table', - 1 => 'table-striped', - ), - 'pager' => - array(), + 'classes' => [ + 'table', + 'table-striped', + ], + 'pager' => [], 'placeholder' => 5, - 'sort' => - array( - 0 => - array( - 0 => 'sort_name', - 1 => 'ASC', - ), - ), - 'columns' => - array( - 0 => - array( + 'sort' => [ + [ + 'sort_name', + 'ASC', + ], + ], + 'columns' => [ + [ 'type' => 'field', 'key' => 'display_name', 'dataType' => 'String', 'label' => 'Display Name', 'sortable' => TRUE, 'link' => - array( + [ 'path' => '', 'entity' => 'Contact', 'action' => 'view', 'join' => '', 'target' => '_blank', - ), + ], 'title' => 'View Contact', - ), - 1 => - array( + ], + [ 'type' => 'field', 'key' => 'Foods.I_Like:label', 'dataType' => 'String', 'label' => 'Foods: I Like', 'sortable' => TRUE, 'rewrite' => '[Foods.I_Like:label]', - ), - ), - ), + ], + ], + ], 'acl_bypass' => FALSE, - ), - 'sort' => - array( - 0 => - array( - 0 => 'sort_name', - 1 => 'ASC', - ), - ), + ], + 'sort' => [ + [ + 'sort_name', + 'ASC', + ], + ], 'limit' => 50, 'seed' => 1660599799146, - 'filters' => - array(), + 'filters' => [], 'afform' => NULL, 'debug' => TRUE, 'checkPermissions' => TRUE, - ); + ]; $result = civicrm_api4($entity, $action, $params); $resultData = $result[0]['data']['Foods.I_Like:label']; $this->assertTrue(implode(', ', $resultData) === $result[0]['columns'][1]['val']); diff --git a/install/civicrm.php b/install/civicrm.php index 6d08fcf94f..fa497fe7ff 100644 --- a/install/civicrm.php +++ b/install/civicrm.php @@ -197,7 +197,7 @@ function civicrm_config(&$config) { // Ex: $extraSettings[] = '$civicrm_settings["domain"]["foo"] = "bar";'; $extraSettings = []; - $params = array( + $params = [ 'crmRoot' => $crmPath, 'templateCompileDir' => $compileDir, 'frontEnd' => 0, @@ -209,7 +209,7 @@ function civicrm_config(&$config) { // SSL connection to MySQL is needed. 'dbSSL' => '', 'CMSdbSSL' => '', - ); + ]; $params['baseURL'] = $config['base_url'] ?? civicrm_cms_base(); if ($installType == 'drupal' && defined('VERSION')) { diff --git a/install/index.php b/install/index.php index a7c96f1f2e..aa14a8e5fb 100644 --- a/install/index.php +++ b/install/index.php @@ -115,7 +115,7 @@ foreach ($langs as $locale => $_) { if ($locale == 'en_US') { continue; } - if (!file_exists(implode(CIVICRM_DIRECTORY_SEPARATOR, array($crmPath, 'sql', "civicrm_data.$locale.mysql")))) { + if (!file_exists(implode(CIVICRM_DIRECTORY_SEPARATOR, [$crmPath, 'sql', "civicrm_data.$locale.mysql"]))) { unset($langs[$locale]); } } @@ -123,11 +123,11 @@ foreach ($langs as $locale => $_) { // Set the CMS // This is mostly sympbolic, since nothing we do during the install // really requires CIVICRM_UF to be defined. -$installTypeToUF = array( +$installTypeToUF = [ 'wordpress' => 'WordPress', 'drupal' => 'Drupal', 'backdrop' => 'Backdrop', -); +]; $uf = ($installTypeToUF[$installType] ?? 'Drupal'); define('CIVICRM_UF', $uf); @@ -200,9 +200,9 @@ if ($installType == 'drupal') { $pattern = '/' . preg_quote(CIVICRM_DIRECTORY_SEPARATOR . 'modules', CIVICRM_DIRECTORY_SEPARATOR) . '/'; if (!preg_match($pattern, str_replace("\\", "/", $_SERVER['SCRIPT_FILENAME']))) { - $directory = implode(CIVICRM_DIRECTORY_SEPARATOR, array('sites', 'all', 'modules')); + $directory = implode(CIVICRM_DIRECTORY_SEPARATOR, ['sites', 'all', 'modules']); $errorTitle = ts("Oops! Please correct your install location"); - $errorMsg = ts("Please untar (uncompress) your downloaded copy of CiviCRM in the %1 directory below your Drupal root directory.", array(1 => $directory)); + $errorMsg = ts("Please untar (uncompress) your downloaded copy of CiviCRM in the %1 directory below your Drupal root directory.", [1 => $directory]); errorDisplayPage($errorTitle, $errorMsg); } } @@ -214,7 +214,7 @@ if ($installType == 'backdrop') { if (!preg_match($pattern, str_replace("\\", "/", $_SERVER['SCRIPT_FILENAME']))) { $directory = 'modules'; $errorTitle = ts("Oops! Please correct your install location"); - $errorMsg = ts("Please untar (uncompress) your downloaded copy of CiviCRM in the %1 directory below your Drupal root directory.", array(1 => $directory)); + $errorMsg = ts("Please untar (uncompress) your downloaded copy of CiviCRM in the %1 directory below your Drupal root directory.", [1 => $directory]); errorDisplayPage($errorTitle, $errorMsg); } } @@ -225,21 +225,21 @@ if ($alreadyInstalled) { $settings_directory = $cmsPath; if ($installType == 'drupal') { - $settings_directory = implode(CIVICRM_DIRECTORY_SEPARATOR, array( + $settings_directory = implode(CIVICRM_DIRECTORY_SEPARATOR, [ ts('[your Drupal root directory]'), 'sites', $siteDir, - )); + ]); } if ($installType == 'backdrop') { - $settings_directory = implode(CIVICRM_DIRECTORY_SEPARATOR, array( + $settings_directory = implode(CIVICRM_DIRECTORY_SEPARATOR, [ ts('[your Backdrop root directory]'), $siteDir, - )); + ]); } $docLink = CRM_Utils_System::docURL2('Installation and Upgrades', FALSE, ts('Installation Guide'), NULL, NULL, "wiki"); - $errorMsg = ts("CiviCRM has already been installed. ", array(1 => $settings_directory, 2 => $docLink)); + $errorMsg = ts("CiviCRM has already been installed. ", [1 => $settings_directory, 2 => $docLink]); errorDisplayPage($errorTitle, $errorMsg, FALSE); } @@ -261,12 +261,12 @@ if ($installType == 'drupal') { } define('DRUPAL_ROOT', $cmsPath); - $drupalVersionFiles = array( + $drupalVersionFiles = [ // D6 - implode(CIVICRM_DIRECTORY_SEPARATOR, array($cmsPath, 'modules', 'system', 'system.module')), + implode(CIVICRM_DIRECTORY_SEPARATOR, [$cmsPath, 'modules', 'system', 'system.module']), // D7 - implode(CIVICRM_DIRECTORY_SEPARATOR, array($cmsPath, 'includes', 'bootstrap.inc')), - ); + implode(CIVICRM_DIRECTORY_SEPARATOR, [$cmsPath, 'includes', 'bootstrap.inc']), + ]; foreach ($drupalVersionFiles as $drupalVersionFile) { if (file_exists($drupalVersionFile)) { require_once $drupalVersionFile; @@ -290,7 +290,7 @@ if ($installType == 'drupal') { if (!defined('VERSION') or version_compare(VERSION, '6.0') < 0) { $errorTitle = ts("Oops! Incorrect Drupal version"); - $errorMsg = ts("This version of CiviCRM can only be used with Drupal 6.x or 7.x. Please ensure that '%1' exists if you are running Drupal 7.0 and over.", array(1 => implode("' or '", $drupalVersionFiles))); + $errorMsg = ts("This version of CiviCRM can only be used with Drupal 6.x or 7.x. Please ensure that '%1' exists if you are running Drupal 7.0 and over.", [1 => implode("' or '", $drupalVersionFiles)]); errorDisplayPage($errorTitle, $errorMsg); } } @@ -304,10 +304,10 @@ elseif ($installType == 'backdrop') { define('BACKDROP_ROOT', $cmsPath); - $backdropVersionFiles = array( + $backdropVersionFiles = [ // Backdrop - implode(CIVICRM_DIRECTORY_SEPARATOR, array($cmsPath, 'core', 'includes', 'bootstrap.inc')), - ); + implode(CIVICRM_DIRECTORY_SEPARATOR, [$cmsPath, 'core', 'includes', 'bootstrap.inc']), + ]; foreach ($backdropVersionFiles as $backdropVersionFile) { if (file_exists($backdropVersionFile)) { require_once $backdropVersionFile; @@ -315,7 +315,7 @@ elseif ($installType == 'backdrop') { } if (!defined('BACKDROP_VERSION') or version_compare(BACKDROP_VERSION, '1.0') < 0) { $errorTitle = ts("Oops! Incorrect Backdrop version"); - $errorMsg = ts("This version of CiviCRM can only be used with Backdrop 1.x. Please ensure that '%1' exists if you are running Backdrop 1.0 and over.", array(1 => implode("' or '", $backdropVersionFiles))); + $errorMsg = ts("This version of CiviCRM can only be used with Backdrop 1.x. Please ensure that '%1' exists if you are running Backdrop 1.0 and over.", [1 => implode("' or '", $backdropVersionFiles)]); errorDisplayPage($errorTitle, $errorMsg); } } @@ -342,12 +342,12 @@ if ($installType == 'wordpress') { $databaseConfig = $_POST['mysql']; } else { - $databaseConfig = array( + $databaseConfig = [ "server" => DB_HOST, "username" => DB_USER, "password" => DB_PASSWORD, "database" => DB_NAME, - ); + ]; } } @@ -361,12 +361,12 @@ if ($installType == 'drupal') { if (!empty($databases['default']['default']['port'])) { $dbServer .= ':' . $databases['default']['default']['port']; } - $drupalConfig = array( + $drupalConfig = [ "server" => $dbServer, "username" => $databases['default']['default']['username'], "password" => $databases['default']['default']['password'], "database" => $databases['default']['default']['database'], - ); + ]; } } @@ -376,12 +376,12 @@ if ($installType == 'backdrop') { $backdropConfig = $_POST['backdrop']; } else { - $backdropConfig = array( + $backdropConfig = [ "server" => "localhost", "username" => "backdrop", "password" => "", "database" => "backdrop", - ); + ]; } } @@ -455,53 +455,53 @@ class InstallRequirements { */ public function checkdatabase($databaseConfig, $dbName) { if ($this->requireFunction('mysqli_connect', - array( + [ ts("PHP Configuration"), ts("MySQL support"), ts("MySQL support not included in PHP."), - ) + ] ) ) { $this->requireMySQLServer($databaseConfig['server'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts("Does the server exist?"), - ts("Can't find the a MySQL server on '%1'.", array(1 => $databaseConfig['server'])), + ts("Can't find the a MySQL server on '%1'.", [1 => $databaseConfig['server']]), $databaseConfig['server'], - ) + ] ); if ($this->requireMysqlConnection($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts("Are the access credentials correct?"), ts("That username/password doesn't work"), - ) + ] ) ) { @$this->requireMySQLVersion(CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER, - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), - ts("MySQL version at least %1", array(1 => CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER)), - ts("MySQL version %1 or higher is required, you are running MySQL %2.", array(1 => CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER, 2 => mysqli_get_server_info($this->conn))), - ts("MySQL %1", array(1 => mysqli_get_server_info($this->conn))), - ) + [ + ts("MySQL %1 Configuration", [1 => $dbName]), + ts("MySQL version at least %1", [1 => CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER]), + ts("MySQL version %1 or higher is required, you are running MySQL %2.", [1 => CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER, 2 => mysqli_get_server_info($this->conn)]), + ts("MySQL %1", [1 => mysqli_get_server_info($this->conn)]), + ] ); $this->requireMySQLAutoIncrementIncrementOne($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts("Is auto_increment_increment set to 1"), ts("An auto_increment_increment value greater than 1 is not currently supported. Please see issue CRM-7923 for further details and potential workaround."), - ) + ] ); - $testDetails = array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + $testDetails = [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts("Is the provided database name valid?"), ts("The database name provided is not valid. Please use only 0-9, a-z, A-Z, _ and - as characters in the name."), - ); + ]; if (!CRM_Core_DAO::requireSafeDBName($databaseConfig['database'])) { $this->error($testDetails); return FALSE; @@ -514,12 +514,12 @@ class InstallRequirements { $databaseConfig['password'], $databaseConfig['database'], self::MINIMUM_THREAD_STACK, - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), - ts("Does MySQL thread_stack meet minimum (%1k)", array(1 => self::MINIMUM_THREAD_STACK)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), + ts("Does MySQL thread_stack meet minimum (%1k)", [1 => self::MINIMUM_THREAD_STACK]), "", // "The MySQL thread_stack does not meet minimum " . CRM_Upgrade_Form::MINIMUM_THREAD_STACK . "k. Please update thread_stack in my.cnf.", - ) + ] ); } $onlyRequire = $dbName == 'Drupal' || $dbName == 'Backdrop'; @@ -528,11 +528,11 @@ class InstallRequirements { $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts("Can I access/create the database?"), - ts("I can't create new databases and the database '%1' doesn't exist.", array(1 => $databaseConfig['database'])), - ), + ts("I can't create new databases and the database '%1' doesn't exist.", [1 => $databaseConfig['database']]), + ], $onlyRequire ); if ($dbName != 'Drupal' && $dbName != 'Backdrop') { @@ -541,61 +541,61 @@ class InstallRequirements { $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts("Does the database have data from a previous installation?"), - ts("CiviCRM data from previous installation exists in '%1'.", array(1 => $databaseConfig['database'])), - ) + ts("CiviCRM data from previous installation exists in '%1'.", [1 => $databaseConfig['database']]), + ] ); $this->requireMySQLInnoDB($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts("Can I access/create InnoDB tables in the database?"), ts("Unable to create InnoDB tables. MySQL InnoDB support is required for CiviCRM but is either not available or not enabled in this MySQL database server."), - ) + ] ); $this->requireMySQLTempTables($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts('Can I create temporary tables in the database?'), ts('Unable to create temporary tables. This MySQL user is missing the CREATE TEMPORARY TABLES privilege.'), - ) + ] ); $this->requireMySQLLockTables($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts('Can I create lock tables in the database?'), ts('Unable to lock tables. This MySQL user is missing the LOCK TABLES privilege.'), - ) + ] ); $this->requireMySQLTrigger($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts('Can I create triggers in the database?'), ts('Unable to create triggers. This MySQL user is missing the CREATE TRIGGERS privilege.'), - ) + ] ); $this->requireMySQLUtf8mb4($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], - array( - ts("MySQL %1 Configuration", array(1 => $dbName)), + [ + ts("MySQL %1 Configuration", [1 => $dbName]), ts('Is the utf8mb4 character set supported?'), ts('This MySQL server does not support the utf8mb4 character set.'), - ) + ] ); } } @@ -635,40 +635,40 @@ class InstallRequirements { $this->errors = NULL; - $this->requirePHPVersion(array( + $this->requirePHPVersion([ ts("PHP Configuration"), ts("PHP7 installed"), - )); + ]); // Check that we can identify the root folder successfully $this->requireFile($crmPath . CIVICRM_DIRECTORY_SEPARATOR . 'README.md', - array( + [ ts("File permissions"), ts("Does the webserver know where files are stored?"), ts("The webserver isn't letting me identify where files are stored."), $this->getBaseDir(), - ), + ], TRUE ); // CRM-6485: make sure the path does not contain PATH_SEPARATOR, as we don’t know how to escape it $this->requireNoPathSeparator( - array( + [ ts("File permissions"), ts('Does the CiviCRM path contain PATH_SEPARATOR?'), - ts('The path %1 contains PATH_SEPARATOR (the %2 character).', array(1 => $this->getBaseDir(), 2 => PATH_SEPARATOR)), + ts('The path %1 contains PATH_SEPARATOR (the %2 character).', [1 => $this->getBaseDir(), 2 => PATH_SEPARATOR]), $this->getBaseDir(), - ) + ] ); - $requiredDirectories = array('CRM', 'packages', 'templates', 'js', 'api', 'i', 'sql'); + $requiredDirectories = ['CRM', 'packages', 'templates', 'js', 'api', 'i', 'sql']; foreach ($requiredDirectories as $dir) { $this->requireFile($crmPath . CIVICRM_DIRECTORY_SEPARATOR . $dir, - array( + [ ts("File permissions"), - ts("Folder '%1' exists?", array(1 => $dir)), - ts("There is no '%1' folder.", array(1 => $dir)), - ), TRUE + ts("Folder '%1' exists?", [1 => $dir]), + ts("There is no '%1' folder.", [1 => $dir]), + ], TRUE ); } @@ -678,7 +678,7 @@ class InstallRequirements { if ($installType == 'drupal') { // make sure that we can write to sites/default and files/ - $writableDirectories = array( + $writableDirectories = [ $cmsPath . CIVICRM_DIRECTORY_SEPARATOR . 'sites' . CIVICRM_DIRECTORY_SEPARATOR . $siteDir . CIVICRM_DIRECTORY_SEPARATOR . @@ -686,16 +686,16 @@ class InstallRequirements { $cmsPath . CIVICRM_DIRECTORY_SEPARATOR . 'sites' . CIVICRM_DIRECTORY_SEPARATOR . $siteDir, - ); + ]; } elseif ($installType == 'backdrop') { // make sure that we can write to sites/default and files/ - $writableDirectories = array( + $writableDirectories = [ $cmsPath . CIVICRM_DIRECTORY_SEPARATOR . 'files', $cmsPath, - ); + ]; } elseif ($installType == 'wordpress') { // make sure that we can write to uploads/civicrm/ @@ -704,16 +704,16 @@ class InstallRequirements { if (!file_exists($files_dirname)) { wp_mkdir_p($files_dirname); } - $writableDirectories = array($files_dirname); + $writableDirectories = [$files_dirname]; } foreach ($writableDirectories as $dir) { $dirName = CIVICRM_WINDOWS ? $dir : CIVICRM_DIRECTORY_SEPARATOR . $dir; - $testDetails = array( + $testDetails = [ ts("File permissions"), - ts("Is the %1 folder writeable?", array(1 => $dir)), + ts("Is the %1 folder writeable?", [1 => $dir]), NULL, - ); + ]; $this->requireWriteable($dirName, $testDetails, TRUE); } @@ -730,56 +730,56 @@ class InstallRequirements { } // Check for $_SERVER configuration - $this->requireServerVariables(array('SCRIPT_NAME', 'HTTP_HOST', 'SCRIPT_FILENAME'), array( + $this->requireServerVariables(['SCRIPT_NAME', 'HTTP_HOST', 'SCRIPT_FILENAME'], [ ts("Webserver config"), ts("Recognised webserver"), ts("You seem to be using an unsupported webserver. The server variables SCRIPT_NAME, HTTP_HOST, SCRIPT_FILENAME need to be set."), - )); + ]); // Check for MySQL support - $this->requireFunction('mysqli_connect', array( + $this->requireFunction('mysqli_connect', [ ts("PHP Configuration"), ts("MySQL support"), ts("MySQL support not included in PHP."), - )); + ]); // Check for XML support - $this->requireFunction('simplexml_load_file', array( + $this->requireFunction('simplexml_load_file', [ ts("PHP Configuration"), ts("SimpleXML support"), ts("SimpleXML support not included in PHP."), - )); + ]); // Check for JSON support - $this->requireFunction('json_encode', array( + $this->requireFunction('json_encode', [ ts("PHP Configuration"), ts("JSON support"), ts("JSON support not included in PHP."), - )); + ]); // check for Multibyte support such as mb_substr. Required for proper handling of Multilingual setups. - $this->requireFunction('mb_substr', array( + $this->requireFunction('mb_substr', [ ts("PHP Configuration"), ts("Multibyte support"), ts("Multibyte support not enabled in PHP."), - )); + ]); // Check for xcache_isset and emit warning if exists - $this->checkXCache(array( + $this->checkXCache([ ts("PHP Configuration"), ts("XCache compatibility"), ts("XCache is installed and there are known compatibility issues between XCache and CiviCRM. Consider using an alternative PHP caching mechanism or disable PHP caching altogether."), - )); + ]); // Check memory allocation $this->requireMemory(32 * 1024 * 1024, 64 * 1024 * 1024, - array( + [ ts("PHP Configuration"), ts("Memory allocated (PHP config option 'memory_limit')"), - ts("CiviCRM needs a minimum of %1 MB allocated to PHP, but recommends %2 MB.", array(1 => 32, 2 => 64)), + ts("CiviCRM needs a minimum of %1 MB allocated to PHP, but recommends %2 MB.", [1 => 32, 2 => 64]), ini_get("memory_limit"), - ) + ] ); return $this->errors; @@ -795,15 +795,15 @@ class InstallRequirements { $mem = $this->getPHPMemory(); if ($mem < $min && $mem > 0) { - $testDetails[2] .= " " . ts("You only have %1 allocated", array(1 => ini_get("memory_limit"))); + $testDetails[2] .= " " . ts("You only have %1 allocated", [1 => ini_get("memory_limit")]); $this->error($testDetails); } elseif ($mem < $recommended && $mem > 0) { - $testDetails[2] .= " " . ts("You only have %1 allocated", array(1 => ini_get("memory_limit"))); + $testDetails[2] .= " " . ts("You only have %1 allocated", [1 => ini_get("memory_limit")]); $this->warning($testDetails); } elseif ($mem == 0) { - $testDetails[2] .= " " . ts("We can't determine how much memory you have allocated. Install only if you're sure you've allocated at least %1 MB.", array(1 => 32)); + $testDetails[2] .= " " . ts("We can't determine how much memory you have allocated. Install only if you're sure you've allocated at least %1 MB.", [1 => 32]); $this->warning($testDetails); } } @@ -906,18 +906,18 @@ class InstallRequirements { if ($aboveMinVersion) { if (version_compare($phpVersion, CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER) < 0) { - $testDetails[2] = ts('This webserver is running an outdated version of PHP (%1). It is strongly recommended to upgrade to PHP %2 or later, as older versions can present a security risk. The preferred version is %3.', array( + $testDetails[2] = ts('This webserver is running an outdated version of PHP (%1). It is strongly recommended to upgrade to PHP %2 or later, as older versions can present a security risk. The preferred version is %3.', [ 1 => $phpVersion, 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER, 3 => preg_replace(';^(\d+\.\d+(?:\.[1-9]\d*)?).*$;', '\1', CRM_Upgrade_Incremental_General::RECOMMENDED_PHP_VER), - )); + ]); $this->warning($testDetails); } return TRUE; } if (empty($testDetails[2])) { - $testDetails[2] = ts("You need PHP version %1 or later, only %2 is installed. Please upgrade your server, or ask your web-host to do so.", array(1 => CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER, 2 => $phpVersion)); + $testDetails[2] = ts("You need PHP version %1 or later, only %2 is installed. Please upgrade your server, or ask your web-host to do so.", [1 => CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER, 2 => $phpVersion]); } $this->error($testDetails); @@ -934,7 +934,7 @@ class InstallRequirements { $filename = $this->getBaseDir() . $filename; } if (!file_exists($filename)) { - $testDetails[2] .= " (" . ts("file '%1' not found", array(1 => $filename)) . ')'; + $testDetails[2] .= " (" . ts("file '%1' not found", [1 => $filename]) . ')'; $this->error($testDetails); } } @@ -957,7 +957,7 @@ class InstallRequirements { $this->testing($testDetails); $filename = $this->getBaseDir() . $filename; if (file_exists($filename)) { - $testDetails[2] .= " (" . ts("file '%1' found", array(1 => $filename)) . ")"; + $testDetails[2] .= " (" . ts("file '%1' found", [1 => $filename]) . ")"; $this->error($testDetails); } } @@ -998,7 +998,7 @@ class InstallRequirements { if (!isset($testDetails[2])) { $testDetails[2] = NULL; } - $testDetails[2] .= ts("The user account used by your web-server %1 needs to be granted write access to the following directory in order to configure the CiviCRM settings file:", array(1 => $name)) . "\n$filename"; + $testDetails[2] .= ts("The user account used by your web-server %1 needs to be granted write access to the following directory in order to configure the CiviCRM settings file:", [1 => $name]) . "\n$filename"; $this->error($testDetails); } } @@ -1058,7 +1058,7 @@ class InstallRequirements { $this->testing($testDetails); if (!mysqli_get_server_info($this->conn)) { - $testDetails[2] = ts('Cannot determine the version of MySQL installed. Please ensure at least version %1 is installed.', array(1 => $version)); + $testDetails[2] = ts('Cannot determine the version of MySQL installed. Please ensure at least version %1 is installed.', [1 => $version]); $this->warning($testDetails); } else { @@ -1299,7 +1299,7 @@ class InstallRequirements { else { $values = mysqli_fetch_row($result); if ($values[1] < (1024 * $minValueKB)) { - $testDetails[2] = ts('MySQL "thread_stack" is %1 kb', array(1 => ($values[1] / 1024))); + $testDetails[2] = ts('MySQL "thread_stack" is %1 kb', [1 => ($values[1] / 1024)]); $this->error($testDetails); } } @@ -1332,7 +1332,7 @@ class InstallRequirements { } } - $testDetails[3] = ts('CiviCRM data from previous installation does not exist in %1.', array(1 => $database)); + $testDetails[3] = ts('CiviCRM data from previous installation does not exist in %1.', [1 => $database]); $this->testing($testDetails); } @@ -1360,7 +1360,7 @@ class InstallRequirements { $okay = "Database '$database' exists"; } elseif ($onlyRequire) { - $testDetails[2] = ts("The database: '%1' does not exist.", array(1 => $database)); + $testDetails[2] = ts("The database: '%1' does not exist.", [1 => $database]); $this->error($testDetails); return; } @@ -1370,7 +1370,7 @@ class InstallRequirements { $okay = ts("Able to create a new database."); } else { - $testDetails[2] .= " (" . ts("user '%1' doesn't have CREATE DATABASE permissions.", array(1 => $username)) . ")"; + $testDetails[2] .= " (" . ts("user '%1' doesn't have CREATE DATABASE permissions.", [1 => $username]) . ")"; $this->error($testDetails); return; } @@ -1397,7 +1397,7 @@ class InstallRequirements { return TRUE; } else { - $testDetails[2] = " (" . ts('the following PHP variables are missing: %1', array(1 => implode(", ", $missing))) . ")"; + $testDetails[2] = " (" . ts('the following PHP variables are missing: %1', [1 => implode(", ", $missing)]) . ")"; $this->error($testDetails); } } @@ -1491,7 +1491,7 @@ class InstallRequirements { $message .= " ($testDetails[3])"; } - $this->tests[$section][$test] = array("good", $message); + $this->tests[$section][$test] = ["good", $message]; } /** @@ -1501,7 +1501,7 @@ class InstallRequirements { $section = $testDetails[0]; $test = $testDetails[1]; - $this->tests[$section][$test] = array("error", $testDetails[2]); + $this->tests[$section][$test] = ["error", $testDetails[2]]; $this->errors[] = $testDetails; } @@ -1512,7 +1512,7 @@ class InstallRequirements { $section = $testDetails[0]; $test = $testDetails[1]; - $this->tests[$section][$test] = array("warning", $testDetails[2]); + $this->tests[$section][$test] = ["warning", $testDetails[2]]; $this->warnings[] = $testDetails; } @@ -1554,7 +1554,7 @@ class Installer extends InstallRequirements { if (@mysqli_query($conn, $query)) { } else { - $errorTitle = ts("Oops! Could not create database %1", array(1 => $database)); + $errorTitle = ts("Oops! Could not create database %1", [1 => $database]); $errorMsg = ts("We encountered an error when attempting to create the database. Please check your MySQL server permissions and the database name and try again."); errorDisplayPage($errorTitle, $errorMsg); } @@ -1586,7 +1586,7 @@ class Installer extends InstallRequirements { $registerSiteURL = "https://civicrm.org/register-site"; $commonOutputMessage - = "
  • " . ts("Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to fill out the site registration form. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).", array(1 => "href='$registerSiteURL' target='_blank'")) . "
  • " + = "
  • " . ts("Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to fill out the site registration form. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).", [1 => "href='$registerSiteURL' target='_blank'"]) . "
  • " . "
  • " . ts("We have integrated KCFinder with CKEditor and TinyMCE. This allows a user to upload images. All uploaded images are public.") . "
  • "; $output = NULL; @@ -1614,8 +1614,8 @@ class Installer extends InstallRequirements { $drupalPermissionsURL = "{$drupalURL}index.php?q=admin/people/permissions"; $drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1"; - $output .= "
  • " . ts("Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", array(1 => "target='_blank' href='{$drupalPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'")) . "
  • "; - $output .= "
  • " . ts("Use the Configuration Checklist to review and configure settings for your new site", array(1 => "target='_blank' href='$drupalURL'")) . "
  • "; + $output .= "
  • " . ts("Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", [1 => "target='_blank' href='{$drupalPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'"]) . "
  • "; + $output .= "
  • " . ts("Use the Configuration Checklist to review and configure settings for your new site", [1 => "target='_blank' href='$drupalURL'"]) . "
  • "; $output .= $commonOutputMessage; // automatically enable CiviCRM module once it is installed successfully. @@ -1649,7 +1649,7 @@ class Installer extends InstallRequirements { system_rebuild_module_data(); // now enable civicrm module. - module_enable(array('civicrm', 'civicrmtheme')); + module_enable(['civicrm', 'civicrmtheme']); // SystemInstallEvent will be called from here with the first call of CRM_Core_Config, // which calls Core_BAO_ConfigSetting::applyLocale(), who will default to calling @@ -1696,8 +1696,8 @@ class Installer extends InstallRequirements { $backdropPermissionsURL = "{$backdropURL}index.php?q=admin/config/people/permissions"; $backdropURL .= "index.php?q=civicrm/admin/configtask&reset=1"; - $output .= "
  • " . ts("Backdrop user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", array(1 => "target='_blank' href='{$backdropPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'")) . "
  • "; - $output .= "
  • " . ts("Use the Configuration Checklist to review and configure settings for your new site", array(1 => "target='_blank' href='$backdropURL'")) . "
  • "; + $output .= "
  • " . ts("Backdrop user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", [1 => "target='_blank' href='{$backdropPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'"]) . "
  • "; + $output .= "
  • " . ts("Use the Configuration Checklist to review and configure settings for your new site", [1 => "target='_blank' href='$backdropURL'"]) . "
  • "; $output .= $commonOutputMessage; // automatically enable CiviCRM module once it is installed successfully. @@ -1732,7 +1732,7 @@ class Installer extends InstallRequirements { system_rebuild_module_data(); // now enable civicrm module. - module_enable(array('civicrm', 'civicrmtheme')); + module_enable(['civicrm', 'civicrmtheme']); // clear block, page, theme, and hook caches backdrop_flush_all_caches(); @@ -1746,10 +1746,10 @@ class Installer extends InstallRequirements { //change the default language to one chosen if (isset($config['seedLanguage']) && $config['seedLanguage'] != 'en_US') { - civicrm_api3('Setting', 'create', array( + civicrm_api3('Setting', 'create', [ 'domain_id' => 'current_domain', 'lcMessages' => $config['seedLanguage'], - )); + ]); } $output .= ''; @@ -1777,8 +1777,8 @@ class Installer extends InstallRequirements { $drupalPermissionsURL = "{$drupalURL}index.php?q=admin/user/permissions"; $drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1"; - $output .= "
  • " . ts("Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", array(1 => "target='_blank' href='{$drupalPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'")) . "
  • "; - $output .= "
  • " . ts("Use the Configuration Checklist to review and configure settings for your new site", array(1 => "target='_blank' href='$drupalURL'")) . "
  • "; + $output .= "
  • " . ts("Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", [1 => "target='_blank' href='{$drupalPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'"]) . "
  • "; + $output .= "
  • " . ts("Use the Configuration Checklist to review and configure settings for your new site", [1 => "target='_blank' href='$drupalURL'"]) . "
  • "; $output .= $commonOutputMessage; // explicitly setting error reporting, since we cannot handle drupal related notices @@ -1803,7 +1803,7 @@ class Installer extends InstallRequirements { module_rebuild_cache(); // now enable civicrm module. - module_enable(array('civicrm')); + module_enable(['civicrm']); // clear block, page, theme, and hook caches drupal_flush_all_caches(); @@ -1822,8 +1822,8 @@ class Installer extends InstallRequirements { $cmsURL .= "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/configtask&reset=1"; $wpPermissionsURL = "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/access/wp-permissions&reset=1"; - $output .= "
  • " . ts("WordPress user permissions have been automatically set - giving Anonymous and Subscribers access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", array(1 => "target='_blank' href='{$wpPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'")) . "
  • "; - $output .= "
  • " . ts("Use the Configuration Checklist to review and configure settings for your new site", array(1 => "target='_blank' href='$cmsURL'")) . "
  • "; + $output .= "
  • " . ts("WordPress user permissions have been automatically set - giving Anonymous and Subscribers access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", [1 => "target='_blank' href='{$wpPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'"]) . "
  • "; + $output .= "
  • " . ts("Use the Configuration Checklist to review and configure settings for your new site", [1 => "target='_blank' href='$cmsURL'"]) . "
  • "; $output .= $commonOutputMessage; $output .= ''; @@ -1849,7 +1849,7 @@ function civicrm_install_set_drupal_perms() { db_query('UPDATE {permission} SET perm = CONCAT( perm, \', access CiviMail subscribe/unsubscribe pages, access all custom data, access uploaded files, make online contributions, profile listings and forms, register for events, view event info, view event participants\') WHERE rid IN (1, 2)'); } else { - $perms = array( + $perms = [ 'access all custom data', 'access uploaded files', 'make online contributions', @@ -1860,7 +1860,7 @@ function civicrm_install_set_drupal_perms() { 'view event info', 'view event participants', 'access CiviMail subscribe/unsubscribe pages', - ); + ]; // Adding a permission that has not yet been assigned to a module by // a hook_permission implementation results in a database error. @@ -1869,7 +1869,7 @@ function civicrm_install_set_drupal_perms() { foreach (array_diff($perms, $allPerms) as $perm) { watchdog('civicrm', 'Cannot grant the %perm permission because it does not yet exist.', - array('%perm' => $perm), + ['%perm' => $perm], WATCHDOG_ERROR ); } @@ -1880,7 +1880,7 @@ function civicrm_install_set_drupal_perms() { } function civicrm_install_set_backdrop_perms() { - $perms = array( + $perms = [ 'access all custom data', 'access uploaded files', 'make online contributions', @@ -1891,7 +1891,7 @@ function civicrm_install_set_backdrop_perms() { 'view event info', 'view event participants', 'access CiviMail subscribe/unsubscribe pages', - ); + ]; // Adding a permission that has not yet been assigned to a module by // a hook_permission implementation results in a database error. @@ -1900,7 +1900,7 @@ function civicrm_install_set_backdrop_perms() { foreach (array_diff($perms, $allPerms) as $perm) { watchdog('civicrm', 'Cannot grant the %perm permission because it does not yet exist.', - array('%perm' => $perm), + ['%perm' => $perm], WATCHDOG_ERROR ); } @@ -1961,7 +1961,7 @@ function errorDisplayPage($errorTitle, $errorMsg, $showRefer = TRUE) { // Add a link to the documentation if ($showRefer) { - if (is_callable(array('CRM_Utils_System', 'docURL2'))) { + if (is_callable(['CRM_Utils_System', 'docURL2'])) { $docLink = CRM_Utils_System::docURL2('Installation and Upgrades', FALSE, 'Installation Guide', NULL, NULL, "wiki"); } else { -- 2.25.1