Commit be2fb01f authored by colemanw's avatar colemanw Committed by eileen

Short array syntax - auto-format CRM directory

parent c2be63a9

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -44,7 +44,7 @@ class CRM_Activity_Form_ActivityFilter extends CRM_Core_Form {
$this->add('select', 'activity_type_exclude_filter_id', ts('Exclude'), $activityOptions, FALSE, ['class' => 'crm-select2', 'multiple' => TRUE, 'placeholder' => ts('- no types excluded -')]);
$this->addDatePickerRange('activity_date_time', ts('Date'));
$this->addSelect('status_id',
array('entity' => 'activity', 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -'))
['entity' => 'activity', 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -')]
);
$this->assign('suppressForm', TRUE);
......@@ -61,7 +61,7 @@ class CRM_Activity_Form_ActivityFilter extends CRM_Core_Form {
*/
public function setDefaultValues() {
// CRM-11761 retrieve user's activity filter preferences
$defaults = array();
$defaults = [];
if (Civi::settings()->get('preserve_activity_tab_filter') && (CRM_Core_Session::getLoggedInContactID())) {
$defaults = Civi::contactSettings()->get('activity_tab_filter');
}
......
......@@ -49,13 +49,13 @@ class CRM_Activity_Form_ActivityLinks extends CRM_Core_Form {
}
$urlParams = "action=add&reset=1&cid={$contactId}&selectedChild=activity&atype=";
$allTypes = CRM_Utils_Array::value('values', civicrm_api3('OptionValue', 'get', array(
$allTypes = CRM_Utils_Array::value('values', civicrm_api3('OptionValue', 'get', [
'option_group_id' => 'activity_type',
'is_active' => 1,
'options' => array('limit' => 0, 'sort' => 'weight'),
)));
'options' => ['limit' => 0, 'sort' => 'weight'],
]));
$activityTypes = array();
$activityTypes = [];
foreach ($allTypes as $act) {
$url = 'civicrm/activity/add';
......@@ -78,16 +78,16 @@ class CRM_Activity_Form_ActivityLinks extends CRM_Core_Form {
}
// Check for existence of a mobile phone and ! do not SMS privacy setting
try {
$phone = civicrm_api3('Phone', 'getsingle', array(
$phone = civicrm_api3('Phone', 'getsingle', [
'contact_id' => $contactId,
'phone_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Phone', 'phone_type_id', 'Mobile'),
'return' => array('phone', 'contact_id'),
'options' => array('limit' => 1, 'sort' => "is_primary DESC"),
'api.Contact.getsingle' => array(
'return' => ['phone', 'contact_id'],
'options' => ['limit' => 1, 'sort' => "is_primary DESC"],
'api.Contact.getsingle' => [
'id' => '$value.contact_id',
'return' => 'do_not_sms',
),
));
],
]);
}
catch (CiviCRM_API3_Exception $e) {
continue;
......@@ -108,7 +108,7 @@ class CRM_Activity_Form_ActivityLinks extends CRM_Core_Form {
$act['url'] = CRM_Utils_System::url($url,
"{$urlParams}{$act['value']}", FALSE, NULL, FALSE
);
$act += array('icon' => 'fa-plus-square-o');
$act += ['icon' => 'fa-plus-square-o'];
$activityTypes[$act['value']] = $act;
}
......
......@@ -53,11 +53,11 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form {
}
$session = CRM_Core_Session::singleton();
if (!in_array($context, array(
if (!in_array($context, [
'home',
'dashlet',
'dashletFullscreen',
))
])
) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
}
......@@ -66,8 +66,8 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form {
}
$session->pushUserContext($url);
$defaults = array();
$params = array('id' => $activityId);
$defaults = [];
$params = ['id' => $activityId];
CRM_Activity_BAO_Activity::retrieve($params, $defaults);
// Set activity type name and description to template.
......@@ -123,14 +123,14 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form {
* Build the form object.
*/
public function buildQuickForm() {
$this->addButtons(array(
array(
$this->addButtons([
[
'type' => 'cancel',
'name' => ts('Done'),
'spacing' => '         ',
'isDefault' => TRUE,
),
)
],
]
);
}
......
......@@ -198,16 +198,16 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search {
if (!empty($_POST)) {
$this->_formValues = $this->controller->exportValues($this->_name);
$specialParams = array(
$specialParams = [
'activity_type_id',
'status_id',
'priority_id',
'activity_text',
);
$changeNames = array(
];
$changeNames = [
'status_id' => 'activity_status_id',
'priority_id' => 'activity_priority_id',
);
];
CRM_Contact_BAO_Query::processSpecialFormValue($this->_formValues, $specialParams, $changeNames);
}
......
......@@ -57,7 +57,7 @@ class CRM_Activity_Form_Task extends CRM_Core_Form_Task {
* @param CRM_Core_Form $form
*/
public static function preProcessCommon(&$form) {
$form->_activityHolderIds = array();
$form->_activityHolderIds = [];
$values = $form->controller->exportValues($form->get('searchFormName'));
......@@ -65,7 +65,7 @@ class CRM_Activity_Form_Task extends CRM_Core_Form_Task {
$activityTasks = CRM_Activity_Task::tasks();
$form->assign('taskName', $activityTasks[$form->_task]);
$ids = array();
$ids = [];
if ($values['radio_ts'] == 'ts_sel') {
foreach ($values as $name => $value) {
if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
......@@ -85,7 +85,7 @@ class CRM_Activity_Form_Task extends CRM_Core_Form_Task {
$activityClause = NULL;
$components = CRM_Core_Component::getNames();
$componentClause = array();
$componentClause = [];
foreach ($components as $componentID => $componentName) {
if ($componentName != 'CiviCase' && !CRM_Core_Permission::check("access $componentName")) {
$componentClause[] = " (activity_type.component_id IS NULL OR activity_type.component_id <> {$componentID}) ";
......@@ -163,17 +163,17 @@ WHERE activity_id IN ( $IDs ) AND
* @param bool $submitOnce
*/
public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
$this->addButtons([
[
'type' => $nextType,
'name' => $title,
'isDefault' => TRUE,
),
array(
],
[
'type' => $backType,
'name' => ts('Cancel'),
),
));
],
]);
}
}
......@@ -71,7 +71,7 @@ class CRM_Activity_Form_Task_AddToTag extends CRM_Activity_Form_Task {
}
public function addRules() {
$this->addFormRule(array('CRM_Activity_Form_Task_AddToTag', 'formRule'));
$this->addFormRule(['CRM_Activity_Form_Task_AddToTag', 'formRule']);
}
/**
......@@ -81,7 +81,7 @@ class CRM_Activity_Form_Task_AddToTag extends CRM_Activity_Form_Task {
* @return array
*/
public static function formRule($form, $rule) {
$errors = array();
$errors = [];
if (empty($form['tag']) && empty($form['activity_taglist'])) {
$errors['_qf_default'] = ts("Please select at least one tag.");
}
......@@ -94,7 +94,7 @@ class CRM_Activity_Form_Task_AddToTag extends CRM_Activity_Form_Task {
public function postProcess() {
// Get the submitted values in an array.
$params = $this->controller->exportValues($this->_name);
$activityTags = $tagList = array();
$activityTags = $tagList = [];
// check if contact tags exists
if (!empty($params['tag'])) {
......@@ -131,22 +131,22 @@ class CRM_Activity_Form_Task_AddToTag extends CRM_Activity_Form_Task {
// merge activity and taglist tags
$allTags = CRM_Utils_Array::crmArrayMerge($activityTags, $tagList);
$this->_name = array();
$this->_name = [];
foreach ($allTags as $key => $dnc) {
$this->_name[] = $this->_tags[$key];
list($total, $added, $notAdded) = CRM_Core_BAO_EntityTag::addEntitiesToTag($this->_activityHolderIds, $key,
'civicrm_activity', FALSE);
$status = array(ts('Activity tagged', array('count' => $added, 'plural' => '%count activities tagged')));
$status = [ts('Activity tagged', ['count' => $added, 'plural' => '%count activities tagged'])];
if ($notAdded) {
$status[] = ts('1 activity already had this tag', array(
$status[] = ts('1 activity already had this tag', [
'count' => $notAdded,
'plural' => '%count activities already had this tag',
));
]);
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts("Added Tag <em>%1</em>", array(1 => $this->_tags[$key])), 'success', array('expires' => 0));
CRM_Core_Session::setStatus($status, ts("Added Tag <em>%1</em>", [1 => $this->_tags[$key]]), 'success', ['expires' => 0]);
}
}
......
<
......@@ -62,7 +62,7 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task {
parent::preProcess();
// Get the contact read only fields to display.
$readOnlyFields = array_merge(array('sort_name' => ts('Added By'), 'target_sort_name' => ts('With Contact')),
$readOnlyFields = array_merge(['sort_name' => ts('Added By'), 'target_sort_name' => ts('With Contact')],
CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_autocomplete_options',
TRUE, NULL, FALSE, 'name', TRUE
......@@ -101,12 +101,12 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task {
CRM_Utils_System::setTitle($this->_title);
$this->addDefaultButtons(ts('Save'));
$this->_fields = array();
$this->_fields = [];
$this->_fields = CRM_Core_BAO_UFGroup::getFields($ufGroupId, FALSE, CRM_Core_Action::VIEW);
// remove file type field and then limit fields
$suppressFields = FALSE;
$removehtmlTypes = array('File');
$removehtmlTypes = ['File'];
foreach ($this->_fields as $name => $field) {
if (CRM_Core_BAO_CustomField::getKeyID($name) &&
in_array($this->_fields[$name]['html_type'], $removehtmlTypes)
......@@ -124,24 +124,24 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task {
$this->_fields = array_slice($this->_fields, 0, $this->_maxFields);