Guest User

Untitled

a guest
Dec 27th, 2018
22
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. /**
  4. Template Name: Contact Us
  5. */
  6. get_header(); ?>
  7. <?php $elitepress_lite_options=theme_data_setup();
  8. $current_options = wp_parse_args( get_option( 'elitepress_lite_options', array() ), $elitepress_lite_options );
  9. $mapsrc= $current_options['contact_google_map_url'];
  10. $mapsrc=$mapsrc.'&amp;output=embed'; ?>
  11.  
  12. <!-- Page Title Section -->
  13. <?php get_template_part('index','banner'); ?>
  14. <!-- /Page Title Section -->
  15. <!-- Contact Info Section -->
  16. <section class="contact-section">
  17. <div class="container">
  18. <div class="row">
  19. <!--Contact Form-->
  20. <?php if( is_active_sidebar('contact_widget_area') ) { ?>
  21. <div class="col-md-8">
  22. <?php } else { ?> <div class="col-md-12"> <?php } ?>
  23. <div id="mailsentbox" style="display:none">
  24. <div class="alert alert-success" >
  25. <strong><?php _e('Thank you','elitepress');?></strong> <?php _e('Your information has been sent.','elitepress');?>
  26. </div>
  27. </div>
  28. <div class="comment-form-section" id="myformdata">
  29. <form class="form-inline wpcf7-form" role="form" method="post" action="#">
  30. <?php if($current_options['send_usmessage']) { ?>
  31. <div class="comment-title"><h3><?php echo esc_html($current_options['send_usmessage']); ?></h3></div>
  32. <?php } ?>
  33. <?php wp_nonce_field('elitepress_name_nonce_check','elitepress_name_nonce_field'); ?>
  34. <div class="contact-form-group">
  35. <input type="name" id="user_name" name="user_name" placeholder="<?php _e('Name','elitepress'); ?>">
  36. <span style="display:none; color:red" id="contact_user_name_error"><?php _e('Name','elitepress'); ?> </span>
  37. </div>
  38. <div class="contact-form-group">
  39. <input type="email" id="user_email" name="user_email" placeholder="<?php _e('Email','elitepress'); ?>">
  40. <span style="display:none; color:red" id="contact_user_email_error"><?php _e('Email','elitepress'); ?> </span>
  41. </div>
  42. <div class="contact-form-group-textarea">
  43. <textarea rows="5" id="user_massage" name="user_massage" placeholder="<?php _e('Message','elitepress'); ?>"></textarea>
  44. <span style="display:none; color:red" id="contact_user_massage_error"><?php _e('Message','elitepress'); ?> </span>
  45. </div>
  46. <div>
  47. <?php echo apply_filters( 'gglcptch_display_recaptcha', '' ); ?>
  48. <button class="contact-btn" id="contact_submit" name="contact_submit" type="submit"><?php _e('Send Message','elitepress'); ?></button>
  49. <span style="display:none; color:red" id="contact_nonce_error"><?php _e('Sorry, your nonce did not verify','elitepress');?></span></div>
  50. </form>
  51.  
  52. </div>
  53. </div>
  54. <!--Conatct Form-->
  55.  
  56. <?php
  57. if(isset($_POST['contact_submit']))
  58. {
  59.  
  60. $check_result = apply_filters( 'gglcptch_verify_recaptcha', true, 'string' );
  61. if ( true === $check_result ) {
  62.  
  63. } else {
  64. echo $check_result;
  65. exit;
  66. }
  67.  
  68. $flag=1;
  69. if(empty($_POST['user_name']))
  70. {
  71. $flag=0;
  72. echo "<script>jQuery('#contact_user_name_error').show();</script>";
  73. } else
  74. if($_POST['user_email']=='')
  75. {
  76. $flag=0;
  77. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  78. } else
  79. if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$_POST['user_email']))
  80. {
  81. $flag=0;
  82. echo "<script>jQuery('#contact_user_email_error').show();</script>";
  83. } else
  84. if($_POST['user_massage']=='')
  85. {
  86. $flag=0;
  87. echo "<script>jQuery('#contact_user_massage_error').show();</script>";
  88. }else
  89. if(empty($_POST) || !wp_verify_nonce($_POST['elitepress_name_nonce_field'],'elitepress_name_nonce_check') )
  90. {
  91. echo "<script>jQuery('#contact_nonce_error').show();</script>";
  92. exit;
  93. }
  94. else
  95. { if($flag==1)
  96. {
  97.  
  98. $to = get_option('admin_email');
  99. $subject = trim($_POST['user_name']) . get_option("blogname");
  100. $massage = stripslashes(trim($_POST['user_massage']))."Message sent from:: ".trim($_POST['user_email']);
  101. $headers = "From: ".trim($_POST['user_name'])." <".trim($_POST['user_email']).">\r\nReply-To:".trim($_POST['user_email']);
  102. $maildata =wp_mail($to, $subject, $massage, $headers);
  103. if($maildata){
  104. echo "<script>jQuery('#myformdata').hide();</script>";
  105. echo "<script>jQuery('#mailsentbox').show();</script>";
  106. }
  107. }
  108. }
  109. }
  110. ?>
  111. <!--/Conatct Form-->
  112.  
  113. <!--Contact Detail-->
  114. <?php
  115. if( is_active_sidebar('contact_widget_area') ) {
  116. dynamic_sidebar( 'contact_widget_area' );
  117. }
  118.  
  119. else
  120. {
  121. $elitepress_lite_options=theme_data_setup();
  122. $current_options = wp_parse_args( get_option( 'elitepress_lite_options', array() ), $elitepress_lite_options );
  123. if(!empty($current_options)) {
  124. echo $current_options['contact_text'];
  125. }
  126. }
  127. ?>
  128. <!--/Conatct Detail-->
  129. </div>
  130. </div>
  131. </section>
  132. <!-- Footer Section -->
  133.  
  134. <!--Google Map-->
  135. <?php $elitepress_lite_options=theme_data_setup();
  136. $current_options = wp_parse_args( get_option( 'elitepress_lite_options', array() ), $elitepress_lite_options );
  137. if($current_options['contact_google_map_enabled'] == true && $current_options['contact_google_map_url'] != null ){ ?>
  138. <!--Google Map Section-->
  139. <section class="googlemap-section">
  140. <div id="google-map">
  141. <?php echo $current_options['contact_google_map_url']; ?>
  142. </div>
  143. </div>
  144. </section>
  145. <!--Google Map Section-->
  146. <?php } get_footer(); ?>
  147. <!-- /Footer Section -->
RAW Paste Data