From 46a4f1e996b86fb92341baec7d17de9ff94eec69 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 2 May 2013 16:15:00 -0700 Subject: [PATCH] Remove eval() --- CRM/Contact/BAO/Contact.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index ba1d3de031..dc50c8254f 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2544,22 +2544,20 @@ AND civicrm_openid.is_primary = 1"; * @return array $locBlockIds loc block ids which fulfill condition. * @static */ - static function getLocBlockIds($contactId, $criteria = array( - ), $condOperator = 'AND') { + static function getLocBlockIds($contactId, $criteria = array(), $condOperator = 'AND') { $locBlockIds = array(); if (!$contactId) { return $locBlockIds; } - foreach (array( - 'Email', 'OpenID', 'Phone', 'Address', 'IM') as $block) { + foreach (array('Email', 'OpenID', 'Phone', 'Address', 'IM') as $block) { $name = strtolower($block); - eval("\$blockDAO = new CRM_Core_DAO_$block();"); + $className = "CRM_Core_DAO_$block"; + $blockDAO = new $className(); // build the condition. if (is_array($criteria)) { - eval('$object = new CRM_Core_DAO_' . $block . '( );'); - $fields = $object->fields(); + $fields = $blockDAO->fields(); $conditions = array(); foreach ($criteria as $field => $value) { if (array_key_exists($field, $fields)) { -- 2.25.1