Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Template name: Template Contact 3
- *
- */
- if (isset($_POST['contact'])) {
- require('/home/horizon/domains/horizonhomes-samui.com/dev/public/wp-includes/recaptcha-master/src/autoload.php');
- $recaptcha = new \ReCaptcha\ReCaptcha('XXX');
- $resp = $recaptcha->verify($_POST['g-recaptcha-response']);
- if ($resp->isSuccess()) {
- $form_data = array(
- 'name' => $_POST['contact[name]']
- 'email' => $_POST['contact']['email'],
- 'message' => $_POST['contact']['message'],
- 'page' => $_POST['contact']['_wp_http_referer']
- );
- $title = "Contact Form Entry - " . $_POST['contact']['name'];
- $data = (object) array(
- 'title' => $title,
- 'posted_data' => $form_data,
- 'uploaded_files' => array()
- );
- // Call hook to submit data
- do_action( 'cfdb_submit', $data );
- $error = ale_send_contact($_POST['contact']);
- } else {
- $errors = $resp->getErrorCodes();
- $error['msg'] = 'Please complete the Google reCaptcha';
- /*
- echo '<pre>';
- print_r($errors);
- echo '</pre>';
- exit;
- */
- }
- }
- get_header(); ?>
- <?php get_breadcrumbs(); ?>
- <div class="contact3">
- <div class="wrapper">
- <div class="archive-title">
- <h1><?php wp_title("", true); ?></h1>
- </div>
- <?php if(ale_get_meta('displaycontact2information')!="off"): ?>
- <div class="info clearfix">
- <div class="text">
- <a name="success"></a>
- <h2><?php echo esc_attr(ale_get_meta('contact3informationtitle')); ?></h2>
- <?php if (have_posts()) : while (have_posts()) : the_post();
- the_content();
- endwhile; endif; wp_reset_query();?>
- </div>
- <?php if(ale_get_meta('displaycontact2message')!="off"): ?>
- <div class="flcol-7 contact-form">
- <?php if (isset($_GET['success'])) : ?>
- <p class="success"><?php _e('Thank you for your message!', 'aletheme')?></p>
- <?php
- print_r($_POST);
- $form_data = array(
- // 'name' => $_POST['name'],
- // 'name' => $_POST['contact[name]']
- // 'name' => $_POST['contact']['name']
- 'name' => $_POST['contact-form-name']
- // 'email' => $_POST['email'],
- // 'phone' => $_POST['phone'],
- // 'message' => $_POST['message'],
- // 'subject' => $_POST['subject'],
- // 'agent' => $_POST['agent'],
- // 'page' => $_POST['_wp_http_referer']
- );
- // $title = "Inquiry Form - " . $form_data['email'];
- $title = "Inquiry Form - Contact page";
- // Prepare data structure for call to hook
- $data = (object) array(
- 'title' => $title,
- 'posted_data' => $form_data,
- 'uploaded_files' => array()
- );
- // Call hook to submit data
- do_action( 'cfdb_submit', $data );
- ?>
- <?php endif; ?>
- <?php if (isset($error) && isset($error['msg'])) : ?>
- <p class="error"><?php echo $error['msg']?></p>
- <?php endif; ?>
- <form method="post" action="<?php the_permalink();?>" class="clearfix">
- <div class="left-fields">
- <input name="contact[email]" type="email" placeholder="<?php _e( 'Email', 'Contact Form' ); ?>" value="<?php echo isset($_POST['contact']['email']) ? $_POST['contact']['email'] : ''?>" required="required" id="contact-form-email" />
- <input name="contact[name]" type="text" placeholder="<?php _e( 'Name', 'Contact Form' ); ?>" value="<?php echo isset($_POST['contact']['name']) ? $_POST['contact']['name'] : '' ?>" required="required" id="contact-form-name" />
- </div>
- <div class="right-fields">
- <textarea name="contact[message]" placeholder="<?php _e( 'Message...', 'Contact Form' ); ?>" id="contact-form-message" required="required"><?php echo isset($_POST['contact']['message']) ? $_POST['contact']['message'] : ''?></textarea>
- </div>
- <!-- The following code inserts Google's recaptcha at the bottom of the form. -->
- <div class="g-recaptcha" data-sitekey="XXX"></div>
- <input type="submit" class="submit" value="<?php _e('Send Message', 'aletheme')?>"/>
- <?php wp_nonce_field() ?>
- </form>
- </div>
- <?php endif; ?>
- <div class="flcol-5 address-info">
- <p class="phone"><?php echo esc_attr(ale_get_meta('contact3informationphone')); ?></p>
- <p class="email"><?php echo esc_attr(ale_get_meta('contact3informationemail')); ?></p>
- <p class="address"><?php echo '<span>'.esc_attr(ale_get_meta('contact3informationcountry')).'</span>'. esc_attr(ale_get_meta('contact3informationaddress')); ?></p>
- </div>
- </div>
- <?php endif; ?>
- <!-- This div adds a Google Map to the Contact page. The built-in map from the theme ceased to work sometime before 21/7/17. -->
- <div class="google-maps">
- <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d52937.1903435715!2d100.07957173711878!3d9.54515095934661!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3054f001edd7ef2b%3A0xd3162a8d70e097e4!2sKoh+Samui+Real+Estate+-+Horizon+Homes!5e0!3m2!1sen!2s!4v1500632330853" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
- </div>
- <br>
- </div>
- <!-- <div class="map"> -->
- <!-- <?php //$adre = ale_get_meta('contact3informationaddress'); echo do_shortcode('[ale_map address="'.esc_attr($adre).'" width="100%" height="544px"]'); ?> -->
- <!-- </div> -->
- </div>
- <?php get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement