From 150f50c17677e235b1e7087d5feba73627d46069 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 27 Mar 2013 14:42:30 -0700 Subject: [PATCH] Cleanup --- CRM/Contact/Form/Contact.php | 17 +++++++++-------- CRM/Contact/Form/Edit/TagsAndGroups.php | 20 ++++++++++---------- CRM/Core/Resources.php | 2 +- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index 50a5b2415b..d9d09ee027 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -435,9 +435,9 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { // set defaults for blocks ( custom data, address, communication preference, notes, tags and groups ) foreach ($this->_editOptions as $name => $label) { - if (!in_array($name, array( - 'Address', 'Notes'))) { - eval('CRM_Contact_Form_Edit_' . $name . '::setDefaultValues( $this, $defaults );'); + if (!in_array($name, array('Address', 'Notes'))) { + $className = 'CRM_Contact_Form_Edit_' . $name; + $className::setDefaultValues($this, $defaults); } } @@ -744,8 +744,8 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { public function buildQuickForm() { //load form for child blocks if ($this->_addBlockName) { - $class = 'CRM_Contact_Form_Edit_' . $this->_addBlockName; - return $class::buildQuickForm($this); + $className = 'CRM_Contact_Form_Edit_' . $this->_addBlockName; + return $className::buildQuickForm($this); } if ($this->_action == CRM_Core_Action::UPDATE) { @@ -770,7 +770,8 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { } //build contact type specific fields - eval('CRM_Contact_Form_Edit_' . $this->_contactType . '::buildQuickForm( $this );'); + $className = 'CRM_Contact_Form_Edit_' . $this->_contactType; + $className::buildQuickForm($this); // build Custom data if Custom data present in edit option $buildCustomData = 'noCustomDataPresent'; @@ -798,8 +799,8 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $this->_blocks['Address'] = $this->_editOptions['Address']; continue; } - - eval('CRM_Contact_Form_Edit_' . $name . '::buildQuickForm( $this );'); + $className = 'CRM_Contact_Form_Edit_' . $name; + $className::buildQuickForm($this); } // build location blocks. diff --git a/CRM/Contact/Form/Edit/TagsAndGroups.php b/CRM/Contact/Form/Edit/TagsAndGroups.php index 26767cccf2..a7bb9d466c 100644 --- a/CRM/Contact/Form/Edit/TagsAndGroups.php +++ b/CRM/Contact/Form/Edit/TagsAndGroups.php @@ -32,7 +32,7 @@ * $Id$ * */ -class CRM_Contact_Form_Edit_TagsandGroups { +class CRM_Contact_Form_Edit_TagsAndGroups { /** * constant to determine which forms we are generating @@ -57,13 +57,13 @@ class CRM_Contact_Form_Edit_TagsandGroups { * @access public */ static function buildQuickForm(&$form, - $contactId = 0, - $type = CRM_Contact_Form_Edit_TagsandGroups::ALL, + $contactId = 0, + $type = self::ALL, $visibility = FALSE, $isRequired = NULL, - $groupName = 'Group(s)', - $tagName = 'Tag(s)', - $fieldName = NULL + $groupName = 'Group(s)', + $tagName = 'Tag(s)', + $fieldName = NULL ) { if (!isset($form->_tagGroup)) { $form->_tagGroup = array(); @@ -74,8 +74,8 @@ class CRM_Contact_Form_Edit_TagsandGroups { $contactId = $form->_contactId; } - $type = (int ) $type; - if ($type & CRM_Contact_Form_Edit_TagsandGroups::GROUP) { + $type = (int) $type; + if ($type & self::GROUP) { $fName = 'group'; if ($fieldName) { @@ -122,7 +122,7 @@ class CRM_Contact_Form_Edit_TagsandGroups { } } - if ($type & CRM_Contact_Form_Edit_TagsandGroups::TAG) { + if ($type & self::TAG) { $fName = 'tag'; if ($fieldName) { $fName = $fieldName; @@ -163,7 +163,7 @@ class CRM_Contact_Form_Edit_TagsandGroups { * @access public * @static */ - static function setDefaults($id, &$defaults, $type = CRM_Contact_Form_Edit_TagsandGroups::ALL, $fieldName = NULL) { + static function setDefaults($id, &$defaults, $type = self::ALL, $fieldName = NULL) { $type = (int ) $type; if ($type & self::GROUP) { $fName = 'group'; diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index 629f0c3df0..e527546644 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -131,7 +131,7 @@ class CRM_Core_Resources { if ($cacheCodeKey !== NULL) { $this->cacheCode = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, $cacheCodeKey); } - if (! $this->cacheCode) { + if (!$this->cacheCode) { $this->resetCacheCode(); } } -- 2.25.1