Exemple #1
0
 public function sendMessage($name, $email, $phone, $person_message = null)
 {
     $property_id = (int) $_POST['property_id'];
     $property = new Property($property_id);
     $property->fetch();
     $message_format = estetico_get_setting('agent_message_format');
     $message = str_replace('%person_name%', $name, $message_format);
     $message = str_replace('%person_email%', $email, $message);
     $message = str_replace('%person_phone%', $phone, $message);
     $message = str_replace('%person_message%', $person_message, $message);
     $message = str_replace('%agent_name%', $this->getName(), $message);
     $message = str_replace('%property_name%', $property->getTitle(), $message);
     $message = str_replace('%property_link%', '<a href="' . $property->getLink() . '">' . $property->getLink() . '</a>', $message);
     $message = nl2br($message);
     $headers = "Content-Type:text/html;charset=utf-8\r\n";
     $headers .= "From: " . $name . ' <' . $email . '>' . "\r\n";
     $success = false;
     $recipient = $this->getEmail();
     if (mail($recipient, __('Contact message about a property', THEME_NAME), $message, $headers)) {
         $success = true;
     }
     return $success;
 }
			<?php 
        } else {
            ?>
				<div class="message error box"><?php 
            echo __('There was an error while trying to connect with our agent. Please try again later.', THEME_NAME);
            ?>
</div>
			<?php 
        }
        ?>
		<?php 
    }
    ?>

		<h2 class="page-title"><?php 
    echo $property->getTitle();
    ?>
</h2>
		<?php 
} else {
    ?>
		<h1 class="entry-title">
			<a href="<?php 
    the_permalink();
    ?>
" rel="bookmark"><?php 
    echo $property->getTitle();
    ?>
</a>
		</h1>
		<?php