Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3.   * Template name: Template Contact 3
  4.   *
  5.   */
  6.  
  7.  
  8. if (isset($_POST['contact'])) {
  9.  
  10.     require('/home/horizon/domains/horizonhomes-samui.com/dev/public/wp-includes/recaptcha-master/src/autoload.php');
  11.  
  12.     $recaptcha = new \ReCaptcha\ReCaptcha('XXX');
  13.  
  14.     $resp = $recaptcha->verify($_POST['g-recaptcha-response']);
  15.  
  16.     if ($resp->isSuccess()) {
  17.         $form_data = array(
  18.             'name'      => $_POST['contact[name]']
  19.             'email'     => $_POST['contact']['email'],
  20.             'message'   => $_POST['contact']['message'],
  21.             'page'      => $_POST['contact']['_wp_http_referer']
  22.         );
  23.         $title = "Contact Form Entry - " . $_POST['contact']['name'];
  24.         $data = (object) array(
  25.             'title'          => $title,
  26.             'posted_data'    => $form_data,
  27.             'uploaded_files' => array()
  28.         );
  29.         // Call hook to submit data
  30.         do_action( 'cfdb_submit', $data );
  31.         $error = ale_send_contact($_POST['contact']);
  32.     } else {
  33.         $errors = $resp->getErrorCodes();
  34.         $error['msg'] = 'Please complete the Google reCaptcha';
  35.         /*
  36.         echo '<pre>';
  37.         print_r($errors);
  38.         echo '</pre>';
  39.         exit;
  40.         */
  41.     }
  42.  
  43. }
  44.  
  45. get_header(); ?>
  46.     <?php get_breadcrumbs(); ?>
  47.     <div class="contact3">
  48.         <div class="wrapper">
  49.             <div class="archive-title">
  50.                 <h1><?php wp_title("", true); ?></h1>
  51.             </div>
  52.             <?php if(ale_get_meta('displaycontact2information')!="off"): ?>
  53.                 <div class="info clearfix">
  54.                     <div class="text">
  55.                         <a name="success"></a>
  56.                         <h2><?php echo esc_attr(ale_get_meta('contact3informationtitle')); ?></h2>
  57.                         <?php  if (have_posts()) : while (have_posts()) : the_post();
  58.                         the_content();
  59.                         endwhile; endif; wp_reset_query();?>
  60.                     </div>
  61.  
  62.                     <?php if(ale_get_meta('displaycontact2message')!="off"): ?>
  63.                         <div class="flcol-7 contact-form">
  64.                             <?php if (isset($_GET['success'])) : ?>
  65.                                 <p class="success"><?php _e('Thank you for your message!', 'aletheme')?></p>
  66. <?php
  67.                                 print_r($_POST);
  68.  
  69.                                 $form_data = array(
  70.                                     // 'name'      => $_POST['name'],
  71.                                     // 'name'      => $_POST['contact[name]']
  72.                                     // 'name'      => $_POST['contact']['name']
  73.                                     'name'      => $_POST['contact-form-name']
  74.                                    
  75.                                     // 'email'     => $_POST['email'],
  76.                                     // 'phone'     => $_POST['phone'],
  77.                                     // 'message'   => $_POST['message'],
  78.                                     // 'subject'   => $_POST['subject'],
  79.                                     // 'agent'     => $_POST['agent'],
  80.                                     // 'page'      => $_POST['_wp_http_referer']
  81.                                 );
  82.                                 // $title = "Inquiry Form - " . $form_data['email'];
  83.                                 $title = "Inquiry Form - Contact page";
  84.                                 // Prepare data structure for call to hook
  85.                                 $data = (object) array(
  86.                                     'title'          => $title,
  87.                                     'posted_data'    => $form_data,
  88.                                     'uploaded_files' => array()
  89.                                 );
  90.                                 // Call hook to submit data
  91.                                 do_action( 'cfdb_submit', $data );
  92. ?>
  93.                             <?php endif; ?>
  94.                             <?php if (isset($error) && isset($error['msg'])) : ?>
  95.                                 <p class="error"><?php echo $error['msg']?></p>
  96.                             <?php endif; ?>
  97.  
  98.  
  99.                             <form method="post" action="<?php the_permalink();?>" class="clearfix">
  100.  
  101.                                 <div class="left-fields">
  102.                                     <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" />
  103.                                     <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" />
  104.                                 </div>
  105.                                     <div class="right-fields">
  106.                                     <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>
  107.                                 </div>
  108.  
  109.                                 <!-- The following code inserts Google's recaptcha at the bottom of the form. -->
  110.                                 <div class="g-recaptcha" data-sitekey="XXX"></div>
  111.  
  112.                                 <input type="submit" class="submit" value="<?php _e('Send Message', 'aletheme')?>"/>
  113.  
  114.                                 <?php wp_nonce_field() ?>
  115.  
  116.                             </form>
  117.                         </div>
  118.                     <?php endif; ?>
  119.                     <div class="flcol-5 address-info">
  120.                         <p class="phone"><?php echo esc_attr(ale_get_meta('contact3informationphone')); ?></p>
  121.                         <p class="email"><?php echo esc_attr(ale_get_meta('contact3informationemail')); ?></p>
  122.                         <p class="address"><?php echo '<span>'.esc_attr(ale_get_meta('contact3informationcountry')).'</span>'. esc_attr(ale_get_meta('contact3informationaddress')); ?></p>
  123.                     </div>
  124.                 </div>
  125.             <?php endif; ?>
  126.             <!-- 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. -->
  127.             <div class="google-maps">
  128.                 <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>
  129.             </div>
  130.             <br>
  131.         </div>
  132.         <!-- <div class="map"> -->
  133.             <!-- <?php //$adre = ale_get_meta('contact3informationaddress'); echo do_shortcode('[ale_map address="'.esc_attr($adre).'" width="100%" height="544px"]'); ?> -->
  134.         <!-- </div> -->
  135.     </div>
  136. <?php get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement