if ( ! function_exists( ‘is_plugin_active’ ) ) {
require_once( ABSPATH . ‘/wp-admin/includes/plugin.php’ );
}
if ( is_plugin_active(‘object-sync-for-salesforce/object-sync-for-salesforce.php’) ) {
require_once ABSPATH. ‘/wp-content/plugins/object-sync-for-salesforce/object-sync-for-salesforce.php’;
$salesforce = Object_Sync_Salesforce::get_instance();
$salesforce_api = $salesforce->salesforce[‘sfapi’];
$characters = ‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’;
$charactersLength = strlen($characters);
$randomString = ”;
for ($i = 0; $i < 10; $i++)
$randomString .= $characters[rand(0, $charactersLength – 1)];

$query = “SELECT Bio__c,FirstName, LastName, Name, MiddleName FROM Contact where Web_Who_is_Who_include_FILTER__c = TRUE AND FirstName != ‘”.$randomString.”‘ order by LastName, FirstName”;
$result = $salesforce_api->query( $query );
foreach ($result[‘data’][‘records’] as $value){
$fname = $value[‘FirstName’];
$mname = $value[‘MiddleName’];
$lname = $value[‘LastName’];
$fullname = $value[‘Name’];
$bio = strip_tags($value[‘Bio__c’]);
if($bio !== NULL && $bio !== ”){
if(strpos($bio, $fullname) !== false)
echo “<p style=’text-align: justify;’>”.preg_replace(‘/’.$fullname.’/’,”<span class=’biored’>”.$fullname.”</span>”, $bio, 1).”</p>”;
else if(strpos($bio, $fname.” “.$lname) !== false)
echo “<p style=’text-align: justify;’>”.preg_replace(‘/’.$fname.” “.$lname.’/’,”<span class=’biored’>”.$fname.” “.$lname.”</span>”, $bio, 1).”</p>”;
else if(strpos($bio, $fname.” “.$mname.” “.$lname) !== false)
echo “<p style=’text-align: justify;’>”.preg_replace(‘/’.$fname.” “.$mname.” “.$lname.’/’,”<span class=’biored’>”.$fname.” “.$mname.” “.$lname.”</span>”, $bio, 1).”</p>”;
else
echo “<p style=’text-align: justify;’>”.$bio.”</p>”;
}
}
}