From ce80b209ca04900e29af61f2c9b935af7d64fe67 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 13:09:20 -0800 Subject: [PATCH] INFRA-132 - CRM/Contact - phpcbf --- CRM/Contact/Import/Form/MapField.php | 8 +++++--- CRM/Contact/Import/ImportJob.php | 6 ++++-- CRM/Contact/Import/Parser.php | 5 ++--- CRM/Contact/Page/AJAX.php | 15 +++++++-------- CRM/Contact/Page/DedupeException.php | 3 ++- CRM/Contact/Page/DedupeFind.php | 3 ++- CRM/Contact/Page/Inline/Address.php | 6 +++--- CRM/Contact/Page/Inline/Email.php | 4 ++-- CRM/Contact/Page/Inline/Phone.php | 4 ++-- CRM/Contact/Page/View.php | 4 ++-- CRM/Contact/Page/View/ContactSmartGroup.php | 4 ++-- CRM/Contact/Page/View/Relationship.php | 1 - CRM/Contact/Page/View/Summary.php | 3 +-- CRM/Contact/Page/View/UserDashBoard.php | 1 - CRM/Contact/Selector.php | 11 ++++------- CRM/Contact/Selector/Custom.php | 21 ++++++++++----------- 16 files changed, 48 insertions(+), 51 deletions(-) diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index 6ede1d1fae..8f43dd2858 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -699,11 +699,13 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { ); //set respective mapper params to array. - foreach (array_keys($mapperParams) as $mapperParam)$$mapperParam = array(); + foreach (array_keys($mapperParams) as $mapperParam) { $$mapperParam = array(); + } for ($i = 0; $i < $this->_columnCount; $i++) { //set respective mapper value to null - foreach (array_values($mapperParams) as $mapperParam)$$mapperParam = NULL; + foreach (array_values($mapperParams) as $mapperParam) { $$mapperParam = NULL; + } $fldName = CRM_Utils_Array::value(0, $mapperKeys[$i]); $selOne = CRM_Utils_Array::value(1, $mapperKeys[$i]); @@ -813,7 +815,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { for ($i = 0; $i < $this->_columnCount; $i++) { $updateMappingFields = new CRM_Core_DAO_MappingField(); - $updateMappingFields->id = CRM_Utils_Array::value($i,$mappingFieldsId); + $updateMappingFields->id = CRM_Utils_Array::value($i, $mappingFieldsId); $updateMappingFields->mapping_id = $params['mappingId']; $updateMappingFields->column_number = $i; diff --git a/CRM/Contact/Import/ImportJob.php b/CRM/Contact/Import/ImportJob.php index ae11294d3a..a9264e1d7c 100644 --- a/CRM/Contact/Import/ImportJob.php +++ b/CRM/Contact/Import/ImportJob.php @@ -118,7 +118,8 @@ class CRM_Contact_Import_ImportJob { 'mapperRelatedContactImProvider', 'mapperRelatedContactWebsiteType', ); - foreach ($properties as $property) $this->{"_$property"} = array(); + foreach ($properties as $property) { $this->{"_$property"} = array(); + } } /** @@ -190,7 +191,8 @@ class CRM_Contact_Import_ImportJob { foreach ($mapper as $key => $value) { //set respective mapper value to null. - foreach (array_values($mapperPeroperties) as $perpertyVal)$$perpertyVal = NULL; + foreach (array_values($mapperPeroperties) as $perpertyVal) { $$perpertyVal = NULL; + } $fldName = CRM_Utils_Array::value(0, $mapper[$key]); $header = array($this->_mapFields[$fldName]); diff --git a/CRM/Contact/Import/Parser.php b/CRM/Contact/Import/Parser.php index 7d8651aeca..24006dc196 100644 --- a/CRM/Contact/Import/Parser.php +++ b/CRM/Contact/Import/Parser.php @@ -238,7 +238,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { $estimatedTime = $estimatedTime - ($estMinutes * 60); } $timeFormatted .= round($estimatedTime) . ' ' . ts('seconds'); - $processedPercent = (int )(($this->_rowCount * 100) / $totalRowCount); + $processedPercent = (int ) (($this->_rowCount * 100) / $totalRowCount); $statusMsg = ts('%1 of %2 records - %3 remaining', array(1 => $this->_rowCount, 2 => $totalRowCount, 3 => $timeFormatted) ); @@ -248,7 +248,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { "; - $contents = json_encode (array($processedPercent, $status)); + $contents = json_encode(array($processedPercent, $status)); file_put_contents($statusFile, $contents); @@ -334,7 +334,6 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { } */ } - if ($mode == self::MODE_PREVIEW || $mode == self::MODE_IMPORT) { $customHeaders = $mapper; diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index 74ec995e98..998f63e84b 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -483,7 +483,8 @@ ORDER BY sort_name "; else { while ($dao->fetch()) { if ($json) { - $elements[] = array('name' => addslashes($dao->sort_name), + $elements[] = array( + 'name' => addslashes($dao->sort_name), 'id' => $dao->id, ); } @@ -561,7 +562,7 @@ ORDER BY sort_name "; // make sure recordClass is namespaced (we cant check CRM since extensions can also use this) // but it should be at least 3 levels deep if (count($recordClass) >= 3) { - require_once (str_replace('_', DIRECTORY_SEPARATOR, $recordBAO) . ".php"); + require_once str_replace('_', DIRECTORY_SEPARATOR, $recordBAO) . ".php"; $method = 'setIsActive'; if (method_exists($recordBAO, $method)) { @@ -581,9 +582,9 @@ ORDER BY sort_name "; } /** - * check the CMS username - * - */ + * check the CMS username + * + */ static public function checkUserName() { $signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), array('for', 'ts')); if ( @@ -711,11 +712,10 @@ LIMIT {$offset}, {$rowCount} CRM_Utils_Array::value('cid', $_GET) ); - $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { - //working here + //working here $result[] = array( 'text' => '"' . $dao->name . '" <' . $dao->email . '>', 'id' => (CRM_Utils_Array::value('id', $_GET)) ? "{$dao->id}::{$dao->email}" : '"' . $dao->name . '" <' . $dao->email . '>', @@ -947,7 +947,6 @@ LIMIT {$offset}, {$rowCount} $searchRows = array(); $selectorElements = array('src', 'dst', 'weight', 'actions'); - $join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND pn.entity_id2 = de.contact_id2 )"; $where = "de.id IS NULL"; diff --git a/CRM/Contact/Page/DedupeException.php b/CRM/Contact/Page/DedupeException.php index 5b9c432769..9ff75ba9ba 100644 --- a/CRM/Contact/Page/DedupeException.php +++ b/CRM/Contact/Page/DedupeException.php @@ -57,7 +57,8 @@ class CRM_Contact_Page_DedupeException extends CRM_Core_Page { $key = "{$exception->contact_id1}_{$exception->contact_id2}"; $contactIds[$exception->contact_id1] = $exception->contact_id1; $contactIds[$exception->contact_id2] = $exception->contact_id2; - $dedupeExceptions[$key] = array('main' => array('id' => $exception->contact_id1), + $dedupeExceptions[$key] = array( + 'main' => array('id' => $exception->contact_id1), 'other' => array('id' => $exception->contact_id2), ); } diff --git a/CRM/Contact/Page/DedupeFind.php b/CRM/Contact/Page/DedupeFind.php index 74721d1bb5..6b77d79f69 100644 --- a/CRM/Contact/Page/DedupeFind.php +++ b/CRM/Contact/Page/DedupeFind.php @@ -52,7 +52,8 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic { * * @return array (reference) of action links */ - public function &links() {} + public function &links() { + } /** * Browse all rule groups diff --git a/CRM/Contact/Page/Inline/Address.php b/CRM/Contact/Page/Inline/Address.php index d325ea8cc2..5871f917a3 100644 --- a/CRM/Contact/Page/Inline/Address.php +++ b/CRM/Contact/Page/Inline/Address.php @@ -60,7 +60,7 @@ class CRM_Contact_Page_Inline_Address extends CRM_Core_Page { $entityBlock = array('id' => $addressId); $address = CRM_Core_BAO_Address::getValues($entityBlock, FALSE, 'id'); if (!empty($address)) { - foreach ($address as $key =>& $value) { + foreach ($address as $key => & $value) { $value['location_type'] = $locationTypes[$value['location_type_id']]; } } @@ -98,8 +98,8 @@ class CRM_Contact_Page_Inline_Address extends CRM_Core_Page { } $contact = new CRM_Contact_BAO_Contact( ); $contact->id = $contactId; - $contact->find(true); - $privacy = array( ); + $contact->find(TRUE); + $privacy = array(); foreach ( CRM_Contact_BAO_Contact::$_commPrefs as $name ) { if ( isset( $contact->$name ) ) { $privacy[$name] = $contact->$name; diff --git a/CRM/Contact/Page/Inline/Email.php b/CRM/Contact/Page/Inline/Email.php index df793285c8..5176525c0d 100644 --- a/CRM/Contact/Page/Inline/Email.php +++ b/CRM/Contact/Page/Inline/Email.php @@ -63,8 +63,8 @@ class CRM_Contact_Page_Inline_Email extends CRM_Core_Page { $contact = new CRM_Contact_BAO_Contact( ); $contact->id = $contactId; - $contact->find(true); - $privacy = array( ); + $contact->find(TRUE); + $privacy = array(); foreach ( CRM_Contact_BAO_Contact::$_commPrefs as $name ) { if ( isset( $contact->$name ) ) { $privacy[$name] = $contact->$name; diff --git a/CRM/Contact/Page/Inline/Phone.php b/CRM/Contact/Page/Inline/Phone.php index 60ddf85df8..33c436fc02 100644 --- a/CRM/Contact/Page/Inline/Phone.php +++ b/CRM/Contact/Page/Inline/Phone.php @@ -65,8 +65,8 @@ class CRM_Contact_Page_Inline_Phone extends CRM_Core_Page { $contact = new CRM_Contact_BAO_Contact( ); $contact->id = $contactId; - $contact->find(true); - $privacy = array( ); + $contact->find(TRUE); + $privacy = array(); foreach ( CRM_Contact_BAO_Contact::$_commPrefs as $name ) { if ( isset( $contact->$name ) ) { $privacy[$name] = $contact->$name; diff --git a/CRM/Contact/Page/View.php b/CRM/Contact/Page/View.php index 494c5f9111..133cb93735 100644 --- a/CRM/Contact/Page/View.php +++ b/CRM/Contact/Page/View.php @@ -152,7 +152,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { $this->assign($navContacts); $path = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $this->_contactId); - CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('View Contact'), 'url' => $path,))); + CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('View Contact'), 'url' => $path))); if ($image_URL = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'image_URL')) { //CRM-7265 --time being fix. @@ -348,7 +348,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { * @param int $cid */ public static function addUrls(&$obj, $cid) { - $uid = CRM_Core_BAO_UFMatch::getUFId($cid); + $uid = CRM_Core_BAO_UFMatch::getUFId($cid); if ($uid) { $userRecordUrl = CRM_Core_Config::singleton()->userSystem->getUserRecordUrl($cid); diff --git a/CRM/Contact/Page/View/ContactSmartGroup.php b/CRM/Contact/Page/View/ContactSmartGroup.php index f74d48658c..5d5df074de 100644 --- a/CRM/Contact/Page/View/ContactSmartGroup.php +++ b/CRM/Contact/Page/View/ContactSmartGroup.php @@ -57,11 +57,11 @@ class CRM_Contact_Page_View_ContactSmartGroup extends CRM_Core_Page { } $allGroup = CRM_Contact_BAO_GroupContactCache::contactGroup($this->_contactId); - $this->assign('groupSmart' , NULL); + $this->assign('groupSmart', NULL); $this->assign('groupParent', NULL); if (!empty($allGroup)) { - $smart = $parent = array( ); + $smart = $parent = array(); foreach ($allGroup['group'] as $group) { // delete all smart groups which are also in static groups if (isset($staticGroups[$group['id']])) { diff --git a/CRM/Contact/Page/View/Relationship.php b/CRM/Contact/Page/View/Relationship.php index 8f9b8a3234..354b00e08a 100644 --- a/CRM/Contact/Page/View/Relationship.php +++ b/CRM/Contact/Page/View/Relationship.php @@ -101,7 +101,6 @@ class CRM_Contact_Page_View_Relationship extends CRM_Core_Page { "action=view&reset=1&id={$viewRelationship[$this->_id]['id']}&cid={$this->_contactId}&context=home" ); - $session = CRM_Core_Session::singleton(); $recentOther = array(); diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index ea3b02cc6e..7aa79b1b19 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -419,8 +419,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { */ public function getTemplateFileName() { if ($this->_contactId) { - $contactSubtypes = $this->get('contactSubtype') ? - explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->get('contactSubtype')) : array(); + $contactSubtypes = $this->get('contactSubtype') ? explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->get('contactSubtype')) : array(); // there could be multiple subtypes. We check templates for each of the subtype, and return the first one found. foreach ($contactSubtypes as $csType) { diff --git a/CRM/Contact/Page/View/UserDashBoard.php b/CRM/Contact/Page/View/UserDashBoard.php index a6cab59f11..7c3db5361b 100644 --- a/CRM/Contact/Page/View/UserDashBoard.php +++ b/CRM/Contact/Page/View/UserDashBoard.php @@ -237,7 +237,6 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page { ), ); - if (CRM_Core_Permission::check('access CiviCRM')) { self::$_links = array_merge(self::$_links, array( CRM_Core_Action::DISABLE => array( diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 99ea33017a..11c927f94d 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -792,15 +792,13 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se // allow components to add more actions CRM_Core_Component::searchAction($row, $result->contact_id); - $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? - $result->contact_sub_type : $result->contact_type, + $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id ); $row['contact_type_orig'] = $result->contact_sub_type ? $result->contact_sub_type : $result->contact_type; - $row['contact_sub_type'] = $result->contact_sub_type ? - CRM_Contact_BAO_ContactType::contactTypePairs(FALSE, $result->contact_sub_type, ', ') : $result->contact_sub_type; + $row['contact_sub_type'] = $result->contact_sub_type ? CRM_Contact_BAO_ContactType::contactTypePairs(FALSE, $result->contact_sub_type, ', ') : $result->contact_sub_type; $row['contact_id'] = $result->contact_id; $row['sort_name'] = $result->sort_name; if (array_key_exists('id', $row)) { @@ -895,7 +893,6 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se $links = self::links($this->_context, $this->_contextMenu, $this->_key); - foreach ($rows as $id => & $row) { if (!empty($this->_formValues['deleted_contacts']) && CRM_Core_Permission::check('access deleted contacts') ) { @@ -924,7 +921,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se } $row['action'] = CRM_Core_Action::formLink( $links, - null, + NULL, array('id' => $row['contact_id']), ts('more'), FALSE, @@ -1080,7 +1077,7 @@ SELECT DISTINCT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', cont * language * * @param array( - reference) $formValues submitted formValues + reference) $formValues submitted formValues * * @return array $qill which contains an array of strings */ diff --git a/CRM/Contact/Selector/Custom.php b/CRM/Contact/Selector/Custom.php index 4c591d6075..1bd4f4c1bc 100644 --- a/CRM/Contact/Selector/Custom.php +++ b/CRM/Contact/Selector/Custom.php @@ -123,14 +123,14 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector { */ function __construct( $customSearchClass, - $formValues = NULL, - $params = NULL, - $returnProperties = NULL, - $action = CRM_Core_Action::NONE, + $formValues = NULL, + $params = NULL, + $returnProperties = NULL, + $action = CRM_Core_Action::NONE, $includeContactIds = FALSE, $searchChildGroups = TRUE, - $searchContext = 'search', - $contextMenu = NULL + $searchContext = 'search', + $contextMenu = NULL ) { $this->_customSearchClass = $customSearchClass; $this->_formValues = $formValues; @@ -141,10 +141,10 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector { if (!$ext->isExtensionKey($customSearchClass)) { if ($ext->isExtensionClass($customSearchClass)) { $customSearchFile = $ext->classToPath($customSearchClass); - require_once ($customSearchFile); + require_once $customSearchFile; } else { - require_once (str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php'); + require_once str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php'; } $this->_search = new $customSearchClass( $formValues ); } @@ -360,8 +360,7 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector { } if ($image) { - $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($dao->contact_sub_type ? - $dao->contact_sub_type : $dao->contact_type, FALSE, $contactID + $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($dao->contact_sub_type ? $dao->contact_sub_type : $dao->contact_type, FALSE, $contactID ); } $rows[] = $row; @@ -378,7 +377,7 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector { * language * * @param array( - reference) $formValues submitted formValues + reference) $formValues submitted formValues * * @return array $qill which contains an array of strings */ -- 2.25.1