$value ) { if ( isset($form_controls[$key]) ) continue; if ( $key == 'officeID' && isset($form_controls['office']) ) continue; if ( $key == 'paged' ) continue; // we've received a field that isn't a standard form control so let's store it in a hidden field so it's not lost if ( is_array($value) ) { foreach ( $value as $i => $val ) { $form_controls[$key . '-' . $i] = array('type' => 'hidden', 'name' => $key . '[]', 'value' => stripslashes( ph_clean( $val) )); } } else { $form_controls[$key] = array('type' => 'hidden', 'value' => stripslashes( ph_clean( $value) )); } } ph_get_template( 'global/search-form.php', array( 'form_controls' => $form_controls, 'id' => $id ) ); } /** * Get default fields to be shown on search forms * * @return array */ function ph_get_search_form_fields() { $fields = array(); $departments = ph_get_departments(); $department_options = array(); $default_value = ''; foreach ( $departments as $key => $value ) { if ( get_option( 'propertyhive_active_departments_' . str_replace("residential-", "", $key) ) == 'yes' ) { $department_options[$key] = $value; if ($default_value == '' && get_option( 'propertyhive_primary_department' ) == $key ) { $default_value = $key; } } } $fields['department'] = array( 'type' => 'radio', 'options' => $department_options, 'value' => $default_value ); if ( array_key_exists('residential-sales', $departments) || array_key_exists('residential-lettings', $departments) ) { if ( array_key_exists('residential-sales', $departments) ) { $prices = array( '' => __( 'No preference', 'propertyhive' ), '100000' => '£100,000', '150000' => '£150,000', '200000' => '£200,000', '250000' => '£250,000', '300000' => '£300,000', '500000' => '£500,000', '750000' => '£750,000', '1000000' => '£1,000,000' ); $fields['minimum_price'] = array( 'type' => 'select', 'show_label' => true, 'label' => __( 'Min Price', 'propertyhive' ), 'before' => '
', 'options' => $prices ); $fields['maximum_price'] = array( 'type' => 'select', 'show_label' => true, 'label' => __( 'Max Price', 'propertyhive' ), 'before' => '
', 'options' => $prices ); } if ( array_key_exists('residential-lettings', $departments) ) { $prices = array( '' => __( 'No preference', 'propertyhive' ), '500' => '£500 PCM', '600' => '£600 PCM', '750' => '£750 PCM', '1000' => '£1000 PCM', '1250' => '£1250 PCM', '1500' => '£1500 PCM', '2000' => '£2000 PCM' ); $fields['minimum_rent'] = array( 'type' => 'select', 'show_label' => true, 'label' => __( 'Min Rent', 'propertyhive' ), 'before' => '
', 'options' => $prices ); $fields['maximum_rent'] = array( 'type' => 'select', 'show_label' => true, 'label' => __( 'Max Rent', 'propertyhive' ), 'before' => '
', 'options' => $prices ); } $fields['minimum_bedrooms'] = array( 'type' => 'select', 'show_label' => true, 'label' => __( 'Min Beds', 'propertyhive' ), 'before' => '
', 'options' => array( '' => __( 'No preference', 'propertyhive' ), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5) ); $fields['property_type'] = array( 'type' => 'property_type', 'show_label' => true, 'before' => '
', 'label' => __( 'Type', 'propertyhive' ), ); } if ( array_key_exists('commercial', $departments) ) { $sizes = array( '' => __( 'No preference', 'propertyhive' ), '250' => '250 sq ft', '500' => '500 sq ft', '1000' => '1,000 sq ft', '2500' => '2,500 sq ft', '5000' => '5,000 sq ft', '10000' => '10,000 sq ft', '25000' => '25,000 sq ft', '50000' => '50,000 sq ft' ); $fields['minimum_floor_area'] = array( 'type' => 'select', 'show_label' => true, 'label' => __( 'Min Floor Area', 'propertyhive' ), 'before' => '
', 'options' => $sizes ); $fields['maximum_floor_area'] = array( 'type' => 'select', 'show_label' => true, 'label' => __( 'Max Floor Area', 'propertyhive' ), 'before' => '
', 'options' => $sizes ); // Property Type $options = array( '' => __( 'No preference', 'propertyhive' ) ); $args = array( 'hide_empty' => false, 'parent' => 0 ); $terms = get_terms( 'commercial_property_type', $args ); $selected_value = ''; if ( !empty( $terms ) && !is_wp_error( $terms ) ) { foreach ($terms as $term) { $options[$term->term_id] = $term->name; $args = array( 'hide_empty' => false, 'parent' => $term->term_id ); $subterms = get_terms( 'commercial_property_type', $args ); if ( !empty( $subterms ) && !is_wp_error( $subterms ) ) { foreach ($subterms as $term) { $options[$term->term_id] = '- ' . $term->name; } } } } $fields['commercial_property_type'] = array( 'type' => 'select', 'show_label' => true, 'before' => '
', 'label' => __( 'Type', 'propertyhive' ), 'options' => $options ); } return $fields; } /** * Main function for drawing property enquiry form. * * @param string $id * @return void */ function propertyhive_enquiry_form( $property_id = '' ) { $form_controls = ph_get_property_enquiry_form_fields( $property_id ); $form_controls = apply_filters( 'propertyhive_property_enquiry_form_fields', $form_controls ); ph_get_template( 'global/make-enquiry-form.php',array( 'form_controls' => $form_controls ) ); } /** * Get default fields to be shown on search forms * * @return array */ function ph_get_property_enquiry_form_fields( $property_id = '' ) { global $post; $fields = array(); $fields['property_id'] = array( 'type' => 'hidden', 'value' => ( $property_id != '' ? $property_id : $post->ID ) ); $fields['name'] = array( 'type' => 'text', 'label' => __( 'Full Name', 'propertyhive' ), 'required' => true ); if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $fields['name']['value'] = $current_user->display_name; } $fields['email_address'] = array( 'type' => 'email', 'label' => __( 'Email Address', 'propertyhive' ), 'required' => true ); if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $fields['email_address']['value'] = $current_user->user_email; } $fields['telephone_number'] = array( 'type' => 'text', 'label' => __( 'Number', 'propertyhive' ), 'required' => true ); $fields['message'] = array( 'type' => 'textarea', 'label' => __( 'Message', 'propertyhive' ), 'required' => true ); if ( get_option( 'propertyhive_property_enquiry_form_disclaimer', '' ) != '' ) { $disclaimer = get_option( 'propertyhive_property_enquiry_form_disclaimer', '' ); $fields['disclaimer'] = array( 'type' => 'checkbox', 'label' => $disclaimer, 'label_style' => 'width:100%;', 'required' => true ); } return $fields; } /** * Get default fields to be shown on applicant registration forms * * @return array */ function ph_get_user_details_form_fields() { global $post; if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); if ( $current_user instanceof WP_User ) { $contact = new PH_Contact( '', $current_user->ID ); } } $fields = array(); $fields['name'] = array( 'type' => 'text', 'label' => __( 'Full Name', 'propertyhive' ), 'required' => true ); if ( is_user_logged_in() && $current_user instanceof WP_User ) { $fields['name']['value'] = $current_user->display_name; } $fields['email_address'] = array( 'type' => 'email', 'label' => __( 'Email Address', 'propertyhive' ), 'required' => true ); if ( is_user_logged_in() && $current_user instanceof WP_User ) { $fields['email_address']['value'] = $current_user->user_email; } $fields['telephone_number'] = array( 'type' => 'text', 'label' => __( 'Telephone Number', 'propertyhive' ), 'required' => false ); if ( is_user_logged_in() && $current_user instanceof WP_User ) { $fields['telephone_number']['value'] = $contact->telephone_number; } if ( get_option( 'propertyhive_applicant_users', '' ) == 'yes' ) { $fields['password'] = array( 'type' => 'password', 'label' => __( 'Password', 'propertyhive' ), 'required' => true ); $fields['password2'] = array( 'type' => 'password', 'label' => __( 'Confirm Password', 'propertyhive' ), 'required' => true ); } return $fields; } /** * Get default fields to be shown on applicant registration forms * * @return array */ function ph_get_applicant_requirements_form_fields() { global $post; if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $applicant_profile = false; if ( $current_user instanceof WP_User ) { $contact = new PH_Contact( '', $current_user->ID ); if ( is_array($contact->contact_types) && in_array('applicant', $contact->contact_types) ) { if ( $contact->applicant_profiles != '' && $contact->applicant_profiles > 0 && $contact->applicant_profile_0 != '' && is_array($contact->applicant_profile_0) ) { $applicant_profile = $contact->applicant_profile_0; } } } } $fields = array(); $offices = array(); $value = ''; $args = array( 'post_type' => 'office', 'nopaging' => true, 'orderby' => 'title', 'order' => 'ASC' ); $office_query = new WP_Query( $args ); if ( $office_query->have_posts() ) { while ( $office_query->have_posts() ) { $office_query->the_post(); $offices[get_the_ID()] = get_the_title(); if ( get_post_meta(get_the_ID(), 'primary', TRUE) == 1 ) { $value = get_the_ID(); } } } wp_reset_postdata(); $fields['office_id'] = array( 'type' => ( (count($offices) <= 1) ? 'hidden' : 'select' ), 'label' => __( 'Office', 'propertyhive' ), 'required' => false, 'show_label' => true, 'value' => $value, 'options' => $offices ); $departments = array(); $value = ''; if ( get_option( 'propertyhive_active_departments_sales' ) == 'yes' ) { $departments['residential-sales'] = __( 'Properties To Buy', 'propertyhive' ); if ($value == '' && (get_option( 'propertyhive_primary_department' ) == 'residential-sales' || get_option( 'propertyhive_primary_department' ) === FALSE) ) { $value = 'residential-sales'; } } if ( get_option( 'propertyhive_active_departments_lettings' ) == 'yes' ) { $departments['residential-lettings'] = __( 'Properties For Rent', 'propertyhive' ); if ($value == '' && get_option( 'propertyhive_primary_department' ) == 'residential-lettings') { $value = 'residential-lettings'; } } if ( get_option( 'propertyhive_active_departments_commercial' ) == 'yes' ) { $departments['commercial'] = __( 'Commercial Properties', 'propertyhive' ); if ($value == '' && get_option( 'propertyhive_primary_department' ) == 'commercial') { $value = 'commercial'; } } $fields['department'] = array( 'type' => 'radio', 'label' => __( 'Looking For', 'propertyhive' ), 'required' => true, 'show_label' => true, 'value' => $value, 'options' => $departments ); if ( is_user_logged_in() && isset($applicant_profile['department']) ) { $fields['department']['value'] = $applicant_profile['department']; } if ( count($departments) == 1 ) { $fields['department']['type'] = 'hidden'; } if ( get_option( 'propertyhive_active_departments_sales' ) == 'yes' || get_option( 'propertyhive_active_departments_lettings' ) == 'yes' ) { $fields['maximum_price'] = array( 'type' => 'number', 'label' => __( 'Maximum Price', 'propertyhive' ), 'style' => 'max-width:150px;', 'before' => '
', 'required' => false ); if ( is_user_logged_in() && isset($applicant_profile['max_price']) ) { $fields['maximum_price']['value'] = $applicant_profile['max_price']; } $fields['maximum_rent'] = array( 'type' => 'number', 'label' => __( 'Maximum Rent', 'propertyhive' ) . ' (PCM)', 'style' => 'max-width:150px;', 'before' => '
', 'required' => false ); if ( is_user_logged_in() && isset($applicant_profile['max_rent']) ) { $fields['maximum_rent']['value'] = $applicant_profile['max_rent']; } $fields['minimum_bedrooms'] = array( 'type' => 'number', 'label' => __( 'Minimum Bedrooms', 'propertyhive' ), 'style' => 'max-width:80px;', 'before' => '
', 'required' => false ); if ( is_user_logged_in() && isset($applicant_profile['min_beds']) ) { $fields['minimum_bedrooms']['value'] = $applicant_profile['min_beds']; } $args = array( 'hide_empty' => false, 'parent' => 0 ); $terms = get_terms( 'property_type', $args ); $options = array(); $selected_value = ''; if ( !empty( $terms ) && !is_wp_error( $terms ) ) { $options = array( '' => __( 'All Property Types', 'properthive' ) ); foreach ($terms as $term) { $options[$term->term_id] = $term->name; $args = array( 'hide_empty' => false, 'parent' => $term->term_id ); $subterms = get_terms( 'property_type', $args ); if ( !empty( $subterms ) && !is_wp_error( $subterms ) ) { foreach ($subterms as $term) { $options[$term->term_id] = '- ' . $term->name; } } } } if ( !empty($options) ) { $fields['property_type'] = array( 'type' => 'select', 'label' => __( 'Property Type', 'propertyhive' ), 'before' => '
', 'required' => false, 'options' => $options, ); if ( is_user_logged_in() && isset($applicant_profile['property_types']) && is_array($applicant_profile['property_types']) && !empty($applicant_profile['property_types']) ) { $fields['property_type']['value'] = $applicant_profile['property_types'][0]; } } } if ( get_option( 'propertyhive_active_departments_commercial' ) == 'yes' ) { $fields['available_as_sale'] = array( 'type' => 'checkbox', 'label' => __( 'For Sale', 'propertyhive' ), 'before' => '
', 'required' => false, ); if ( is_user_logged_in() && isset($applicant_profile['available_as']) && in_array('sale', $applicant_profile['available_as']) ) { $fields['available_as_sale']['checked'] = true; } $fields['available_as_rent'] = array( 'type' => 'checkbox', 'label' => __( 'To Rent', 'propertyhive' ), 'before' => '
', 'required' => false, ); if ( is_user_logged_in() && isset($applicant_profile['available_as']) && in_array('rent', $applicant_profile['available_as']) ) { $fields['available_as_rent']['checked'] = true; } $fields['minimum_floor_area'] = array( 'type' => 'number', 'label' => __( 'Min Floor Area (Sq Ft)', 'propertyhive' ), 'style' => 'max-width:150px;', 'before' => '
', 'required' => false ); if ( is_user_logged_in() && isset($applicant_profile['min_floor_area']) ) { $fields['minimum_floor_area']['value'] = $applicant_profile['min_floor_area']; } $fields['maximum_floor_area'] = array( 'type' => 'number', 'label' => __( 'Max Floor Area (Sq Ft)', 'propertyhive' ), 'style' => 'max-width:150px;', 'before' => '
', 'required' => false ); if ( is_user_logged_in() && isset($applicant_profile['max_floor_area']) ) { $fields['maximum_floor_area']['value'] = $applicant_profile['max_floor_area']; } $args = array( 'hide_empty' => false, 'parent' => 0 ); $terms = get_terms( 'commercial_property_type', $args ); $options = array(); $selected_value = ''; if ( !empty( $terms ) && !is_wp_error( $terms ) ) { $options = array( '' => __( 'All Property Types', 'properthive' ) ); foreach ($terms as $term) { $options[$term->term_id] = $term->name; $args = array( 'hide_empty' => false, 'parent' => $term->term_id ); $subterms = get_terms( 'commercial_property_type', $args ); if ( !empty( $subterms ) && !is_wp_error( $subterms ) ) { foreach ($subterms as $term) { $options[$term->term_id] = '- ' . $term->name; } } } } if ( !empty($options) ) { $fields['commercial_property_type'] = array( 'type' => 'select', 'label' => __( 'Property Type', 'propertyhive' ), 'before' => '
', 'required' => false, 'options' => $options, ); if ( is_user_logged_in() && isset($applicant_profile['commercial_property_types']) && is_array($applicant_profile['commercial_property_types']) && !empty($applicant_profile['commercial_property_types']) ) { $fields['commercial_property_type']['value'] = $applicant_profile['commercial_property_types'][0]; } } } $args = array( 'hide_empty' => false, 'parent' => 0 ); $terms = get_terms( 'location', $args ); $options = array(); $selected_value = ''; if ( !empty( $terms ) && !is_wp_error( $terms ) ) { $options = array( '' => __( 'All Locations', 'properthive' ) ); foreach ($terms as $term) { $options[$term->term_id] = $term->name; $args = array( 'hide_empty' => false, 'parent' => $term->term_id ); $subterms = get_terms( 'location', $args ); if ( !empty( $subterms ) && !is_wp_error( $subterms ) ) { foreach ($subterms as $term) { $options[$term->term_id] = '- ' . $term->name; } } } } if ( !empty($options) ) { $fields['location'] = array( 'type' => 'select', 'label' => __( 'Location', 'propertyhive' ), 'required' => false, 'options' => $options, ); if ( is_user_logged_in() && isset($applicant_profile['locations']) && is_array($applicant_profile['locations']) && !empty($applicant_profile['locations']) ) { $fields['location']['value'] = $applicant_profile['locations'][0]; } } $fields['additional_requirements'] = array( 'type' => 'textarea', 'label' => __( 'Additional Requirements', 'propertyhive' ), 'required' => false ); if ( is_user_logged_in() && isset($applicant_profile['notes']) ) { $fields['additional_requirements']['value'] = $applicant_profile['notes']; } return $fields; } /** * Output individual field * * @return void */ function ph_form_field( $key, $field ) { global $post; $output = ''; switch ($field['type']) { case "text": case "email": case "date": case "number": case "password": { $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; $field['before'] = isset( $field['before'] ) ? $field['before'] : '
'; $field['after'] = isset( $field['after'] ) ? $field['after'] : '
'; $field['show_label'] = isset( $field['show_label'] ) ? $field['show_label'] : true; $field['label'] = isset( $field['label'] ) ? $field['label'] : ''; $field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : ( ( $field['type'] == 'date' ) ? 'dd/mm/yyyy' : '' ); $field['required'] = isset( $field['required'] ) ? $field['required'] : false; $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : ''; if ( isset( $_GET[$key] ) && ! empty( $_GET[$key] ) ) { $field['value'] = sanitize_text_field( wp_unslash( $_GET[$key] ) ); } else { if ( !is_post_type_archive('property') && !is_singular('property') && isset($post->ID) ) { $value = get_post_meta( $post->ID, '_' . $key, true ); if ( $value != '' ) { $field['value'] = $value; } } } $output .= $field['before']; if ($field['show_label']) { $output .= ''; } $output .= ''; $output .= $field['after']; break; } case "textarea": { $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; $field['before'] = isset( $field['before'] ) ? $field['before'] : '
'; $field['after'] = isset( $field['after'] ) ? $field['after'] : '
'; $field['show_label'] = isset( $field['show_label'] ) ? $field['show_label'] : true; $field['label'] = isset( $field['label'] ) ? $field['label'] : ''; $field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : ''; $field['required'] = isset( $field['required'] ) ? $field['required'] : false; $field['value'] = isset( $field['value'] ) ? $field['value'] : ''; if ( isset( $_GET[$key] ) && ! empty( $_GET[$key] ) ) { $field['value'] = sanitize_textarea_field( wp_unslash( $_GET[$key] ) ); } else { if ( !is_post_type_archive('property') && !is_singular('property') && isset($post->ID) ) { $value = get_post_meta( $post->ID, '_' . $key, true ); if ( $value != '' ) { $field['value'] = $value; } } } $output .= $field['before']; if ($field['show_label']) { $output .= ''; } $output .= ''; $output .= $field['after']; break; } case "checkbox": { $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; $field['before'] = isset( $field['before'] ) ? $field['before'] : '
'; $field['after'] = isset( $field['after'] ) ? $field['after'] : '
'; $field['show_label'] = isset( $field['show_label'] ) ? $field['show_label'] : true; $field['label'] = isset( $field['label'] ) ? $field['label'] : ''; $field['label_style'] = isset( $field['label_style'] ) ? $field['label_style'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : 'yes'; $field['checked'] = isset( $field['checked'] ) ? $field['checked'] : false; if ( isset( $_GET[$key] ) && sanitize_text_field(wp_unslash($_GET[$key])) == $field['value'] ) { $field['checked'] = true; } else { if ( !is_post_type_archive('property') && !is_singular('property') && isset($post->ID) ) { $value = get_post_meta( $post->ID, '_' . $key, true ); if ( $value == 'yes' ) { $field['checked'] = true; } } } $output .= $field['before']; $output .= ''; $output .= $field['after']; break; } case "radio": { $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; $field['before'] = isset( $field['before'] ) ? $field['before'] : '
'; $field['after'] = isset( $field['after'] ) ? $field['after'] : '
'; $field['show_label'] = isset( $field['show_label'] ) ? $field['show_label'] : false; $field['label'] = isset( $field['label'] ) ? $field['label'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : ''; if ( isset( $_GET[$key] ) && ! empty( $_GET[$key] ) ) { $field['value'] = sanitize_text_field(wp_unslash($_GET[$key])); } $output .= $field['before']; if ($field['show_label']) { $output .= ''; } foreach ( $field['options'] as $option_key => $value ) { $output .= ''; } $output .= $field['after']; break; } case "select": { $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; $field['before'] = isset( $field['before'] ) ? $field['before'] : '
'; $field['after'] = isset( $field['after'] ) ? $field['after'] : '
'; $field['show_label'] = isset( $field['show_label'] ) ? $field['show_label'] : true; $field['label'] = isset( $field['label'] ) ? $field['label'] : ''; $field['required'] = isset( $field['required'] ) ? $field['required'] : false; $field['options'] = ( isset( $field['options'] ) && is_array( $field['options'] ) ) ? $field['options'] : array(); $field['value'] = isset( $field['value'] ) ? $field['value'] : ''; if ( isset( $_GET[$key] ) && ! empty( $_GET[$key] ) ) { $field['value'] = sanitize_text_field(wp_unslash($_GET[$key])); } else { if ( !is_post_type_archive('property') && isset($post->ID) ) { $value = get_post_meta( $post->ID, '_' . $key, true ); if ( $value != '' ) { $field['value'] = $value; } } } $output .= $field['before']; if ($field['show_label']) { $output .= ''; } $output .= ''; $output .= $field['after']; break; } case "office": { $key = 'officeID'; $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; $field['before'] = isset( $field['before'] ) ? $field['before'] : '
'; $field['after'] = isset( $field['after'] ) ? $field['after'] : '
'; $field['show_label'] = isset( $field['show_label'] ) ? $field['show_label'] : true; $field['label'] = isset( $field['label'] ) ? $field['label'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : ''; if ( isset( $_GET[$key] ) && ! empty( $_GET[$key] ) ) { $field['value'] = (int)$_GET[$key]; } $output .= $field['before']; if ($field['show_label']) { $output .= ''; } $output .= ''; $output .= $field['after']; break; } case "country": { $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; $field['before'] = isset( $field['before'] ) ? $field['before'] : '
'; $field['after'] = isset( $field['after'] ) ? $field['after'] : '
'; $field['show_label'] = isset( $field['show_label'] ) ? $field['show_label'] : true; $field['label'] = isset( $field['label'] ) ? $field['label'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : ''; if ( isset( $_GET[$key] ) && ! empty( $_GET[$key] ) ) { $field['value'] = sanitize_text_field(wp_unslash($_GET[$key])); } $output .= $field['before']; if ($field['show_label']) { $output .= ''; } $output .= ''; $output .= $field['after']; break; } case "hidden": { $field['value'] = isset( $field['value'] ) ? $field['value'] : ''; $field['name'] = isset( $field['name'] ) ? $field['name'] : $key; if ( isset( $_GET[$key] ) && ! empty( $_GET[$key] ) ) { $field['value'] = sanitize_text_field(wp_unslash($_GET[$key])); } $output .= ''; break; } case "html": { $field['html'] = isset( $field['html'] ) ? $field['html'] : ''; $field['before'] = isset( $field['before'] ) ? $field['before'] : '
'; $field['after'] = isset( $field['after'] ) ? $field['after'] : '
'; $output .= $field['before']; $output .= $field['html']; $output .= $field['after']; break; } case "recaptcha": { $field['site_key'] = isset( $field['site_key'] ) ? $field['site_key'] : ''; $output .= '
'; break; } default: { if ( taxonomy_exists($field['type']) ) { $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; $field['before'] = isset( $field['before'] ) ? $field['before'] : '
'; $field['after'] = isset( $field['after'] ) ? $field['after'] : '
'; $field['show_label'] = isset( $field['show_label'] ) ? $field['show_label'] : true; $field['label'] = isset( $field['label'] ) ? $field['label'] : ''; $field['blank_option'] = isset( $field['blank_option'] ) ? $field['blank_option'] : __( 'No preference', 'propertyhive' ); $field['value'] = isset( $field['value'] ) ? $field['value'] : ''; if ( isset( $_GET[$key] ) && ! empty( $_GET[$key] ) ) { $field['value'] = sanitize_text_field(wp_unslash($_GET[$key])); } $output .= $field['before']; if ($field['show_label']) { $output .= ''; } $output .= ''; $output .= $field['after']; } } } echo $output; }