ACC SHELL

Path : /srv/www/vhosts/rozzo/wp-content/themes/amplius/
File Upload :
Current File : //srv/www/vhosts/rozzo/wp-content/themes/amplius/template-contact.php

<?php
/*
	Template Name: Contact
*/

	get_header();
	
// Sidebar Position
	$sidebar_position = get_option('contact_page_sidebar', 'right');
	
// Parallax Title
	$parallax_title = get_post_meta( $post->ID, 'coffee_parallax_title', true);
	
// Parallax Background
	$parallax_background = get_option('parallax_background', get_template_directory_uri().'/img/parallax-bg.jpg');
	$parallax_background_meta = get_post_meta( $post->ID, 'coffee_parallax_background', true);
	if($parallax_background_meta != ''){$parallax_background = $parallax_background_meta;}
	
// Parallax Height
	$parallax_height = get_option('parallax_height', '125');
	$parallax_height_meta = get_post_meta( $post->ID, 'coffee_parallax_height', true);
	if($parallax_height_meta != ''){$parallax_height = $parallax_height_meta;}
	
// Parallax Speed
	$parallax_speed = get_option('parallax_speed', '12');
	$parallax_speed_meta = get_post_meta( $post->ID, 'coffee_parallax_speed', true);
	if($parallax_speed_meta != ''){$parallax_speed = $parallax_speed_meta;}
	
// Google Map Data
	$header_type = get_post_meta( $post->ID, 'coffee_contact_header', true); 
	$coffee_google_map_latitude = get_post_meta( $post->ID, 'coffee_google_map_latitude', true); 
	$coffee_google_map_longitude = get_post_meta( $post->ID, 'coffee_google_map_longitude', true); 
	$coffee_google_map_allow_zoom = get_post_meta( $post->ID, 'coffee_google_map_allow_zoom', true); 
	$coffee_google_map_zoom = get_post_meta( $post->ID, 'coffee_google_map_zoom', true); 
	$coffee_google_map_marker = get_post_meta( $post->ID, 'coffee_google_map_marker', true);
	$coffee_google_map_marker_icon = get_post_meta( $post->ID, 'coffee_google_map_marker_icon', true);
	$coffee_google_map_marker_content = get_post_meta( $post->ID, 'coffee_google_map_marker_content', true);
	$coffee_google_map_marker_latitude = get_post_meta( $post->ID, 'coffee_google_map_marker_latitude', true); 
	$coffee_google_map_marker_longitude = get_post_meta( $post->ID, 'coffee_google_map_marker_longitude', true); 

// Contact E-mail
	$contact_email = get_post_meta( $post->ID, 'coffee_contact_email', true);
	
	$nameError=false;
	$emailError=false;
	$commentError=false;
	$def_name = __('Name', 'coffee');
	$def_email = __('Email', 'coffee');
	$name_pre = $def_name;
	$email_pre = $def_email;
	
	if(isset($_POST['submitted'])) {
			$name_pre = trim($_POST[ $def_name]);
			$email_pre = trim($_POST[ $def_email]);
			$message_pre = trim($_POST['comments']);
		if(trim($_POST[ $def_name]) === '' || trim($_POST[ $def_name]) === 'Name') {
			$nameError = true;
			$hasError = true;
		} else {
			$name = trim($_POST[ $def_name]);
		}
		if(trim($_POST[ $def_email]) === '') {
			$emailError = true;
			$hasError = true;
		} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST[ $def_email]))) {
			$emailError = true;
			$hasError = true;
		} else {
			$email = trim($_POST[ $def_email]);
		}
		if(trim($_POST['comments']) === '') {
			$commentError = true;
			$hasError = true;
		} else {
			if(function_exists('stripslashes')) {
				$comments = stripslashes(trim($_POST['comments']));
			} else {
				$comments = trim($_POST['comments']);
			}
		}
		if(!isset($hasError)) {
			$emailTo = $contact_email;
			$subject = '[Contact Form, '.get_bloginfo( 'name' ).'] From '.$name;
			$body = 'Name: '.$name. '\n\nEmail: '.$email.' \n\nComments: '.$comments;
			$headers = 'From: '.$name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
			wp_mail($emailTo, $subject, $body, $headers);
			$emailSent = true;
		}
	}
		
?>
<?php if ($parallax_height != 0) { ?>
<div id="parallax-wrapper" style="background-image: url('<?php echo($parallax_background); ?>'); height: <?php echo($parallax_height); ?>px;" data-parallax-speed="<?php echo($parallax_speed); ?>" <?php if(get_option('header_switch', 'true')){echo('class="parallax-on"');} ?>>
	<?php if($header_type == 'map'): ?>
		<div id="parallax-google-maps" class="clearfix" data-lng="<?php echo($coffee_google_map_longitude); ?>" data-lat="<?php echo($coffee_google_map_latitude); ?>" data-allow-zoom="<?php echo($coffee_google_map_allow_zoom); ?>" data-zoom="<?php echo($coffee_google_map_zoom); ?>"  data-marker="<?php echo($coffee_google_map_marker); ?>" data-marker-icon="<?php echo($coffee_google_map_marker_icon); ?>" data-marker-content="<?php echo($coffee_google_map_marker_content); ?>" data-marker-lng="<?php echo($coffee_google_map_marker_longitude); ?>" data-marker-lat="<?php echo($coffee_google_map_marker_latitude); ?>"></div>
	<?php else: ?>
		<div id="parallax-inner" class="clearfix">
			<div id="parallax-title-wrapper">
				<div id="parallax-title" class="heading-font">
					<?php echo($parallax_title); ?>
				</div>
			</div>
		</div><!-- #parallax-inner -->
	<?php endif; ?>
	
</div><!-- #parallax-wrapper -->
<?php } ?>

<div id="content-wrapper" style="margin-top:<?php echo(125+$parallax_height); ?>px">
	<div id="content" class="clearfix">
	
		<?php if($sidebar_position == 'left'): ?>
			<div id="sidebar-wrapper" class="content-column-wrapper clearfix">
				<div class="content-column clearfix">
					<?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Contact sidebar') ); ?>				
				</div>			
			</div>
		<?php endif; ?>
		
		<div id="contact-template" class="content-column-wrapper clearfix <?php echo($sidebar_position.'-sidebar') ?>">
			<div class="content-column clearfix">
				<?php while ( have_posts() ) : the_post(); ?>
					<article <?php post_class('clearfix'); ?>>
						<div class="entry-inner clearfix">							
							<div class="entry-content-wrapper clearfix <?php if(!$post->post_excerpt && !$post-> post_content) {echo('nocontent');} ?>">
								<div class="entry-content clearfix">
									<?php the_content(false); ?>
									
									<div id="contact-template-form" class="clearfix">
										<?php if(isset($emailSent) && $emailSent == true) { ?>
											<p class="thanks-message"><?php _e('Thanks, your email was sent successfully.', 'coffee') ?></p>
										<?php } ?>
										<?php if(isset($hasError)) { ?>
											<p id="error-message" class="error-message">
											<?php _e('An error occured', 'coffee') ?><?php if($nameError != '') { ?><?php _e(', empty name field', 'coffee'); ?><?php } ?><?php if($emailError != '') { ?><?php _e(', invalid e-mail', 'coffee'); ?><?php } ?><?php if($commentError == true) { ?><?php _e(', there is no message','coffee'); ?><?php } ?>.
											</p>
										<?php } ?>
										
										<form action="<?php the_permalink(); ?>#contact-template-form" id="contactForm" method="post" class="clearfix">
										
											<p class="form-element name clearfix">
												<input type="text" name="<?php echo($def_name); ?>" id="contactName" class="body-font required requiredField <?php if($name_pre == $def_name ) echo('fresh'); ?>" value="<?php if(isset($hasError) && $name_pre) { echo($name_pre); } else { echo($def_name); } ?>"/>
											</p>
											
											<p class="form-element email clearfix">
												<input type="text" name="<?php echo($def_email); ?>" id="email" class="body-font required requiredField email <?php if($email_pre == $def_email) echo('fresh'); ?>" value="<?php if(isset($hasError) && $email_pre) {echo($email_pre);} else { echo($def_email); } ?>"/>
											</p>
											
											<p class="form-element textarea clearfix">
												<textarea name="comments" id="commentsText" rows="10" cols="5" class="body-font required requiredField"><?php if(isset($_POST['comments'])) { echo stripslashes($_POST['comments']); } elseif(isset($hasError)) {echo($message_pre);}?></textarea>
											</p>
											
											<p class="form-submit">
												<input type="hidden" name="submitted" id="submitted" value="true" />
												<button class="button-message" type="submit"><i class="icon-envelope"></i><?php _e('Send message', 'coffee')?></button>
											</p>
											
										</form>
										
									</div>
								
								</div>
							</div>
						</div>
					</article>
				<?php endwhile; ?>
			</div>
		</div>	
		
		<?php if($sidebar_position == 'right'): ?>
			<div id="sidebar-wrapper" class="content-column-wrapper clearfix">
				<div class="content-column clearfix">
					<?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Contact sidebar') ); ?>				
				</div>			
			</div>
		<?php endif; ?>	
		
	</div><!-- #content -->
<?php get_footer(); ?>

ACC SHELL 2018