From: Tim Otten Date: Tue, 6 Jan 2015 22:15:06 +0000 (-0800) Subject: INFRA-132 - CRM/Core - Misc X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f9f40af3ba65d47c6710d450e989124d9b3e3b70;p=civicrm-core.git INFRA-132 - CRM/Core - Misc --- diff --git a/CRM/Core/Action.php b/CRM/Core/Action.php index 4c7f8923f7..068744b2a8 100644 --- a/CRM/Core/Action.php +++ b/CRM/Core/Action.php @@ -207,7 +207,8 @@ class CRM_Core_Action { * @return string the html string * @static */ - static function formLink($links, + static function formLink( + $links, $mask, $values, $extraULName = 'more', diff --git a/CRM/Core/BAO/Cache.php b/CRM/Core/BAO/Cache.php index 525eacf22f..195d09e206 100644 --- a/CRM/Core/BAO/Cache.php +++ b/CRM/Core/BAO/Cache.php @@ -76,8 +76,8 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { if (!self::$_cache[$argString]) { $dao = new CRM_Core_DAO_Cache(); - $dao->group_name = $group; - $dao->path = $path; + $dao->group_name = $group; + $dao->path = $path; $dao->component_id = $componentID; $data = NULL; @@ -115,7 +115,7 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { if (!self::$_cache[$argString]) { $dao = new CRM_Core_DAO_Cache(); - $dao->group_name = $group; + $dao->group_name = $group; $dao->component_id = $componentID; $dao->find(); @@ -155,8 +155,8 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { $dao = new CRM_Core_DAO_Cache(); - $dao->group_name = $group; - $dao->path = $path; + $dao->group_name = $group; + $dao->path = $path; $dao->component_id = $componentID; // get a lock so that multiple ajax requests on the same page @@ -333,16 +333,16 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { $session = $table = $prevNext = TRUE; } - if ( ! $session && ! $table && ! $prevNext ) { + if (!$session && !$table && !$prevNext) { return; } - if ( $prevNext ) { + if ($prevNext) { // delete all PrevNext caches CRM_Core_BAO_PrevNextCache::cleanupCache(); } - if ( $table ) { + if ($table) { // also delete all the action temp tables // that were created the same interval ago $dao = new CRM_Core_DAO(); @@ -356,9 +356,9 @@ AND ( TABLE_NAME LIKE 'civicrm_task_action_temp_%' AND CREATE_TIME < date_sub( NOW( ), INTERVAL $timeIntervalDays day ) "; - $params = array(1 => array($dao->database(), 'String')); + $params = array(1 => array($dao->database(), 'String')); $tableDAO = CRM_Core_DAO::executeQuery($query, $params); - $tables = array(); + $tables = array(); while ($tableDAO->fetch()) { $tables[] = $tableDAO->tableName; } @@ -369,27 +369,27 @@ AND CREATE_TIME < date_sub( NOW( ), INTERVAL $timeIntervalDays day ) } } - if ( $session ) { + if ($session) { // first delete all sessions which are related to any potential transaction // page $transactionPages = array( - 'CRM_Contribute_Controller_Contribution', - 'CRM_Event_Controller_Registration', - ); + 'CRM_Contribute_Controller_Contribution', + 'CRM_Event_Controller_Registration', + ); $params = array( 1 => array(date('Y-m-d H:i:s', time() - $timeIntervalMins * 60), 'String'), ); foreach ($transactionPages as $trPage) { $params[] = array("%${trPage}%", 'String'); - $where[] = 'path LIKE %' . sizeof($params); + $where[] = 'path LIKE %' . sizeof($params); } $sql = " DELETE FROM civicrm_cache WHERE group_name = 'CiviCRM Session' AND created_date <= %1 -AND (" . implode(' OR ', $where) . ")"; +AND (" . implode(' OR ', $where) . ")"; CRM_Core_DAO::executeQuery($sql, $params); $sql = " diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index fb78197550..2d0f385674 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -98,8 +98,10 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { if (!self::$_dataToHtml) { self::$_dataToHtml = array( array( - 'Text' => 'Text', 'Select' => 'Select', - 'Radio' => 'Radio', 'CheckBox' => 'CheckBox', + 'Text' => 'Text', + 'Select' => 'Select', + 'Radio' => 'Radio', + 'CheckBox' => 'CheckBox', 'Multi-Select' => 'Multi-Select', 'AdvMulti-Select' => 'AdvMulti-Select', 'Autocomplete-Select' => 'Autocomplete-Select', @@ -157,13 +159,14 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $indexExist = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $params['id'], 'is_searchable'); } - switch (CRM_Utils_Array::value('html_type', $params)){ + switch (CRM_Utils_Array::value('html_type', $params)) { case 'Select Date': - if(empty($params['date_format'])){ + if (empty($params['date_format'])) { $config = CRM_Core_Config::singleton(); $params['date_format'] = $config->dateInputFormat; } break; + case 'CheckBox': case 'AdvMulti-Select': case 'Multi-Select': @@ -187,14 +190,18 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $params['default_value'] = $params['option_value'][$params['default_option']]; } } - break; + break; } $transaction = new CRM_Core_Transaction(); // create any option group & values if required if ($params['html_type'] != 'Text' && in_array($params['data_type'], array( - 'String', 'Int', 'Float', 'Money')) + 'String', + 'Int', + 'Float', + 'Money' + )) ) { $tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', @@ -202,7 +209,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { 'table_name' ); - if ($params['option_type'] == 1 && empty($params['option_group_id'])) { // first create an option group for this custom group $optionGroup = new CRM_Core_DAO_OptionGroup(); @@ -211,7 +217,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $optionGroup->is_active = 1; $optionGroup->save(); $params['option_group_id'] = $optionGroup->id; - if(!empty($params['option_value']) && is_array($params['option_value'])){ + if (!empty($params['option_value']) && is_array($params['option_value'])) { foreach ($params['option_value'] as $k => $v) { if (strlen(trim($v))) { $optionValue = new CRM_Core_DAO_OptionValue(); @@ -259,8 +265,9 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { ); if (!CRM_Utils_System::isNull(explode(CRM_Core_DAO::VALUE_SEPARATOR, - $defaultValue - ))) { + $defaultValue + )) + ) { $params['default_value'] = $defaultValue; } } @@ -386,14 +393,15 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @static */ - public static function &getFields($customDataType = 'Individual', - $showAll = FALSE, - $inline = FALSE, - $customDataSubType = NULL, - $customDataSubName = NULL, - $onlyParent = FALSE, - $onlySubType = FALSE, - $checkPermission = TRUE + public static function &getFields( + $customDataType = 'Individual', + $showAll = FALSE, + $inline = FALSE, + $customDataSubType = NULL, + $customDataSubName = NULL, + $onlyParent = FALSE, + $onlySubType = FALSE, + $checkPermission = TRUE ) { if (empty($customDataType)) { $customDataType = array('Contact', 'Individual', 'Organization', 'Household'); @@ -608,12 +616,13 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @static */ - public static function &getFieldsForImport($contactType = 'Individual', - $showAll = FALSE, - $onlyParent = FALSE, - $search = FALSE, + public static function &getFieldsForImport( + $contactType = 'Individual', + $showAll = FALSE, + $onlyParent = FALSE, + $search = FALSE, $checkPermission = TRUE, - $withMultiple = FALSE + $withMultiple = FALSE ) { // Note: there are situations when we want getFieldsForImport() return fields related // ONLY to basic contact types, but NOT subtypes. And thats where $onlyParent is helpful @@ -704,8 +713,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $field = new CRM_Core_DAO_CustomField(); // check if we can get the field values from the system cache - $cacheKey = "CRM_Core_DAO_CustomField_{$fieldID}"; - $cache = CRM_Utils_Cache::singleton(); + $cacheKey = "CRM_Core_DAO_CustomField_{$fieldID}"; + $cache = CRM_Utils_Cache::singleton(); $fieldValues = $cache->get($cacheKey); if (empty($fieldValues)) { $field->id = $fieldID; @@ -744,21 +753,22 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @static */ - public static function addQuickFormElement(&$qf, + public static function addQuickFormElement( + &$qf, $elementName, $fieldId, $inactiveNeeded = FALSE, - $useRequired = TRUE, - $search = FALSE, - $label = NULL + $useRequired = TRUE, + $search = FALSE, + $label = NULL ) { $field = self::getFieldObject($fieldId); $widget = $field->html_type; // Custom field HTML should indicate group+field name $groupName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $field->custom_group_id); - $dataCrmCustomVal = $groupName.':'.$field->name; - $dataCrmCustomAttr = 'data-crm-custom="'.$dataCrmCustomVal.'"'; + $dataCrmCustomVal = $groupName . ':' . $field->name; + $dataCrmCustomAttr = 'data-crm-custom="' . $dataCrmCustomVal . '"'; $field->attributes .= $dataCrmCustomAttr; // Fixed for Issue CRM-2183 @@ -769,10 +779,23 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $placeholder = $search ? ts('- any -') : ($useRequired ? ts('- select -') : ts('- none -')); // FIXME: Why are select state/country separate widget types? - $isSelect = (in_array($widget, array('Select', 'Multi-Select', 'Select State/Province', 'Multi-Select State/Province', 'Select Country', 'Multi-Select Country', 'AdvMulti-Select', 'CheckBox', 'Radio'))); + $isSelect = (in_array($widget, array( + 'Select', + 'Multi-Select', + 'Select State/Province', + 'Multi-Select State/Province', + 'Select Country', + 'Multi-Select Country', + 'AdvMulti-Select', + 'CheckBox', + 'Radio' + ))); if ($isSelect) { - $options = CRM_Utils_Array::value('values', civicrm_api3('contact', 'getoptions', array('field' => "custom_$fieldId", 'context' => $search ? 'search' : 'create'), array())); + $options = CRM_Utils_Array::value('values', civicrm_api3('contact', 'getoptions', array( + 'field' => "custom_$fieldId", + 'context' => $search ? 'search' : 'create' + ), array())); // Consolidate widget types to simplify the below switch statement if ($search || ($widget !== 'AdvMulti-Select' && strpos($widget, 'Select') !== FALSE)) { @@ -791,7 +814,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { // Add data for popup link. Normally this is handled by CRM_Core_Form->addSelect if ($field->option_group_id && !$search && $widget == 'Select' && CRM_Core_Permission::check('administer CiviCRM')) { $selectAttributes += array( - 'data-api-entity' => 'contact', // FIXME: This works because the getoptions api isn't picky about custom fields, but it's WRONG + 'data-api-entity' => 'contact', + // FIXME: This works because the getoptions api isn't picky about custom fields, but it's WRONG 'data-api-field' => 'custom_' . $field->id, 'data-option-edit-path' => 'civicrm/admin/options/' . CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $field->option_group_id), ); @@ -873,18 +897,18 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $qf->addDate($elementName, $label, $required, array( 'format' => $field->date_format, - 'timeFormat' => $field->time_format, - 'startOffset' => $field->start_date_years, - 'endOffset' => $field->end_date_years, - 'data-crm-custom' => $dataCrmCustomVal, - )); + 'timeFormat' => $field->time_format, + 'startOffset' => $field->start_date_years, + 'endOffset' => $field->end_date_years, + 'data-crm-custom' => $dataCrmCustomVal, + )); } break; case 'Radio': $choice = array(); foreach ($options as $v => $l) { - $choice[] = $qf->createElement('radio', NULL, '', $l, (string)$v, $field->attributes); + $choice[] = $qf->createElement('radio', NULL, '', $l, (string) $v, $field->attributes); } $group = $qf->addGroup($choice, $elementName, $label); if ($useRequired && !$search) { @@ -962,7 +986,11 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { break; case 'RichTextEditor': - $attributes = array('rows' => $field->note_rows, 'cols' => $field->note_columns, 'data-crm-custom' => $dataCrmCustomVal); + $attributes = array( + 'rows' => $field->note_rows, + 'cols' => $field->note_columns, + 'data-crm-custom' => $dataCrmCustomVal + ); if ($field->text_length) { $attributes['maxlength'] = $field->text_length; } @@ -974,7 +1002,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { // Fixme: why is this a string in the first place?? $attributes = array(); if ($field->attributes) { - foreach(explode(' ', $field->attributes) as $at) { + foreach (explode(' ', $field->attributes) as $at) { if (strpos($at, '=')) { list($k, $v) = explode('=', $at); $attributes[$k] = trim($v, ' "'); @@ -1107,11 +1135,11 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @static */ public static function getDisplayValue($value, $id, &$options, $contactID = NULL, $fieldID = NULL) { - $option = &$options[$id]; + $option = &$options[$id]; $attributes = &$option['attributes']; - $html_type = $attributes['html_type']; - $data_type = $attributes['data_type']; - $format = CRM_Utils_Array::value('format', $attributes); + $html_type = $attributes['html_type']; + $data_type = $attributes['data_type']; + $format = CRM_Utils_Array::value('format', $attributes); return self::getDisplayValueCommon($value, $option, @@ -1134,13 +1162,14 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @return array|mixed|null|string */ - static function getDisplayValueCommon($value, + static function getDisplayValueCommon( + $value, &$option, $html_type, $data_type, - $format = NULL, + $format = NULL, $contactID = NULL, - $fieldID = NULL + $fieldID = NULL ) { $display = $value; @@ -1164,7 +1193,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { if ($value) { $display = ts('Yes'); } - elseif ((string)$value === '0') { + elseif ((string) $value === '0') { $display = ts('No'); } } @@ -1347,7 +1376,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @static */ - static function setProfileDefaults($customFieldId, + static function setProfileDefaults( + $customFieldId, $elementName, &$defaults, $contactId = NULL, @@ -1366,8 +1396,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { } else { if (!isset($value)) { - $info = self::getTableColumnGroup($customFieldId); - $query = "SELECT {$info[0]}.{$info[1]} as value FROM {$info[0]} WHERE {$info[0]}.entity_id = {$contactId}"; + $info = self::getTableColumnGroup($customFieldId); + $query = "SELECT {$info[0]}.{$info[1]} as value FROM {$info[0]} WHERE {$info[0]}.entity_id = {$contactId}"; $result = CRM_Core_DAO::executeQuery($query); if ($result->fetch()) { $value = $result->value; @@ -1560,12 +1590,13 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @return array $customFormatted formatted custom field array * @static */ - static function formatCustomField($customFieldId, &$customFormatted, $value, + static function formatCustomField( + $customFieldId, &$customFormatted, $value, $customFieldExtend, $customValueId = NULL, $entityId = NULL, $inline = FALSE, $checkPermission = TRUE, - $includeViewOnly = false + $includeViewOnly = FALSE ) { //get the custom fields for the entity //subtype and basic type @@ -1575,8 +1606,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { } if (in_array($customFieldExtend, - CRM_Contact_BAO_ContactType::subTypes() - )) { + CRM_Contact_BAO_ContactType::subTypes() + )) { // This is the case when getFieldsForImport() requires fields // of subtype and its parent.CRM-5143 $customDataSubType = $customFieldExtend; @@ -1630,8 +1661,8 @@ SELECT id } if (!empty($selectedValues)) { $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, - $selectedValues - ) . CRM_Core_DAO::VALUE_SEPARATOR; + $selectedValues + ) . CRM_Core_DAO::VALUE_SEPARATOR; } else { $value = ''; @@ -1648,8 +1679,8 @@ SELECT id // and you can directly use value, CRM-4385 if (is_array($value)) { $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, - array_values($value) - ) . CRM_Core_DAO::VALUE_SEPARATOR; + array_values($value) + ) . CRM_Core_DAO::VALUE_SEPARATOR; } } else { @@ -1905,7 +1936,7 @@ SELECT $columnName * FK to civicrm_custom_group. * * @return array( - string) or TRUE + * string) or TRUE */ public static function _moveFieldValidate($fieldID, $newGroupID) { $errors = array(); @@ -1965,7 +1996,8 @@ SELECT extends FROM civicrm_custom_group WHERE id IN ( %1, %2 ) "; - $params = array(1 => array($oldGroup->id, 'Integer'), + $params = array( + 1 => array($oldGroup->id, 'Integer'), 2 => array($newGroup->id, 'Integer'), ); @@ -2040,8 +2072,8 @@ WHERE id IN ( %1, %2 ) * @static */ public static function getTableColumnGroup($fieldID, $force = FALSE) { - $cacheKey = "CRM_Core_DAO_CustomField_CustomGroup_TableColumn_{$fieldID}"; - $cache = CRM_Utils_Cache::singleton(); + $cacheKey = "CRM_Core_DAO_CustomField_CustomGroup_TableColumn_{$fieldID}"; + $cache = CRM_Utils_Cache::singleton(); $fieldValues = $cache->get($cacheKey); if (empty($fieldValues) || $force) { $query = " @@ -2176,8 +2208,8 @@ WHERE option_group_id = {$optionGroupId} AND default_value IS NOT NULL ORDER BY html_type"; - $dao = CRM_Core_DAO::executeQuery($query); - $defaultValue = NULL; + $dao = CRM_Core_DAO::executeQuery($query); + $defaultValue = NULL; $defaultHTMLType = NULL; while ($dao->fetch()) { if ($dao->html_type == $htmlType) { @@ -2218,7 +2250,8 @@ ORDER BY html_type"; * * @return array */ - static function postProcess(&$params, + static function postProcess( + &$params, &$customFields, $entityID, $customFieldExtends, @@ -2269,12 +2302,13 @@ ORDER BY html_type"; $optionGroupID = NULL; if (($field['html_type'] == 'CheckBox' || - $field['html_type'] == 'Radio' || - $field['html_type'] == 'Select' || - $field['html_type'] == 'AdvMulti-Select' || - $field['html_type'] == 'Multi-Select' || - ($field['html_type'] == 'Autocomplete-Select' && $field['data_type'] != 'ContactReference') - )) { + $field['html_type'] == 'Radio' || + $field['html_type'] == 'Select' || + $field['html_type'] == 'AdvMulti-Select' || + $field['html_type'] == 'Multi-Select' || + ($field['html_type'] == 'Autocomplete-Select' && $field['data_type'] != 'ContactReference') + ) + ) { if ($field['option_group_id']) { $optionGroupID = $field['option_group_id']; } @@ -2357,7 +2391,6 @@ FROM civicrm_custom_field f INNER JOIN civicrm_custom_group g ON f.custom_group_id = g.id WHERE f.id IN ($ids)"; - $dao = CRM_Core_DAO::executeQuery($sql); $result = array(); while ($dao->fetch()) { @@ -2387,7 +2420,6 @@ WHERE f.id IN ($ids)"; return $errors; } - //pick up profile fields. $profileFields = array(); $ufGroupId = CRM_Utils_Array::value('ufGroupId', $params); @@ -2414,8 +2446,8 @@ WHERE f.id IN ($ids)"; $dataType = $field->data_type; $profileField = CRM_Utils_Array::value($key, $profileFields, array()); - $fieldTitle = CRM_Utils_Array::value('title', $profileField); - $isRequired = CRM_Utils_Array::value('is_required', $profileField); + $fieldTitle = CRM_Utils_Array::value('title', $profileField); + $isRequired = CRM_Utils_Array::value('is_required', $profileField); if (!$fieldTitle) { $fieldTitle = $field->label; } diff --git a/CRM/Core/BAO/Log.php b/CRM/Core/BAO/Log.php index 89675ee6dc..e50ec7c58a 100644 --- a/CRM/Core/BAO/Log.php +++ b/CRM/Core/BAO/Log.php @@ -87,7 +87,8 @@ class CRM_Core_BAO_Log extends CRM_Core_DAO_Log { * @param int $tableID * @param int $userID */ - static function register($contactID, + static function register( + $contactID, $tableName, $tableID, $userID = NULL diff --git a/CRM/Core/BAO/Setting.php b/CRM/Core/BAO/Setting.php index b8475d451f..a4602f9e1c 100644 --- a/CRM/Core/BAO/Setting.php +++ b/CRM/Core/BAO/Setting.php @@ -132,7 +132,8 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { * * @return string */ - static function setCache($values, + static function setCache( + $values, $group, $componentID = NULL, $contactID = NULL, @@ -161,7 +162,8 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { * * @return CRM_Core_DAO_Domain|CRM_Core_DAO_Setting */ - static function dao($group, + static function dao( + $group, $name = NULL, $componentID = NULL, $contactID = NULL, @@ -828,7 +830,8 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { * * @return array */ - static function valueOptions($group, + static function valueOptions( + $group, $name, $system = TRUE, $userID = NULL, @@ -886,7 +889,8 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { * @param int $userID * @param string $keyField */ - static function setValueOption($group, + static function setValueOption( + $group, $name, $value, $system = TRUE, diff --git a/CRM/Core/BAO/Tag.php b/CRM/Core/BAO/Tag.php index 4625c39ec5..23f4dc30c1 100644 --- a/CRM/Core/BAO/Tag.php +++ b/CRM/Core/BAO/Tag.php @@ -126,7 +126,8 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag { * * @return array */ - public static function getTagsUsedFor($usedFor = array('civicrm_contact'), + public static function getTagsUsedFor($usedFor = array( + 'civicrm_contact'), $buildSelect = TRUE, $all = FALSE, $parentId = NULL @@ -196,7 +197,8 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag { * * @return array */ - static function getTags($usedFor = 'civicrm_contact', + static function getTags( + $usedFor = 'civicrm_contact', &$tags = array(), $parentId = NULL, $separator = '  ', diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index e1178aea75..804aeeab4d 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -992,7 +992,8 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { // Create a unique, non-empty index for each field. $index = $field['title']; - if ($index === '') { $index = ' '; + if ($index === '') { + $index = ' '; } while (array_key_exists($index, $values)) { $index .= ' '; @@ -2341,8 +2342,9 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) * @return null * @static */ - static function setProfileDefaults($contactId, &$fields, &$defaults, - $singleProfile = TRUE, $componentId = NULL, $component = NULL + static function setProfileDefaults( + $contactId, &$fields, &$defaults, + $singleProfile = TRUE, $componentId = NULL, $component = NULL ) { if (!$componentId) { //get the contact details diff --git a/CRM/Core/Component.php b/CRM/Core/Component.php index bdd7186089..0a7fe2a69c 100644 --- a/CRM/Core/Component.php +++ b/CRM/Core/Component.php @@ -327,7 +327,8 @@ class CRM_Core_Component { * * @return null */ - static function &defaultReturnProperties($mode, + static function &defaultReturnProperties( + $mode, $includeCustomFields = TRUE ) { $info = self::_info(); diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index 92f266caf5..2b686b3ecc 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -1180,7 +1180,8 @@ FROM civicrm_domain * * @static */ - static function &singleValueQuery($query, + static function &singleValueQuery( + $query, $params = array(), $abort = TRUE, $i18nRewrite = TRUE diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index abf22266ad..a0a2d99409 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -533,7 +533,8 @@ class CRM_Core_Error extends PEAR_ErrorStack { * @see CRM_Core_Error::debug() * @see CRM_Core_Error::debug_log_message() */ - static function debug_var($variable_name, + static function debug_var( + $variable_name, $variable, $print = TRUE, $log = TRUE, diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 62362f76a2..f4aafa52a0 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -171,7 +171,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $state = NULL, $action = CRM_Core_Action::NONE, $method = 'post', - $name = NULL + $name = NULL ) { if ($name) { @@ -251,7 +251,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * * @return HTML_QuickForm_Element could be an error object */ - function &add($type, $name, $label = '', + function &add( + $type, $name, $label = '', $attributes = '', $required = FALSE, $extra = NULL ) { if ($type == 'select' && is_array($extra)) { @@ -302,7 +303,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @return void * */ - public function preProcess() {} + public function preProcess() { + } /** * This function is called after the form is validated. Any @@ -316,7 +318,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @return void * */ - public function postProcess() {} + public function postProcess() { + } /** * This function is just a wrapper, so that we can call all the hook functions @@ -360,7 +363,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @return void * */ - public function buildQuickForm() {} + public function buildQuickForm() { + } /** * This virtual function is used to set the default values of @@ -371,7 +375,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @return array reference to the array of default values * */ - public function setDefaultValues() {} + public function setDefaultValues() { + } /** * This is a virtual function that adds group and global rules to @@ -382,7 +387,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @return void * */ - public function addRules() {} + public function addRules() { + } /** * Performs the server side validation @@ -468,12 +474,12 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $this->addRules(); //Set html data-attribute to enable warning user of unsaved changes - if ($this->unsavedChangesWarn === true + if ($this->unsavedChangesWarn === TRUE || (!isset($this->unsavedChangesWarn) && ($this->_action & CRM_Core_Action::ADD || $this->_action & CRM_Core_Action::UPDATE) ) ) { - $this->setAttribute('data-warn-changes', 'true'); + $this->setAttribute('data-warn-changes', 'true'); } } @@ -817,7 +823,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * The value to append. * @param bool $merge */ - public function append($tpl_var, $value=NULL, $merge=FALSE) { + public function append($tpl_var, $value = NULL, $merge = FALSE) { self::$_template->append($tpl_var, $value, $merge); } @@ -828,7 +834,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * * @return array */ - public function get_template_vars($name=null) { + public function get_template_vars($name = NULL) { return self::$_template->get_template_vars($name); } @@ -894,10 +900,11 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @param string $separator * @param bool $flipValues */ - function addCheckBox($id, $title, $values, $other = NULL, - $attributes = NULL, $required = NULL, + function addCheckBox( + $id, $title, $values, $other = NULL, + $attributes = NULL, $required = NULL, $javascriptMethod = NULL, - $separator = '
', $flipValues = FALSE + $separator = '
', $flipValues = FALSE ) { $options = array(); @@ -1361,14 +1368,15 @@ class CRM_Core_Form extends HTML_QuickForm_Page { /** * Add a currency and money element to the form */ - function addMoney($name, + function addMoney( + $name, $label, - $required = FALSE, - $attributes = NULL, - $addCurrency = TRUE, - $currencyName = 'currency', + $required = FALSE, + $attributes = NULL, + $addCurrency = TRUE, + $currencyName = 'currency', $defaultCurrency = NULL, - $freezeCurrency = FALSE + $freezeCurrency = FALSE ) { $element = $this->add('text', $name, $label, $attributes, $required); $this->addRule($name, ts('Please enter a valid amount.'), 'money'); @@ -1383,11 +1391,12 @@ class CRM_Core_Form extends HTML_QuickForm_Page { /** * Add currency element to the form */ - function addCurrency($name = 'currency', - $label = NULL, - $required = TRUE, + function addCurrency( + $name = 'currency', + $label = NULL, + $required = TRUE, $defaultCurrency = NULL, - $freezeCurrency = FALSE + $freezeCurrency = FALSE ) { $currencies = CRM_Core_OptionGroup::values('currencies_enabled'); $options = array('class' => 'crm-select2 eight'); @@ -1515,7 +1524,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * perform specific action on cancel action * */ - public function cancelAction() {} + public function cancelAction() { + } /** * Helper function to verify that required fields have been filled @@ -1583,9 +1593,9 @@ class CRM_Core_Form extends HTML_QuickForm_Page { return $userID; } - /** - * Get the contact id of the logged in user - */ + /** + * Get the contact id of the logged in user + */ public function getLoggedInUserContactID() { // check if the user is logged in and has a contact ID $session = CRM_Core_Session::singleton(); @@ -1641,8 +1651,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { public function canUseAjaxContactLookups() { if (0 < (civicrm_api3('contact', 'getcount', array('check_permissions' => 1))) && CRM_Core_Permission::check(array(array('access AJAX API', 'access CiviCRM')))) { - return TRUE; - } + return TRUE; + } } /** @@ -1719,13 +1729,16 @@ class CRM_Core_Form extends HTML_QuickForm_Page { case CRM_Core_Action::ADD: CRM_Utils_System::setTitle(ts('New %1', array(1 => $entityLabel))); break; + case CRM_Core_Action::UPDATE: CRM_Utils_System::setTitle(ts('Edit %1', array(1 => $entityLabel))); break; + case CRM_Core_Action::VIEW: case CRM_Core_Action::PREVIEW: CRM_Utils_System::setTitle(ts('View %1', array(1 => $entityLabel))); break; + case CRM_Core_Action::DELETE: CRM_Utils_System::setTitle(ts('Delete %1', array(1 => $entityLabel))); break; @@ -1815,10 +1828,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page { private function validateChainSelectFields() { foreach ($this->_chainSelectFields as $control => $target) { if ($this->elementExists($control)) { - $controlValue = (array)$this->getElementValue($control); + $controlValue = (array) $this->getElementValue($control); $targetField = $this->getElement($target); $controlType = $targetField->getAttribute('data-callback') == 'civicrm/ajax/jqCounty' ? 'stateProvince' : 'country'; - $targetValue = array_filter((array)$targetField->getValue()); + $targetValue = array_filter((array) $targetField->getValue()); if ($targetValue || $this->getElementError($target)) { $options = CRM_Core_BAO_Location::getChainSelectValues($controlValue, $controlType, TRUE); if ($targetValue) { diff --git a/CRM/Core/Form/Tag.php b/CRM/Core/Form/Tag.php index f0399c196e..97a0a616d0 100644 --- a/CRM/Core/Form/Tag.php +++ b/CRM/Core/Form/Tag.php @@ -61,7 +61,8 @@ class CRM_Core_Form_Tag { * @return void * @static */ - static function buildQuickForm(&$form, $parentNames, $entityTable, $entityId = NULL, $skipTagCreate = FALSE, + static function buildQuickForm( + &$form, $parentNames, $entityTable, $entityId = NULL, $skipTagCreate = FALSE, $skipEntityAction = FALSE, $tagsetElementName = NULL ) { $tagset = $form->_entityTagValues = array(); $form->assign("isTagset", FALSE); diff --git a/CRM/Core/OptionGroup.php b/CRM/Core/OptionGroup.php index 38b026b375..eaf729749e 100644 --- a/CRM/Core/OptionGroup.php +++ b/CRM/Core/OptionGroup.php @@ -378,7 +378,8 @@ WHERE v.option_group_id = g.id * * @return null */ - static function getValue($groupName, + static function getValue( + $groupName, $label, $labelField = 'label', $labelType = 'String', @@ -597,7 +598,8 @@ SELECT v.label * * @return array */ - static function getRowValues($groupName, $fieldValue, $field = 'name', + static function getRowValues( + $groupName, $fieldValue, $field = 'name', $fieldType = 'String', $active = TRUE ) { $query = " diff --git a/CRM/Core/Payment/PayPalIPN.php b/CRM/Core/Payment/PayPalIPN.php index 2d8009ac80..ae915749c8 100644 --- a/CRM/Core/Payment/PayPalIPN.php +++ b/CRM/Core/Payment/PayPalIPN.php @@ -226,7 +226,8 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { * @param bool $recur * @param bool $first */ - function single(&$input, &$ids, &$objects, + function single( + &$input, &$ids, &$objects, $recur = FALSE, $first = FALSE ) { diff --git a/CRM/Core/QuickForm/NestedAdvMultiSelect.php b/CRM/Core/QuickForm/NestedAdvMultiSelect.php index b03196e896..42c0a50f1f 100644 --- a/CRM/Core/QuickForm/NestedAdvMultiSelect.php +++ b/CRM/Core/QuickForm/NestedAdvMultiSelect.php @@ -61,7 +61,8 @@ class CRM_Core_QuickForm_NestedAdvMultiSelect extends HTML_QuickForm_advmultisel * @throws PEAR_Error * @see loadArray() */ - function load(&$options, $param1 = NULL, $param2 = NULL, + function load( + &$options, $param1 = NULL, $param2 = NULL, $param3 = NULL, $param4 = NULL ) { switch (TRUE) {