<?php 
function pf_contactform_func( $atts ) {
	extract( shortcode_atts( array(
		'contact_subject' => '',
		'contact_phone' => '',
		'contact_mes' => '',
		'contact_re' => '',
		'form_type' => 1
	), $atts ) );

	/* Define Fields */
	$name = $email = $subject = $phone = $message = '';
	$pfrecheck = PFRECIssetControl('setupreCaptcha_general_status','','0');

	/* Name Field */
	$name .= "\n\t\t\t\t\t\t\t\t".'<label class="lbl-ui">';
    $name .= "\n\t\t\t\t\t\t\t\t\t".'<input type="text" name="name" class="input" placeholder="'.esc_html__('Name','pointfindert2d').'"/>';
    $name .= "\n\t\t\t\t\t\t\t\t".'</label>';


    /* Email Field */
    $email .= "\n\t\t\t\t\t\t\t\t".'<label class="lbl-ui">';
    $email .= "\n\t\t\t\t\t\t\t\t\t".'<input type="email" name="email" class="input" placeholder="'.esc_html__('Email','pointfindert2d').'"/>';
    $email .= "\n\t\t\t\t\t\t\t\t".'</label>';


    /* Subject Field */
    $subject .= "\n\t\t\t\t\t\t\t\t".'<label class="lbl-ui">';
    $subject .= "\n\t\t\t\t\t\t\t\t\t".'<input type="text" name="subject" class="input" placeholder="'.esc_html__('Subject','pointfindert2d').'"/>';
    $subject .= "\n\t\t\t\t\t\t\t\t".'</label>'; 


    /* Phone Field */
    $phone .= "\n\t\t\t\t\t\t\t\t".'<label class="lbl-ui">';
    $phone .= "\n\t\t\t\t\t\t\t\t\t".'<input type="text" name="phone" class="input" placeholder="'.esc_html__('Phone','pointfindert2d').'"/>';
    $phone .= "\n\t\t\t\t\t\t\t\t".'</label>'; 


    /* Message Field */
    $message .= "\n\t\t\t\t\t\t".'<label class="lbl-ui">';
    $message .= "\n\t\t\t\t\t\t\t".'<textarea name="msg" class="textarea" placeholder="'.esc_html__('Message','pointfindert2d').'"></textarea>';
    $message .= "\n\t\t\t\t\t\t".'</label>  ';  


	$output = "\n\t".'<div class="golden-forms">';
	$output .= '<div id="pfmdcontainer-overlay" class="pftrwcontainer-overlay"></div>';
    $output .= "\n\t\t\t".'<form id="pf-contact-form">';

    $output .= '<div class="pfsearchformerrors">';
    $output .= '<ul></ul>';
    $output .= '<a class="button pfsearch-err-button">'.esc_html__('CLOSE','pointfindert2d').'</a>';
    $output .= '</div>';

    if($form_type == 1 && $contact_phone == 'yes'){
	    $output .= "\n\t\t\t\t\t".'<section>';
	    $output .= "\n\t\t\t\t\t\t".'<div class="row">';

	    $output .= "\n\t\t\t\t\t\t\t".'<div class="col4 first">';
	 	$output .= $name;
	    $output .= "\n\t\t\t\t\t\t\t".'</div>';

	    $output .= "\n\t\t\t\t\t\t\t".'<div class="col4">';
	 	$output .= $email;
	    $output .= "\n\t\t\t\t\t\t\t".'</div>';

	    $output .= "\n\t\t\t\t\t\t\t".'<div class="col4 last colspacer-two">';
	  	$output .= $phone;
	    $output .= "\n\t\t\t\t\t\t\t".'</div>';

	    $output .= "\n\t\t\t\t\t\t".'</div>';/*end row*/ 
	    $output .= "\n\t\t\t\t\t".'</section>  ';

	}elseif ($form_type == 2 || ($form_type == 1 && $contact_phone != 'yes')) {

		$output .= "\n\t\t\t\t\t".'<section>';
	    $output .= "\n\t\t\t\t\t\t".'<div class="row">';

	    $output .= "\n\t\t\t\t\t\t\t".'<div class="col6 first">';
	 	$output .= $name;
	    $output .= "\n\t\t\t\t\t\t\t".'</div>';

	    $output .= "\n\t\t\t\t\t\t\t".'<div class="col6 last colspacer-two">';
	  	$output .= $email;
	    $output .= "\n\t\t\t\t\t\t\t".'</div>';

	    $output .= "\n\t\t\t\t\t\t".'</div>';/*end row*/ 
	    $output .= "\n\t\t\t\t\t".'</section>  ';
	}

	if(($form_type == 1 || $form_type == 2) && $contact_phone != 'yes' && $contact_subject == 'yes'){
	    $output .= "\n\t\t\t\t\t".'<section>  '; 
	    $output .= $subject;
	    $output .= "\n\t\t\t\t\t".'</section>  ';       
	}elseif ($form_type == 2 && $contact_phone == 'yes' && $contact_subject == 'yes') {
		$output .= "\n\t\t\t\t\t".'<section>';
	    $output .= "\n\t\t\t\t\t\t".'<div class="row">';

	    $output .= "\n\t\t\t\t\t\t\t".'<div class="col6 first">';
	 	$output .= $subject;
	    $output .= "\n\t\t\t\t\t\t\t".'</div>';

	    $output .= "\n\t\t\t\t\t\t\t".'<div class="col6 last colspacer-two">';
	  	$output .= $phone;
	    $output .= "\n\t\t\t\t\t\t\t".'</div>';

	    $output .= "\n\t\t\t\t\t\t".'</div>';/*end row*/ 
	    $output .= "\n\t\t\t\t\t".'</section>  ';
	}elseif ($form_type == 1 && $contact_subject == 'yes') {
		$output .= "\n\t\t\t\t\t".'<section>';
	 	$output .= $subject;
	 	$output .= "\n\t\t\t\t\t".'</section>  ';

	}elseif(($form_type == 2) && $contact_phone == 'yes' && $contact_subject != 'yes'){
		$output .= "\n\t\t\t\t\t".'<section>  '; 
	    $output .= $phone;
	    $output .= "\n\t\t\t\t\t".'</section>  ';       
	}
  
	if($contact_mes == 'yes'){
	    $output .= "\n\t\t\t\t\t".'<section>';
	    $output .= $message;                 
	    $output .= "\n\t\t\t\t\t".'</section>';
	}

	if ($contact_re == 'yes' && $pfrecheck == 1) {
		
		if ($pfrecheck == 1) {
		$output .= '<section><div id="recaptcha_div_cform">'.PFreCaptchaWidget().'</div></section>';
		}
	}


    $output .= "\n\t\t\t\t\t".'<section> ';
    $output .= "\n\t\t\t\t\t\t".'<input type="hidden" value="'.$contact_re.'" name="contact_re" />';
    $output .= "\n\t\t\t\t\t\t".'<input id="pf-contact-form-submit" type="submit" value="'.esc_html__('Send','pointfindert2d').'" class="button green" />';
    $output .= "\n\t\t\t\t\t".'</section>              ';  


    $output .= "\n\t\t\t".'</form>';
    $output .= "\n\t".'</div>';

	return $output;
}
add_shortcode( 'pf_contactform', 'pf_contactform_func' ); 

?>