if ($value == $video_type) {
                         $option_video .= 'selected="selected"';
                     }
                     $option_video .= '>' . $value . '</option>';
                 }
                 ///////////////////////////////////////////////////////////////////////////////////////
                 // action images
                 ///////////////////////////////////////////////////////////////////////////////////////
             } else {
                 if ($action == 'amenities') {
                     $feature_list_array = array();
                     $feature_list = esc_html(get_option('wp_estate_feature_list'));
                     $feature_list_array = explode(',', $feature_list);
                     foreach ($feature_list_array as $key => $value) {
                         $post_var_name = str_replace(' ', '_', trim($value));
                         $post_var_name = wpestate_limit45(sanitize_title($post_var_name));
                         $post_var_name = sanitize_key($post_var_name);
                         if (isset($_POST[$post_var_name])) {
                             $feature_value = wp_kses($_POST[$post_var_name], $allowed_html);
                             update_post_meta($edit_id, $post_var_name, $feature_value);
                             $moving_array[] = $post_var_name;
                         }
                     }
                 } else {
                     if ($action == 'calendar') {
                     }
                 }
             }
         }
     }
 }
Example #2
0
    function wpestate_advanced_search_function($attributes, $content = null)
    {
        $return_string = '';
        $random_id = '';
        $custom_advanced_search = get_option('wp_estate_custom_advanced_search', '');
        $actions_select = '';
        $categ_select = '';
        $title = '';
        if (isset($attributes['title'])) {
            $title = $attributes['title'];
        }
        $args = wpestate_get_select_arguments();
        $action_select_list = wpestate_get_action_select_list($args);
        $categ_select_list = wpestate_get_category_select_list($args);
        $select_city_list = wpestate_get_city_select_list($args);
        $select_area_list = wpestate_get_area_select_list($args);
        $adv_submit = wpestate_get_adv_search_link();
        if ($title != '') {
        }
        $return_string .= '<h1 class="shortcode_title_adv">' . $title . '</h1>';
        $return_string .= '<div class="advanced_search_shortcode" id="advanced_search_shortcode">
        <form role="search" method="get"   action="' . $adv_submit . '" >';
        if ($custom_advanced_search == 'yes') {
            $adv_search_what = get_option('wp_estate_adv_search_what', '');
            $adv_search_label = get_option('wp_estate_adv_search_label', '');
            $adv_search_how = get_option('wp_estate_adv_search_how', '');
            $count = 0;
            foreach ($adv_search_what as $key => $search_field) {
                $count++;
                $margin_style = '';
                if ($count % 4 == 0) {
                    $margin_style = ' adv_seach_code_right ';
                }
                if ($search_field == 'none') {
                    $return_string .= '';
                } else {
                    if ($search_field == 'types') {
                        $return_string .= '           
                                <div class="dropdown listing_filter_select form-control" >
                                <div data-toggle="dropdown" id="adv_actions_shortcode" class="filter_menu_trigger" data-value="all">' . esc_html__('All Sizes', 'wpestate') . '<span class="caret caret_filter"></span> </div>           
                                    <input type="hidden" name="filter_search_action[]" value="">
                                    <ul class="dropdown-menu filter_menu" role="menu" aria-labelledby="adv_actions_shortcode">
                                        ' . $action_select_list . '
                                    </ul>        
                                </div>';
                    } else {
                        if ($search_field == 'categories') {
                            $return_string .= '
                             <div class="dropdown listing_filter_select form-control" >
                                <div data-toggle="dropdown" id="adv_categ_shortcode" class="filter_menu_trigger" data-value="all">' . esc_html__('All Types', 'wpestate') . ' <span class="caret caret_filter"></span> </div>           
                                  <input type="hidden" name="filter_search_type[]" value="">

                                  <ul class="dropdown-menu filter_menu" role="menu" aria-labelledby="adv_categ_shortcode">
                                    ' . $categ_select_list . '
                                  </ul>        
                            </div>';
                        } else {
                            if ($search_field == 'cities') {
                                $return_string .= '
                            <div class="dropdown listing_filter_select form-control" >
                                <div data-toggle="dropdown" id="advanced_city_shortcode" class="filter_menu_trigger" data-value="all">' . esc_html__('All Cities', 'wpestate') . ' <span class="caret caret_filter"></span> </div>           
                                <input type="hidden" name="advanced_city" value="">
                                <ul class="dropdown-menu filter_menu" role="menu" id="adv_short_select_city" aria-labelledby="advanced_city_shortcode">
                                    ' . $select_city_list . '
                                </ul>        
                            </div>';
                            } else {
                                if ($search_field == 'areas') {
                                    $return_string .= '
                            <div class="dropdown listing_filter_select  form-control" >
                               <div data-toggle="dropdown" id="advanced_area_shortcode" class="filter_menu_trigger" data-value="all">' . esc_html__('All Areas', 'wpestate') . '<span class="caret caret_filter"></span> </div>           
                               <input type="hidden" name="advanced_area" value="">
                               <ul class="dropdown-menu filter_menu" role="menu" id="adv_short_select_area" aria-labelledby="advanced_area_shortcode">
                                   ' . $select_area_list . '
                               </ul>        
                            </div>';
                                } else {
                                    $slug = str_replace(' ', '_', $search_field);
                                    $random_id = rand(1, 999);
                                    $string = wpestate_limit45(sanitize_title($adv_search_label[$key]));
                                    $slug = sanitize_key($string);
                                    $label = $adv_search_label[$key];
                                    if (function_exists('icl_translate')) {
                                        $label = icl_translate('wpestate', 'wp_estate_custom_search_' . $label, $label);
                                    }
                                    if ($adv_search_what[$key] == 'property price') {
                                        $show_slider_price = get_option('wp_estate_show_slider_price', '');
                                        if ($show_slider_price == 'yes') {
                                            $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', ''));
                                            $currency = esc_html(get_option('wp_estate_currency_symbol', ''));
                                            $min_price_slider = floatval(get_option('wp_estate_show_slider_min_price', ''));
                                            $max_price_slider = floatval(get_option('wp_estate_show_slider_max_price', ''));
                                            if ($where_currency == 'before') {
                                                $price_slider_label = $currency . number_format($min_price_slider) . ' ' . esc_html__('to', 'wpestate') . ' ' . $currency . number_format($max_price_slider);
                                            } else {
                                                $price_slider_label = number_format($min_price_slider) . $currency . ' ' . esc_html__('to', 'wpestate') . ' ' . number_format($max_price_slider) . $currency;
                                            }
                                            $return_string .= '
                                        <div class="adv_search_sh">
                                            <p>
                                                <label>' . esc_html__('Price range:', 'wpestate') . '</label>
                                                <span id="amount_sh"  style="border:0; font-weight:bold;">' . wpestate_show_price_label_slider($min_price_slider, $max_price_slider, $currency, $where_currency) . '</span>
                                            </p>
                                            <div id="slider_price_sh"></div>
                                            <input type="hidden" id="price_low_sh"  name="price_low"  value="' . $min_price_slider . '" />
                                            <input type="hidden" id="price_max_sh"  name="price_max"  value="' . $max_price_slider . '" />
                                        </div>';
                                        } else {
                                            $return_string .= '
                                    <div class="adv_shortcode_input ' . $margin_style . '" >
                                       <input type="text" id="' . $slug . $random_id . '"  name="' . $slug . '" placeholder="' . $label . '" value=""  class="advanced_select form-control">
                                    </div>';
                                        }
                                        // if is property price
                                    } else {
                                        $return_string .= '
                                <div class="adv_shortcode_input ' . $margin_style . '" >
                                   <input type="text" id="' . $slug . $random_id . '"  name="' . $slug . '" placeholder="' . $label . '" value=""  class="advanced_select form-control">
                                </div>';
                                    }
                                    if ($adv_search_how[$key] == 'date bigger' || $adv_search_how[$key] == 'date smaller') {
                                        $return_string .= '<script type="text/javascript">
                                          //<![CDATA[
                                          jQuery(document).ready(function(){
                                                ' . wpestate_date_picker_translation($slug . $random_id) . '
                                          });
                                          //]]>
                                          </script>';
                                    }
                                }
                            }
                        }
                    }
                }
                //end else
            }
            // end foreach
        } else {
            $return_string .= '
                 
                <div class="col-md-3 map_icon "> <!-- map_icon -->
                    <input type="text" id="search_location_filter_shortcode" class="form-control search_location_city" name="search_location" placeholder="' . esc_html__('Type location', 'wpestate') . '" value="" autocomplete="off">
                    <input type="hidden" id="advanced_city_shortcode"   class="form-control" name="advanced_city" data-value=""   value="" >              
                    <input type="hidden" id="advanced_area_shortcode"   class="form-control" name="advanced_area"   data-value="" value="" >              
                    <input type="hidden" id="advanced_country_shortcode"   class="form-control" name="advanced_country"   data-value="" value="" >              
        
                </div>
                
                <div class="col-md-3 has_calendar calendar_icon ">  <!-- calendar_icon -->
                    <input type="text" id="checkinshortcode" class="form-control " name="check_in" placeholder="' . esc_html__('Check in', 'wpestate') . '">       
                </div>
                
                <div class="col-md-3 has_calendar calendar_icon checkout_sh ">  <!-- calendar_icon -->
                    <input type="text" id="checkoutshortcode" disabled class="form-control " name="check_out" placeholder="' . esc_html__('Check Out', 'wpestate') . '">
                </div>

                <div class="col-md-3 dropdown guest_form_sh_wr">
                <div class=" form-control guest_form">
                    <div data-toggle="dropdown" id="guest_no_shortcode" class="filter_menu_trigger" data-value="all"> ' . esc_html__('Guests', 'wpestate') . ' <span class="caret caret_filter"></span> </div>           
                    <input type="hidden" name="guest_no" id="guest_no_input_sh" value="">
                    <ul class="dropdown-menu filter_menu" role="menu" aria-labelledby="guest_no_input_sh">' . wpestate_get_guest_dropdown() . '
                    </ul>
                </div>    
                </div>';
            $show_slider_price = get_option('wp_estate_show_slider_price', '');
            $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', ''));
            $currency = esc_html(get_option('wp_estate_currency_symbol', ''));
            $min_price_slider = floatval(get_option('wp_estate_show_slider_min_price', ''));
            $max_price_slider = floatval(get_option('wp_estate_show_slider_max_price', ''));
            if ($where_currency == 'before') {
                $price_slider_label = $currency . number_format($min_price_slider) . ' ' . esc_html__('to', 'wpestate') . ' ' . $currency . number_format($max_price_slider);
            } else {
                $price_slider_label = number_format($min_price_slider) . $currency . ' ' . esc_html__('to', 'wpestate') . ' ' . number_format($max_price_slider) . $currency;
            }
            $return_string .= '
                    <div class="col-md-9 adv_search_sh">
                        <p>
                            <label>' . esc_html__('Price range:', 'wpestate') . '</label>
                            <span id="amount_sh"  style="border:0; font-weight:bold;">' . wpestate_show_price_label_slider($min_price_slider, $max_price_slider, $currency, $where_currency) . '</span>
                        </p>
                        <div id="slider_price_sh"></div>
                        <input type="hidden" id="price_low_sh"  name="price_low"  value="' . $min_price_slider . '" />
                        <input type="hidden" id="price_max_sh"  name="price_max"  value="' . $max_price_slider . '" />
                    </div>';
        }
        $extended_search = get_option('wp_estate_show_adv_search_extended', '');
        if ($extended_search == 'yes') {
            ob_start();
            wpestate_show_extended_search('short');
            $templates = ob_get_contents();
            ob_end_clean();
            $return_string = $return_string . $templates;
        }
        $return_string .= '<div class="col-md-3"></div><div class="col-md-3 adv_sh_but"><button class="wpb_btn-info wpb_btn-small wpestate_vc_button  vc_button" id="advanced_submit_shorcode">' . esc_html__('Search', 'wpestate') . '</button> </div>             

    </form>   
</div>';
        return $return_string;
    }
 function wpestate_custom_adv_ajax_filter_listings_search()
 {
     global $post;
     global $current_user;
     global $options;
     global $show_compare_only;
     global $currency;
     global $where_currency;
     global $listing_type;
     $listing_type = get_option('wp_estate_listing_unit_type', '');
     get_currentuserinfo();
     $show_compare_only = 'no';
     $userID = $current_user->ID;
     $user_option = 'favorites' . $userID;
     $curent_fav = get_option($user_option);
     $currency = esc_html(get_option('wp_estate_currency_symbol', ''));
     $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', ''));
     $area_array = '';
     $city_array = '';
     $action_array = '';
     $categ_array = '';
     $meta_query = array();
     $options = wpestate_page_details(intval($_POST['postid']));
     $adv_search_what = get_option('wp_estate_adv_search_what', '');
     $adv_search_how = get_option('wp_estate_adv_search_how', '');
     $adv_search_label = get_option('wp_estate_adv_search_label', '');
     $adv_search_type = get_option('wp_estate_adv_search_type', '');
     $allowed_html = array();
     $new_key = 0;
     foreach ($adv_search_what as $key => $term) {
         $new_key = $key + 1;
         $new_key = 'val' . $new_key;
         if ($term == 'none') {
         } else {
             if ($term == 'categories') {
                 // for property_category taxonomy
                 if (isset($_POST[$new_key]) && $_POST[$new_key] != 'all' && $_POST[$new_key] != '') {
                     $taxcateg_include = array();
                     $taxcateg_include[] = wp_kses($_POST[$new_key], $allowed_html);
                     $categ_array = array('taxonomy' => 'property_category', 'field' => 'slug', 'terms' => $taxcateg_include);
                 }
             } else {
                 if ($term == 'types') {
                     // for property_action_category taxonomy
                     if (isset($_POST[$new_key]) && $_POST[$new_key] != 'all' && $_POST[$new_key] != '') {
                         $taxaction_include = array();
                         $taxaction_include[] = wp_kses($_POST[$new_key], $allowed_html);
                         $action_array = array('taxonomy' => 'property_action_category', 'field' => 'slug', 'terms' => $taxaction_include);
                     }
                 } else {
                     if ($term == 'cities') {
                         // for property_city taxonomy
                         if (isset($_POST[$new_key]) && $_POST[$new_key] != 'all' && $_POST[$new_key] != '') {
                             $taxcity[] = wp_kses($_POST[$new_key], $allowed_html);
                             $city_array = array('taxonomy' => 'property_city', 'field' => 'slug', 'terms' => $taxcity);
                         }
                     } else {
                         if ($term == 'areas') {
                             // for property_area taxonomy
                             if (isset($_POST[$new_key]) && $_POST[$new_key] != 'all' && $_POST[$new_key] != '') {
                                 $taxarea[] = wp_kses($_POST[$new_key], $allowed_html);
                                 $area_array = array('taxonomy' => 'property_area', 'field' => 'slug', 'terms' => $taxarea);
                             }
                         } else {
                             // $slug=str_replace(' ','_',$term);
                             // $slug_name=str_replace(' ','-',$adv_search_label[$key]);
                             $slug_name = wpestate_limit45(sanitize_title($term));
                             $slug_name = sanitize_key($slug_name);
                             $slug_name_key = $slug_name;
                             if (isset($_POST[$new_key]) && $adv_search_label[$key] != $_POST[$new_key] && $_POST[$new_key] != '') {
                                 // if diffrent than the default values
                                 $compare = $search_type = '';
                                 $compare_array = array();
                                 //$adv_search_how
                                 $compare = $adv_search_how[$key];
                                 $slug_name_key = $slug_name;
                                 $old_values = array('property-price', 'property-label', 'property-size', 'property-lot-size', 'property-rooms', 'property-bedrooms', 'property-bathrooms', 'property-bathrooms', 'property-address', 'property-county', 'property-state', 'property-zip', 'property-country', 'property-status');
                                 if (in_array($slug_name, $old_values)) {
                                     $slug_name_key = str_replace('-', '_', $slug_name);
                                 }
                                 if ($compare == 'equal') {
                                     $compare = '=';
                                     $search_type = 'numeric';
                                     $term_value = floatval($_POST[$new_key]);
                                 } else {
                                     if ($compare == 'greater') {
                                         $compare = '>=';
                                         $search_type = 'numeric';
                                         $term_value = floatval($_POST[$new_key]);
                                     } else {
                                         if ($compare == 'smaller') {
                                             $compare = '<=';
                                             $search_type = 'numeric';
                                             $term_value = floatval($_POST[$new_key]);
                                         } else {
                                             if ($compare == 'like') {
                                                 $compare = 'LIKE';
                                                 $search_type = 'CHAR';
                                                 $term_value = wp_kses($_POST[$new_key], $allowed_html);
                                             } else {
                                                 if ($compare == 'date bigger') {
                                                     $compare = '>=';
                                                     $search_type = 'DATE';
                                                     $term_value = wp_kses($_POST[$new_key], $allowed_html);
                                                 } else {
                                                     if ($compare == 'date smaller') {
                                                         $compare = '<=';
                                                         $search_type = 'DATE';
                                                         $term_value = wp_kses($_POST[$new_key], $allowed_html);
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 $compare_array['key'] = $slug_name_key;
                                 $compare_array['value'] = $term_value;
                                 $compare_array['type'] = $search_type;
                                 $compare_array['compare'] = $compare;
                                 $meta_query[] = $compare_array;
                             }
                             // end if diffrent
                         }
                     }
                 }
             }
         }
         ////////////////// end last else
     }
     ///////////////////////////////////////////// end for each adv search term
     $paged = intval($_POST['newpage']);
     $prop_no = intval(get_option('wp_estate_prop_no', ''));
     $args = array('post_type' => 'estate_property', 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => 30, 'meta_key' => 'prop_featured', 'orderby' => 'meta_value', 'order' => 'DESC', 'meta_query' => $meta_query, 'tax_query' => array('relation' => 'AND', $categ_array, $action_array, $city_array, $area_array));
     //////////////////////////////////////////////////// in case of slider search
     if (get_option('wp_estate_show_slider_price', '') == 'yes') {
         $where_to_replace = -1;
         foreach ($args['meta_query'] as $key => $arr_compare) {
             if ($arr_compare['key'] == 'property_price') {
                 $where_to_replace = $key;
             }
         }
         //  print 'to replace here '.$where_to_replace;
         if ($where_to_replace != -1) {
             unset($args['meta_query'][$where_to_replace]);
             //     print 'after unser';
             //       print_r($args);
             $compare_array['key'] = 'property_price';
             $compare_array['value'] = intval($_POST['slider_min']);
             $compare_array['type'] = 'numeric';
             $compare_array['compare'] = '>=';
             $args['meta_query'][] = $compare_array;
             $compare_array['key'] = 'property_price';
             $compare_array['value'] = intval($_POST['slider_max']);
             $compare_array['type'] = 'numeric';
             $compare_array['compare'] = '<=';
             $args['meta_query'][] = $compare_array;
         }
     }
     ////////////////////////////////////////////////////////// end in case of slider search
     //  print_r($args);
     $prop_selection = new WP_Query($args);
     $counter = 0;
     $compare_submit = wpestate_get_compare_link();
     print '<span id="scrollhere"></span>';
     if (!is_tax()) {
         print '<div class="compare_ajax_wrapper">';
         get_template_part('templates/compare_list');
         print '</div>';
     }
     if ($prop_selection->have_posts()) {
         while ($prop_selection->have_posts()) {
             $prop_selection->the_post();
             get_template_part('templates/property_unit');
         }
         kriesi_pagination_ajax($prop_selection->max_num_pages, $range = 2, $paged, 'pagination_ajax_search');
     } else {
         print '<span class="no_results">' . esc_html__("We didn't find any results", "wpestate") . '</>';
     }
     die;
 }
 function estate_listing_details($post_id)
 {
     $currency = esc_html(get_option('wp_estate_currency_symbol', ''));
     $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', ''));
     $measure_sys = esc_html(get_option('wp_estate_measure_sys', ''));
     $property_size = intval(get_post_meta($post_id, 'property_size', true));
     if ($property_size != '') {
         $property_size = number_format($property_size) . ' ' . $measure_sys . '<sup>2</sup>';
     }
     $property_lot_size = intval(get_post_meta($post_id, 'property_lot_size', true));
     if ($property_lot_size != '') {
         $property_lot_size = number_format($property_lot_size) . ' ' . $measure_sys . '<sup>2</sup>';
     }
     $property_rooms = floatval(get_post_meta($post_id, 'property_rooms', true));
     $property_bedrooms = floatval(get_post_meta($post_id, 'property_bedrooms', true));
     $property_bathrooms = floatval(get_post_meta($post_id, 'property_bathrooms', true));
     $return_string = '';
     if ($property_size != '') {
         $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Property Size', 'wpestate') . ':</span> ' . $property_size . '</div>';
     }
     if ($property_lot_size != '') {
         $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Property Lot Size', 'wpestate') . ':</span> ' . $property_lot_size . '</div>';
     }
     if ($property_rooms != '') {
         $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Rooms', 'wpestate') . ':</span> ' . $property_rooms . '</div>';
     }
     if ($property_bedrooms != '') {
         $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Bedrooms', 'wpestate') . ':</span> ' . $property_bedrooms . '</div>';
     }
     if ($property_bathrooms != '') {
         $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . esc_html__('Bathrooms', 'wpestate') . ':</span> ' . $property_bathrooms . '</div>';
     }
     // Custom Fields
     $i = 0;
     $custom_fields = get_option('wp_estate_custom_fields', true);
     if (!empty($custom_fields)) {
         while ($i < count($custom_fields)) {
             $name = $custom_fields[$i][0];
             $label = $custom_fields[$i][1];
             $type = $custom_fields[$i][2];
             //    $slug =   sanitize_key ( str_replace(' ','_',$name) );
             $slug = wpestate_limit45(sanitize_title($name));
             $slug = sanitize_key($slug);
             $value = esc_html(get_post_meta($post_id, $slug, true));
             if (function_exists('icl_translate')) {
                 $label = icl_translate('wpestate', 'wp_estate_property_custom_' . $label, $label);
                 $value = icl_translate('wpestate', 'wp_estate_property_custom_' . $value, $value);
             }
             if ($value != '') {
                 $return_string .= '<div class="listing_detail col-md-6"><span class="item_head">' . ucwords($label) . ':</span> ' . $value . '</div>';
             }
             $i++;
         }
     }
     //END Custom Fields
     return $return_string;
 }
">
        </p>
    </div>
    
  
    <!-- Add custom details -->

    <?php 
$i = 0;
if (!empty($custom_fields)) {
    while ($i < count($custom_fields)) {
        $name = $custom_fields[$i][0];
        $label = $custom_fields[$i][1];
        $type = $custom_fields[$i][2];
        $slug = str_replace(' ', '_', $name);
        $slug = wpestate_limit45(sanitize_title($name));
        $slug = sanitize_key($slug);
        $i++;
        if (function_exists('icl_translate')) {
            $label = icl_translate('wpestate', 'wp_estate_property_custom_front_' . $label, $label);
        }
        print '<div class="col-md-4"><p><label for="' . $slug . '">' . $label . '</label>';
        if ($type == 'long text') {
            print '<textarea type="text" class="form-control"  id="' . $slug . '"  size="0" name="' . $slug . '" rows="3" cols="42">' . $custom_fields_array[$slug] . '</textarea>';
        } else {
            print '<input type="text" class="form-control"  id="' . $slug . '" size="40" name="' . $slug . '" value="' . $custom_fields_array[$slug] . '">';
        }
        print '</p>  </div>';
        if ($type == 'date') {
            print '<script type="text/javascript">
                    //<![CDATA[
Example #6
0
 function amenities_estate_box($post)
 {
     wp_nonce_field(plugin_basename(__FILE__), 'estate_property_noncename');
     global $post;
     $mypost = $post->ID;
     $feature_list_array = array();
     $feature_list = esc_html(get_option('wp_estate_feature_list'));
     $feature_list_array = explode(',', $feature_list);
     $counter = 0;
     print ' <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>';
     foreach ($feature_list_array as $key => $value) {
         $counter++;
         $post_var_name = str_replace(' ', '_', trim($value));
         if (($counter - 1) % 3 == 0) {
             print '<tr>';
         }
         $input_name = wpestate_limit45(sanitize_title($post_var_name));
         $input_name = sanitize_key($input_name);
         if (function_exists('icl_translate')) {
             $value = icl_translate('wpestate', 'wp_estate_property_custom_amm_' . $value, $value);
         }
         print '     
     <td width="33%" valign="top" align="left">
         <p class="meta-options"> 
         <input type="hidden"    name="' . $input_name . '" value="">
         <input type="checkbox"  name="' . $input_name . '" value="1" ';
         if (esc_html(get_post_meta($mypost, $input_name, true)) == 1) {
             print ' checked="checked" ';
         }
         print ' />
         <label for="' . $input_name . '">' . $value . '</label>
         </p>
     </td>';
         if ($counter % 3 == 0) {
             print '</tr>';
         }
     }
     print '</table>';
 }
 function wpestate_get_custom_field_name($query_name, $adv_search_what, $adv_search_label)
 {
     $i = 0;
     foreach ($adv_search_what as $key => $term) {
         $term = str_replace(' ', '_', $term);
         $slug = wpestate_limit45(sanitize_title($term));
         $slug = sanitize_key($slug);
         if ($slug == $query_name) {
             return $adv_search_label[$key];
         }
         $i++;
     }
     return $query_name;
 }
 function estate_add_new_property()
 {
     global $_POST;
     global $userID;
     global $user_pack;
     global $status_values;
     global $status_values_array;
     global $feature_list_array;
     global $feature_list;
     global $custom_fields;
     global $current_user;
     $allowed_html = array();
     $paid_submission_status = esc_html(get_option('wp_estate_paid_submission', ''));
     if ($paid_submission_status != 'membership' || ($paid_submission_status == 'membership' || wpestate_get_current_user_listings($userID) > 0)) {
         // if user can submit
         if (!isset($_POST['new_estate']) || !wp_verify_nonce($_POST['new_estate'], 'submit_new_estate')) {
             exit('Sorry, your are not submiting from site');
         }
         if (!isset($_POST['prop_category'])) {
             $prop_category = 0;
         } else {
             $prop_category = intval($_POST['prop_category']);
         }
         if (!isset($_POST['prop_action_category'])) {
             $prop_action_category = 0;
         } else {
             $prop_action_category = wp_kses($_POST['prop_action_category'], $allowed_html);
         }
         if (!isset($_POST['property_city'])) {
             $property_city = '';
         } else {
             $property_city = wp_kses($_POST['property_city'], $allowed_html);
         }
         if (!isset($_POST['property_area'])) {
             $property_area = '';
         } else {
             $property_area = wp_kses($_POST['property_area'], $allowed_html);
         }
         $show_err = '';
         $post_id = '';
         $submit_title = wp_kses($_POST['title'], $allowed_html);
         $submit_description = wp_kses($_POST['description'], $allowed_html);
         $property_address = wp_kses($_POST['property_address'], $allowed_html);
         $property_county = wp_kses($_POST['property_county'], $allowed_html);
         $property_state = wp_kses($_POST['property_state'], $allowed_html);
         $property_zip = wp_kses($_POST['property_zip'], $allowed_html);
         $country_selected = wp_kses($_POST['property_country'], $allowed_html);
         $prop_stat = wp_kses($_POST['property_status'], $allowed_html);
         $property_status = '';
         foreach ($status_values_array as $key => $value) {
             $value = trim($value);
             $property_status .= '<option value="' . $value . '"';
             if ($value == $prop_stat) {
                 $property_status .= 'selected="selected"';
             }
             $property_status .= '>' . $value . '</option>';
         }
         $property_price = wp_kses($_POST['property_price'], $allowed_html);
         $property_price_onweek = wp_kses($_POST['property_price_onweek'], $allowed_html);
         // CUSTOM MOD
         $property_price_3_week = wp_kses($_POST['property_price_on_3_week'], $allowed_html);
         $property_price_on_6_week = wp_kses($_POST['property_price_on_6_week'], $allowed_html);
         $property_price_onmonth = wp_kses($_POST['property_price_onmonth'], $allowed_html);
         $property_price_on_6_month = wp_kses($_POST['property_price_on_6_month'], $allowed_html);
         $property_price_on_9_month = wp_kses($_POST['property_price_on_9_month'], $allowed_html);
         // CUSTOM MOD
         $property_label = wp_kses($_POST['property_label'], $allowed_html);
         $property_size = wp_kses($_POST['property_size'], $allowed_html);
         $property_lot_size = wp_kses($_POST['property_lot_size'], $allowed_html);
         $property_year = wp_kses($_POST['property_year'], $allowed_html);
         $property_rooms = wp_kses($_POST['property_rooms'], $allowed_html);
         $property_bedrooms = wp_kses($_POST['property_bedrooms'], $allowed_html);
         $property_bathrooms = wp_kses($_POST['property_bathrooms'], $allowed_html);
         $option_video = '';
         $video_values = array('vimeo', 'youtube');
         $video_type = wp_kses($_POST['embed_video_type'], $allowed_html);
         $google_camera_angle = wp_kses($_POST['google_camera_angle'], $allowed_html);
         $has_errors = false;
         $errors = array();
         $moving_array = array();
         foreach ($feature_list_array as $key => $value) {
             $post_var_name = str_replace(' ', '_', trim($value));
             $feature_value = wp_kses($_POST[$post_var_name], $allowed_html);
             if ($feature_value == 1) {
                 $moving_array[] = $post_var_name;
             }
         }
         foreach ($video_values as $value) {
             $option_video .= '<option value="' . $value . '"';
             if ($value == $video_type) {
                 $option_video .= 'selected="selected"';
             }
             $option_video .= '>' . $value . '</option>';
         }
         $option_slider = '';
         $slider_values = array('full top slider', 'small slider');
         $slider_type = wp_kses($_POST['prop_slider_type'], $allowed_html);
         foreach ($slider_values as $value) {
             $option_slider .= '<option value="' . $value . '"';
             if ($value == $slider_type) {
                 $option_slider .= 'selected="selected"';
             }
             $option_slider .= '>' . $value . '</option>';
         }
         $embed_video_id = wp_kses($_POST['embed_video_id'], $allowed_html);
         $property_latitude = floatval($_POST['property_latitude']);
         $property_longitude = floatval($_POST['property_longitude']);
         if ($google_view == 1) {
             $google_view_check = ' checked="checked" ';
         } else {
             $google_view_check = ' ';
         }
         if (isset($_POST['prop_featured'])) {
             $prop_featured = wp_kses($_POST['prop_featured'], $allowed_html);
             if ($prop_featured == 1) {
                 $prop_featured_check = ' checked="checked" ';
             } else {
                 $prop_featured_check = ' ';
             }
         }
         $google_camera_angle = intval($_POST['google_camera_angle']);
         $prop_category = get_term($prop_category, 'property_category');
         $prop_category_selected = $prop_category->term_id;
         $prop_action_category = get_term($prop_action_category, 'property_action_category');
         $prop_action_category_selected = $prop_action_category->term_id;
         // save custom fields
         $i = 0;
         while ($i < count($custom_fields)) {
             $name = $custom_fields[$i][0];
             $type = $custom_fields[$i][1];
             $slug = str_replace(' ', '_', $name);
             $custom_fields_array[$slug] = wp_kses($_POST[$slug], $allowed_html);
             $i++;
         }
         if ($submit_title == '') {
             $has_errors = true;
             $errors[] = esc_html__('Please submit a title for your property', 'wpestate');
         }
         if ($submit_description == '') {
             $has_errors = true;
             $errors[] = esc_html__('*Please submit a description for your property', 'wpestate');
         }
         if ($_FILES['upload_attachment']['name'][0] == '') {
             $has_errors = true;
             $errors[] = esc_html__('*Please submit an image for your property', 'wpestate');
         }
         if ($property_address == '') {
             $has_errors = true;
             $errors[] = esc_html__('*Please submit an address for your property', 'wpestate');
         }
         if ($property_price == '') {
             $has_errors = true;
             $errors[] = esc_html__('*Please submit the price', 'wpestate');
         }
         if ($property_price_onweek == '') {
             // CUSTOM MOD
             $has_errors = true;
             $errors[] = esc_html__('*Please submit the price', 'wpestate');
         }
         if ($property_price_onmonth == '') {
             // CUSTOM MOD
             $has_errors = true;
             $errors[] = esc_html__('*Please submit the price', 'wpestate');
         }
         if ($has_errors) {
             foreach ($errors as $key => $value) {
                 $show_err .= $value . '</br>';
             }
         } else {
             $paid_submission_status = esc_html(get_option('wp_estate_paid_submission', ''));
             $new_status = 'pending';
             $admin_submission_status = esc_html(get_option('wp_estate_admin_submission', ''));
             if ($admin_submission_status == 'no' && $paid_submission_status != 'per listing') {
                 $new_status = 'publish';
             }
             $post = array('post_title' => $submit_title, 'post_content' => $submit_description, 'post_status' => $new_status, 'post_type' => 'estate_property', 'post_author' => $current_user->ID);
             $post_id = wp_insert_post($post);
             if ($paid_submission_status == 'membership') {
                 // update pack status
                 wpestate_update_listing_no($current_user->ID);
                 if ($prop_featured == 1) {
                     wpestate_update_featured_listing_no($current_user->ID);
                 }
             }
         }
         ////////////////////////////////////////////////////////////////////////
         // Upload images
         ////////////////////////////////////////////////////////////////////////
         if ($post_id) {
             if ($_FILES) {
                 $counter = 0;
                 $files = array_reverse($_FILES['upload_attachment']);
                 foreach ($files['name'] as $key => $value) {
                     if ($files['name'][$key]) {
                         $file = array('name' => $files['name'][$key], 'type' => $files['type'][$key], 'tmp_name' => $files['tmp_name'][$key], 'error' => $files['error'][$key], 'size' => $files['size'][$key]);
                         $_FILES = array("upload_featured_attachment" => $file);
                         foreach ($_FILES as $file => $array) {
                             $newupload = wpestate_insert_attachment($file, $post_id);
                         }
                         set_post_thumbnail($post_id, $newupload);
                     }
                 }
             }
             // end id Files
             if (isset($prop_category->name)) {
                 wp_set_object_terms($post_id, $prop_category->name, 'property_category');
             }
             if (isset($prop_action_category->name)) {
                 wp_set_object_terms($post_id, $prop_action_category->name, 'property_action_category');
             }
             if (isset($property_city)) {
                 wp_set_object_terms($post_id, $property_city, 'property_city');
             }
             if (isset($property_area)) {
                 wp_set_object_terms($post_id, $property_area, 'property_area');
             }
             update_post_meta($post_id, 'property_address', $property_address);
             update_post_meta($post_id, 'property_area', $property_area);
             update_post_meta($post_id, 'property_county', $property_county);
             update_post_meta($post_id, 'property_state', $property_state);
             update_post_meta($post_id, 'property_zip', $property_zip);
             update_post_meta($post_id, 'property_country', $country_selected);
             update_post_meta($post_id, 'property_size', $property_size);
             update_post_meta($post_id, 'property_lot_size', $property_lot_size);
             update_post_meta($post_id, 'property_rooms', $property_rooms);
             update_post_meta($post_id, 'property_bedrooms', $property_bedrooms);
             update_post_meta($post_id, 'property_bathrooms', $property_bathrooms);
             update_post_meta($post_id, 'property_year', $property_year);
             update_post_meta($post_id, 'property_status', $prop_stat);
             update_post_meta($post_id, 'property_price', $property_price);
             update_post_meta($post_id, 'property_price_onweek', $property_price_onweek);
             // CUSTOM MOD BEGIN
             update_post_meta($post_id, 'property_price_on_3_week', $property_price_3_week);
             update_post_meta($post_id, 'property_price_on_6_week', $property_price_on_6_week);
             update_post_meta($post_id, 'property_price_onmonth', $property_price_onmonth);
             update_post_meta($post_id, 'property_price_on_6_month', $property_price_on_6_month);
             update_post_meta($post_id, 'property_price_on_9_month', $property_price_on_9_month);
             // CUSTOM MOD END
             update_post_meta($post_id, 'property_label', $property_label);
             update_post_meta($post_id, 'embed_video_type', $video_type);
             update_post_meta($post_id, 'prop_slider_type', $slider_type);
             update_post_meta($post_id, 'embed_video_id', $embed_video_id);
             update_post_meta($post_id, 'property_latitude', $property_latitude);
             update_post_meta($post_id, 'property_longitude', $property_longitude);
             update_post_meta($post_id, 'property_prop_featured', $prop_featured);
             update_post_meta($post_id, 'google_camera_angle', $google_camera_angle);
             update_post_meta($post_id, 'pay_status', 'not paid');
             // save custom fields
             $custom_fields = get_option('wp_estate_custom_fields', true);
             $i = 0;
             while ($i < count($custom_fields)) {
                 $name = $custom_fields[$i][0];
                 $type = $custom_fields[$i][2];
                 // $slug =   str_replace(' ','_',$name);
                 $slug = wpestate_limit45(sanitize_title($name));
                 $slug = sanitize_key($name);
                 if ($type == 'numeric') {
                     $value_custom = intval(wp_kses($_POST[$slug], $allowed_html));
                     update_post_meta($post_id, $slug, $value_custom);
                 } else {
                     $value_custom = esc_html(wp_kses($_POST[$slug], $allowed_html));
                     update_post_meta($post_id, $slug, $value_custom);
                 }
                 $custom_fields_array[$slug] = wp_kses($_POST[$slug], $allowed_html);
                 $i++;
             }
             foreach ($feature_list_array as $key => $value) {
                 $post_var_name = str_replace(' ', '_', trim($value));
                 $feature_value = wp_kses($_POST[$post_var_name], $allowed_html);
                 update_post_meta($post_id, $post_var_name, $feature_value);
                 $moving_array[] = $post_var_name;
             }
             // get user dashboard link
             $redirect = wpestate_get_dashboard_link();
             $headers = 'From: No Reply <noreply@' . $_SERVER['HTTP_HOST'] . '>' . "\r\n";
             $message = esc_html__('Hi there,', 'wpestate') . "\r\n\r\n";
             $message .= sprintf(esc_html__("A user has submited a new property on  %s! You should go check it out.This is the property title: %s", 'wpestate'), get_option('blogname'), $submit_title) . "\r\n\r\n";
             wp_mail(get_option('admin_email'), sprintf(esc_html__('[%s] New Listing Submission', 'wpestate'), get_option('blogname')), $message, $headers);
             wp_reset_query();
             wp_redirect($redirect);
             exit;
         }
     }
     //end if user can submit
 }
 function wpestate_ajax_update_listing_details()
 {
     global $current_user;
     get_currentuserinfo();
     $userID = $current_user->ID;
     if (isset($_POST['listing_edit'])) {
         if (!is_numeric($_POST['listing_edit'])) {
             exit('you don\'t have the right to edit this');
         } else {
             $edit_id = intval($_POST['listing_edit']);
             $the_post = get_post($edit_id);
             if ($current_user->ID != $the_post->post_author) {
                 esc_html_e("you don't have the right to edit this", "wpestate");
                 die;
             } else {
                 $allowed_html = array();
                 $property_size = floatval($_POST['property_size']);
                 $property_rooms = floatval($_POST['property_rooms']);
                 $property_bedrooms = floatval($_POST['property_bedrooms']);
                 $property_bathrooms = floatval($_POST['property_bathrooms']);
                 update_post_meta($edit_id, 'property_size', $property_size);
                 update_post_meta($edit_id, 'property_rooms', $property_rooms);
                 update_post_meta($edit_id, 'property_bedrooms', $property_bedrooms);
                 update_post_meta($edit_id, 'property_bathrooms', $property_bathrooms);
                 $custom_values = explode('~', wp_kses($_POST['custom_fields_val'], $allowed_html));
                 // save custom fields
                 $i = 0;
                 $custom_fields = get_option('wp_estate_custom_fields', true);
                 if (!empty($custom_fields)) {
                     while ($i < count($custom_fields)) {
                         $name = $custom_fields[$i][0];
                         $type = $custom_fields[$i][1];
                         $slug = str_replace(' ', '_', $name);
                         $slug = wpestate_limit45(sanitize_title($name));
                         $slug = sanitize_key($slug);
                         if ($type == 'numeric') {
                             $value_custom = intval(wp_kses($custom_values[$i + 1], $allowed_html));
                             update_post_meta($edit_id, $slug, $value_custom);
                         } else {
                             $value_custom = esc_html(wp_kses($custom_values[$i + 1], $allowed_html));
                             update_post_meta($edit_id, $slug, $value_custom);
                         }
                         $i++;
                     }
                 }
                 echo json_encode(array('edited' => true, 'response' => esc_html__('Changes are saved!', 'wpestate')));
                 die;
             }
         }
     }
 }
Example #10
0
 function wpestate_scripts()
 {
     global $post;
     $custom_image = '';
     $use_idx_plugins = 0;
     $header_type = '';
     $adv_search_type_status = intval(get_option('wp_estate_adv_search_type', ''));
     $home_small_map_status = esc_html(get_option('wp_estate_home_small_map', ''));
     if (isset($post->ID)) {
         $header_type = get_post_meta($post->ID, 'header_type', true);
     }
     $global_header_type = get_option('wp_estate_header_type', '');
     $listing_map = 'internal';
     if ($header_type == 5 || $global_header_type == 4) {
         $listing_map = 'top';
     }
     $slugs = array();
     $hows = array();
     $show_price_slider = 'no';
     $slider_price_position = 0;
     $custom_advanced_search = get_option('wp_estate_custom_advanced_search', '');
     if ($custom_advanced_search == 'yes') {
         $adv_search_what = get_option('wp_estate_adv_search_what', '');
         $adv_search_label = get_option('wp_estate_adv_search_label', '');
         $adv_search_how = get_option('wp_estate_adv_search_how', '');
         $show_price_slider = get_option('wp_estate_show_slider_price', '');
         $slider_price_position = 0;
         $counter = 0;
         foreach ($adv_search_what as $key => $search_field) {
             $counter++;
             if ($search_field == 'types') {
                 $slugs[] = 'adv_actions';
             } else {
                 if ($search_field == 'categories') {
                     $slugs[] = 'adv_categ';
                 } else {
                     if ($search_field == 'cities') {
                         $slugs[] = 'advanced_city';
                     } else {
                         if ($search_field == 'areas') {
                             $slugs[] = 'advanced_area';
                         } else {
                             if ($search_field == 'property price' && $show_price_slider == 'yes') {
                                 $slugs[] = 'property_price';
                                 $slugs[] = 'property_price';
                                 $slider_price_position = $counter;
                             } else {
                                 $string = wpestate_limit45(sanitize_title($adv_search_label[$key]));
                                 $slug = sanitize_key($string);
                                 $slugs[] = $slug;
                             }
                         }
                     }
                 }
             }
         }
         foreach ($adv_search_how as $key => $search_field) {
             $hows[] = $adv_search_how[$key];
         }
     }
     /////////////////////////////////////////////////////////////////////////////////////////////////////////
     // load the css files
     /////////////////////////////////////////////////////////////////////////////////////////////////////////
     wp_enqueue_style('wpestate_bootstrap', get_template_directory_uri() . '/css/bootstrap.css', array(), '1.0', 'all');
     wp_enqueue_style('wpestate_bootstrap-theme', get_template_directory_uri() . '/css/bootstrap-theme.css', array(), '1.0', 'all');
     wp_enqueue_style('wpestate_style', get_stylesheet_uri(), array(), '1.0', 'all');
     wp_enqueue_style('wpestate_media', get_template_directory_uri() . '/css/my_media.css', array(), '1.0', 'all');
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////
     // load the general js files
     /////////////////////////////////////////////////////////////////////////////////////////////////////////
     wp_enqueue_script("jquery");
     wp_enqueue_script("jquery-ui-slider");
     wp_enqueue_script("jquery-ui-datepicker");
     wp_enqueue_script("jquery-ui-autocomplete");
     if (is_page_template('user-dashboard-profile.php')) {
         //   wp_enqueue_script('plupload-handlers');
     }
     wp_enqueue_script('wpestate_bootstrap', trailingslashit(get_template_directory_uri()) . '/js/bootstrap.min.js', array(), '1.0', false);
     wp_enqueue_script('wpestate_viewport', trailingslashit(get_template_directory_uri()) . '/js/ jquery.viewport.mini.js', array(), '1.0', false);
     wp_enqueue_script('wpestate_modernizr', trailingslashit(get_template_directory_uri()) . '/js/modernizr.custom.62456.js', array(), '1.0', false);
     wp_enqueue_script('wpestate_jquery.fancybox.pack', trailingslashit(get_template_directory_uri()) . '/js/jquery.fancybox.pack.js', array('jquery'), '1.0', true);
     wp_enqueue_script('wpestate_jquery.fancybox-thumbs', trailingslashit(get_template_directory_uri()) . '/js/jquery.fancybox-thumbs.js', array('jquery'), '1.0', true);
     wp_enqueue_script('wpestate_jquery.placeholders', trailingslashit(get_template_directory_uri()) . '/js/placeholders.min.js', array('jquery'), '1.0', true);
     wp_enqueue_script('wpestate_dense', trailingslashit(get_template_directory_uri()) . '/js/dense.js', array('jquery'), '1.0', true);
     wp_enqueue_script('wpestate_touch-punch', trailingslashit(get_template_directory_uri()) . '/js/jquery.ui.touch-punch.min.js', array('jquery'), '1.0', true);
     wp_enqueue_script('wpestate_jquery.lazyloadxt.min', trailingslashit(get_template_directory_uri()) . '/js/jquery.lazyload.min.js', array('jquery'), '1.0', true);
     wp_enqueue_style('wpestate_jquery.ui.theme', trailingslashit(get_template_directory_uri()) . '/css/jquery-ui.min.css');
     if (!is_tax() && get_post_type() === 'estate_property') {
         wp_enqueue_script('wpestate_jquery.fancybox.pack', trailingslashit(get_template_directory_uri()) . '/js/jquery.fancybox.pack.js', array('jquery'), '1.0', true);
         wp_enqueue_script('wpestate_jquery.fancybox-thumbs', trailingslashit(get_template_directory_uri()) . '/js/jquery.fancybox-thumbs.js', array('jquery'), '1.0', true);
         wp_enqueue_style('wpestate_fancybox', trailingslashit(get_template_directory_uri()) . '/css/jquery.fancybox.css', array(), '1.0', 'all');
     }
     $date_lang_status = esc_html(get_option('wp_estate_date_lang', ''));
     if ($date_lang_status != 'xx') {
         $handle = "datepicker-" . $date_lang_status;
         $name = "datepicker-" . $date_lang_status . ".js";
         wp_enqueue_script($handle, trailingslashit(get_template_directory_uri()) . '/js/i18n/' . $name, array('jquery'), '1.0', true);
     }
     $use_generated_pins = 0;
     $load_extra = 0;
     $post_type = get_post_type();
     if (is_page_template('advanced_search_results.php') || is_page_template('property_list_half.php') || is_tax() || $post_type == 'estate_agent') {
         // search results -> pins are added  from template
         $use_generated_pins = 1;
         $json_string = array();
         $json_string = json_encode($json_string);
     } else {
         // google maps pins
         if (get_option('wp_estate_readsys', '') == 'yes') {
             $path = trailingslashit(get_template_directory_uri()) . '/pins.txt';
             $request = wp_remote_get($path);
             $json_string = wp_remote_retrieve_body($request);
         } else {
             $json_string = wpestate_listing_pins();
         }
     }
     /////////////////////////////////////////////////////////////////////////////////////////////////////////
     // load the Google Maps js files
     /////////////////////////////////////////////////////////////////////////////////////////////////////////
     $show_g_search_status = esc_html(get_option('wp_estate_show_g_search', ''));
     if (esc_html(get_option('wp_estate_ssl_map', '')) == 'yes') {
         wp_enqueue_script('wpestate_googlemap', 'https://maps-api-ssl.google.com/maps/api/js?libraries=places&amp;sensor=true&amp;key=' . esc_html(get_option('wp_estate_api_key', '')), array('jquery'), '1.0', false);
     } else {
         wp_enqueue_script('wpestate_googlemap', 'http://maps.googleapis.com/maps/api/js?libraries=places&amp;sensor=true&amp;key=' . esc_html(get_option('wp_estate_api_key', '')), array('jquery'), '1.0', false);
     }
     wp_enqueue_script('wpestate_infobox', trailingslashit(get_template_directory_uri()) . '/js/infobox.js', array('jquery'), '1.0', true);
     $pin_images = wpestate_pin_images();
     $geolocation_radius = esc_html(get_option('wp_estate_geolocation_radius', ''));
     if ($geolocation_radius == '') {
         $geolocation_radius = 1000;
     }
     $pin_cluster_status = esc_html(get_option('wp_estate_pin_cluster', ''));
     $zoom_cluster = esc_html(get_option('wp_estate_zoom_cluster ', ''));
     $show_adv_search = esc_html(get_option('wp_estate_show_adv_search_map_close', ''));
     if (isset($post->ID)) {
         $page_lat = wpestate_get_page_lat($post->ID);
         $page_long = wpestate_get_page_long($post->ID);
         $page_custom_zoom = wpestate_get_page_zoom($post->ID);
         $page_custom_zoom_prop = get_post_meta($post->ID, 'page_custom_zoom', true);
         $closed_height = wpestate_get_current_map_height($post->ID);
         $open_height = wpestate_get_map_open_height($post->ID);
         $open_close_status = wpestate_get_map_open_close_status($post->ID);
     } else {
         $page_lat = esc_html(get_option('wp_estate_general_latitude', ''));
         $page_long = esc_html(get_option('wp_estate_general_longitude', ''));
         $page_custom_zoom = esc_html(get_option('wp_estate_default_map_zoom', ''));
         $page_custom_zoom_prop = 15;
         $closed_height = intval(get_option('wp_estate_min_height', ''));
         $open_height = get_option('wp_estate_max_height', '');
         $open_close_status = esc_html(get_option('wp_estate_keep_min', ''));
     }
     if (get_post_type() === 'estate_property' && !is_tax() && !is_search() && !is_tag()) {
         $load_extra = 1;
         $google_camera_angle = intval(esc_html(get_post_meta($post->ID, 'google_camera_angle', true)));
         $header_type = get_post_meta($post->ID, 'header_type', true);
         $global_header_type = get_option('wp_estate_header_type', '');
         $small_map = 0;
         if ($header_type == 0) {
             // global
             if ($global_header_type != 4) {
                 $small_map = 1;
             }
         } else {
             if ($header_type != 5) {
                 $small_map = 1;
             }
         }
         $single_json_string = wpestate_single_listing_pins($post->ID);
         wp_enqueue_script('wpestate_googlecode_property', trailingslashit(get_template_directory_uri()) . '/js/google_js/google_map_code_listing.js', array('jquery'), '1.0', true);
         wp_localize_script('wpestate_googlecode_property', 'googlecode_property_vars', array('general_latitude' => esc_html(get_option('wp_estate_general_latitude', '')), 'general_longitude' => esc_html(get_option('wp_estate_general_longitude', '')), 'path' => trailingslashit(get_template_directory_uri()) . '/css/css-images', 'markers' => $json_string, 'single_marker' => $single_json_string, 'single_marker_id' => $post->ID, 'camera_angle' => $google_camera_angle, 'idx_status' => $use_idx_plugins, 'page_custom_zoom' => $page_custom_zoom_prop, 'current_id' => $post->ID, 'generated_pins' => 0, 'small_map' => $small_map));
     } else {
         if (is_page_template('contact_page.php')) {
             $load_extra = 1;
             if ($custom_image == '') {
                 wp_enqueue_script('wpestate_googlecode_contact', trailingslashit(get_template_directory_uri()) . '/js/google_js/google_map_code_contact.js', array('jquery'), '1.0', true);
                 $hq_latitude = esc_html(get_option('wp_estate_hq_latitude', ''));
                 $hq_longitude = esc_html(get_option('wp_estate_hq_longitude', ''));
                 if ($hq_latitude == '') {
                     $hq_latitude = '40.781711';
                 }
                 if ($hq_longitude == '') {
                     $hq_longitude = '-73.955927';
                 }
                 $json_string = wpestate_contact_pin();
                 wp_localize_script('wpestate_googlecode_contact', 'googlecode_contact_vars', array('hq_latitude' => $hq_latitude, 'hq_longitude' => $hq_longitude, 'path' => trailingslashit(get_template_directory_uri()) . '/css/css-images', 'markers' => $json_string, 'page_custom_zoom' => $page_custom_zoom, 'address' => esc_html(get_option('wp_estate_co_address', ''))));
             }
         } else {
             if ($header_type == 5 || $global_header_type == 4) {
                 $load_extra = 1;
                 wp_enqueue_script('wpestate_googlecode_regular', trailingslashit(get_template_directory_uri()) . '/js/google_js/google_map_code.js', array('jquery'), '1.0', true);
                 wp_localize_script('wpestate_googlecode_regular', 'googlecode_regular_vars', array('general_latitude' => $page_lat, 'general_longitude' => $page_long, 'path' => trailingslashit(get_template_directory_uri()) . '/css/css-images', 'markers' => $json_string, 'idx_status' => $use_idx_plugins, 'page_custom_zoom' => $page_custom_zoom, 'generated_pins' => $use_generated_pins, 'page_custom_zoom' => $page_custom_zoom));
             }
         }
     }
     $custom_advanced_search = get_option('wp_estate_custom_advanced_search', '');
     $measure_sys = get_option('wp_estate_measure_sys', '');
     if ($load_extra == 1) {
         wp_enqueue_script('wpestate_oms.min', trailingslashit(get_template_directory_uri()) . '/js/google_js/oms.min.js', array('jquery'), '1.0', true);
         wp_enqueue_script('wpestate_mapfunctions', trailingslashit(get_template_directory_uri()) . '/js/google_js/mapfunctions.js', array('jquery'), '1.0', true);
         wp_localize_script('wpestate_mapfunctions', 'mapfunctions_vars', array('path' => trailingslashit(get_template_directory_uri()) . '/css/css-images', 'pin_images' => $pin_images, 'geolocation_radius' => $geolocation_radius, 'adv_search' => $adv_search_type_status, 'in_text' => esc_html__(' in ', 'wpestate'), 'zoom_cluster' => $zoom_cluster, 'user_cluster' => $pin_cluster_status, 'open_close_status' => $open_close_status, 'open_height' => $open_height, 'closed_height' => $closed_height, 'generated_pins' => $use_generated_pins, 'geo_no_pos' => esc_html__('The browser couldn\'t detect your position!', 'wpestate'), 'geo_no_brow' => esc_html__('Geolocation is not supported by this browser.', 'wpestate'), 'geo_message' => esc_html__('m radius', 'wpestate'), 'show_adv_search' => $show_adv_search, 'custom_search' => $custom_advanced_search, 'listing_map' => $listing_map, 'slugs' => $slugs, 'hows' => $hows, 'measure_sys' => $measure_sys, 'close_map' => esc_html__('close map', 'wpestate'), 'show_g_search_status' => $show_g_search_status, 'slider_price' => $show_price_slider, 'slider_price_position' => $slider_price_position, 'map_style' => stripslashes(get_option('wp_estate_map_style', ''))));
         wp_enqueue_script('wpestate_markerclusterer', trailingslashit(get_template_directory_uri()) . '/js/google_js/markerclusterer.js', array('jquery'), '1.0', true);
     }
     // end load extra
     $login_redirect = wpestate_get_dashboard_profile_link();
     $show_adv_search_map_close = esc_html(get_option('wp_estate_show_adv_search_map_close', ''));
     $max_file_size = 100 * 1000 * 1000;
     global $current_user;
     get_currentuserinfo();
     $userID = $current_user->ID;
     $booking_array = array();
     $custom_price = '';
     $default_price = '';
     if (isset($post->ID)) {
         $custom_price = json_encode(get_post_meta($post->ID, 'custom_price' . $post->ID, true));
         $booking_array = json_encode(get_post_meta($post->ID, 'booking_dates', true));
         $default_price = get_post_meta($post->ID, 'property_price', true);
     }
     wp_enqueue_script('wpestate_control', trailingslashit(get_template_directory_uri()) . '/js/control.js', array('jquery'), '1.0', true);
     wp_localize_script('wpestate_control', 'control_vars', array('searchtext' => esc_html__('SEARCH', 'wpestate'), 'searchtext2' => esc_html__('Search here...', 'wpestate'), 'path' => get_template_directory_uri(), 'search_room' => esc_html__('Type Bedrooms No.', 'wpestate'), 'search_bath' => esc_html__('Type Bathrooms No.', 'wpestate'), 'search_min_price' => esc_html__('Type Min. Price', 'wpestate'), 'search_max_price' => esc_html__('Type Max. Price', 'wpestate'), 'contact_name' => esc_html__('Your Name', 'wpestate'), 'contact_email' => esc_html__('Your Email', 'wpestate'), 'contact_phone' => esc_html__('Your Phone', 'wpestate'), 'contact_comment' => esc_html__('Your Message', 'wpestate'), 'zillow_addres' => esc_html__('Your Address', 'wpestate'), 'zillow_city' => esc_html__('Your City', 'wpestate'), 'zillow_state' => esc_html__('Your State Code (ex CA)', 'wpestate'), 'adv_contact_name' => esc_html__('Your Name', 'wpestate'), 'adv_email' => esc_html__('Your Email', 'wpestate'), 'adv_phone' => esc_html__('Your Phone', 'wpestate'), 'adv_comment' => esc_html__('Your Message', 'wpestate'), 'adv_search' => esc_html__('Send Message', 'wpestate'), 'admin_url' => get_admin_url(), 'login_redirect' => $login_redirect, 'login_loading' => esc_html__('Sending user info, please wait...', 'wpestate'), 'street_view_on' => esc_html__('Street View', 'wpestate'), 'street_view_off' => esc_html__('Close Street View', 'wpestate'), 'userid' => $userID, 'show_adv_search_map_close' => $show_adv_search_map_close, 'close_map' => esc_html__('close map', 'wpestate'), 'open_map' => esc_html__('open map', 'wpestate'), 'fullscreen' => esc_html__('Fullscreen', 'wpestate'), 'default' => esc_html__('Default', 'wpestate'), 'addprop' => esc_html__('Please wait while we are processing your submission!', 'wpestate'), 'deleteconfirm' => esc_html__('Are you sure you wish to delete?', 'wpestate'), 'terms_cond' => esc_html__('You must to agree with terms and conditions!', 'wpestate'), 'slider_min' => floatval(get_option('wp_estate_show_slider_min_price', '')), 'slider_max' => floatval(get_option('wp_estate_show_slider_max_price', '')), 'bookconfirmed' => esc_html__('Booking request sent. Please wait for owner\'s confirmation!', 'wpestate'), 'bookdenied' => esc_html__('The selected period is already booked. Please choose a new one!', 'wpestate'), 'to' => esc_html__('to', 'wpestate'), 'curency' => esc_html(get_option('wp_estate_currency_symbol', '')), 'where_curency' => esc_html(get_option('wp_estate_where_currency_symbol', '')), 'price_separator' => esc_html(get_option('wp_estate_prices_th_separator', '')), 'datepick_lang' => esc_html(get_option('wp_estate_date_lang', '')), 'custom_price' => $custom_price, 'booking_array' => $booking_array, 'default_price' => $default_price, 'transparent_logo' => get_option('wp_estate_transparent_logo_image', ''), 'normal_logo' => get_option('wp_estate_logo_image', '')));
     wp_enqueue_script('wpestate_ajaxcalls', trailingslashit(get_template_directory_uri()) . '/js/ajaxcalls.js', array('jquery'), '1.0', true);
     wp_localize_script('wpestate_ajaxcalls', 'ajaxcalls_vars', array('contact_name' => esc_html__('Your Name', 'wpestate'), 'contact_email' => esc_html__('Your Email', 'wpestate'), 'contact_phone' => esc_html__('Your Phone', 'wpestate'), 'contact_comment' => esc_html__('Your Message', 'wpestate'), 'adv_contact_name' => esc_html__('Your Name', 'wpestate'), 'adv_email' => esc_html__('Your Email', 'wpestate'), 'adv_phone' => esc_html__('Your Phone', 'wpestate'), 'adv_comment' => esc_html__('Your Message', 'wpestate'), 'adv_search' => esc_html__('Send Message', 'wpestate'), 'admin_url' => get_admin_url(), 'login_redirect' => $login_redirect, 'login_loading' => esc_html__('Sending user info, please wait...', 'wpestate'), 'userid' => $userID, 'prop_featured' => esc_html__('Property is featured', 'wpestate'), 'no_prop_featured' => esc_html__('You have used all the "Featured" listings in your package.', 'wpestate'), 'favorite' => esc_html__('Favorite', 'wpestate') . '<i class="fa fa-heart"></i>', 'add_favorite' => esc_html__('Add to Favorites', 'wpestate'), 'remove_favorite' => esc_html__('remove from favorites', 'wpestate'), 'add_favorite_unit' => esc_html__('add to favorites', 'wpestate'), 'saving' => esc_html__('saving..', 'wpestate'), 'sending' => esc_html__('sending message..', 'wpestate'), 'reserve' => esc_html__('Reserve Period', 'wpestate'), 'paypal' => esc_html__('Connecting to Paypal! Please wait...', 'wpestate'), 'stripecancel' => esc_html__('subscription will be canceled at the end of the current period', 'wpestate')));
     if (is_page_template('user_dashboard_edit_listing.php') || is_page_template('user_dashboard_add_step1.php')) {
         $page_lat = esc_html(get_option('wp_estate_general_latitude', ''));
         $page_long = esc_html(get_option('wp_estate_general_longitude', ''));
         wp_enqueue_script('wpestate_google_map_submit', trailingslashit(get_template_directory_uri()) . '/js/google_js/google_map_submit.js', array('jquery'), '1.0', true);
         wp_localize_script('wpestate_google_map_submit', 'google_map_submit_vars', array('general_latitude' => $page_lat, 'general_longitude' => $page_long, 'geo_fails' => esc_html__('Geolocation was not successful for the following reason:', 'wpestate')));
     }
     if (is_page_template('user_dashboard_edit_listing.php') || is_page_template('user_dashboard_add_step1.php') || 'estate_property' == get_post_type()) {
         $custom_fields = get_option('wp_estate_custom_fields', true);
         $tranport_custom_array = array();
         $i = 0;
         if (!empty($custom_fields)) {
             while ($i < count($custom_fields)) {
                 $name = $custom_fields[$i][0];
                 $label = $custom_fields[$i][1];
                 $type = $custom_fields[$i][2];
                 $slug = str_replace(' ', '_', $name);
                 $slug = wpestate_limit45(sanitize_title($name));
                 $slug = sanitize_key($slug);
                 $i++;
                 $tranport_custom_array[] = $slug;
             }
         }
         $feature_list_array = array();
         $feature_list = esc_html(get_option('wp_estate_feature_list'));
         $feature_list_array = explode(',', $feature_list);
         $moving_array_amm = array();
         foreach ($feature_list_array as $key => $value) {
             $post_var_name = str_replace(' ', '_', trim($value));
             $post_var_name = wpestate_limit45(sanitize_title($post_var_name));
             $post_var_name = sanitize_key($post_var_name);
             $moving_array_amm[] = $post_var_name;
         }
         wp_enqueue_script('wpestate_ajaxcalls_add', trailingslashit(get_template_directory_uri()) . '/js/ajaxcalls_add.js', array('jquery'), '1.0', true);
         wp_localize_script('wpestate_ajaxcalls_add', 'ajaxcalls_add_vars', array('admin_url' => get_admin_url(), 'tranport_custom_array' => json_encode($tranport_custom_array), 'transport_custom_array_amm' => json_encode($moving_array_amm)));
     }
     if (is_user_logged_in()) {
         $logged_in = "yes";
     } else {
         $logged_in = "no";
     }
     if ('estate_property' == get_post_type() || 'estate_agent' == get_post_type()) {
         wp_enqueue_script('wpestate_property', trailingslashit(get_template_directory_uri()) . '/js/property.js', array('jquery'), '1.0', true);
         wp_localize_script('wpestate_property', 'property_vars', array('plsfill' => esc_html__('Please fill all the forms:', 'wpestate'), 'sending' => esc_html__('Sending Request...', 'wpestate'), 'logged_in' => $logged_in, 'notlog' => esc_html__('You need to log in order to book a listing!', 'wpestate'), 'viewless' => esc_html__('View less', 'wpestate'), 'viewmore' => esc_html__('View more', 'wpestate')));
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     ///////file upload ajax - profile and user dashboard
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     if (is_page_template('user_dashboard_profile.php') || is_page_template('user_dashboard_edit_listing.php')) {
         wp_enqueue_script('ajax-upload', trailingslashit(get_template_directory_uri()) . '/js/ajax-upload.js', array('jquery', 'plupload-handlers'), '1.0', true);
         wp_localize_script('ajax-upload', 'ajax_vars', array('ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('aaiu_upload'), 'remove' => wp_create_nonce('aaiu_remove'), 'number' => 1, 'upload_enabled' => true, 'path' => trailingslashit(get_template_directory_uri()), 'confirmMsg' => esc_html__('Are you sure you want to delete this?', 'wpestate'), 'plupload' => array('runtimes' => 'html5,flash,html4', 'browse_button' => 'aaiu-uploader', 'container' => 'aaiu-upload-container', 'file_data_name' => 'aaiu_upload_file', 'max_file_size' => $max_file_size . 'b', 'url' => admin_url('admin-ajax.php') . '?action=wpestate_me_upload&nonce=' . wp_create_nonce('aaiu_allow'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'filters' => array(array('title' => esc_html__('Allowed Files', 'wpestate'), 'extensions' => "jpeg,jpg,gif,png,pdf")), 'multipart' => true, 'urlstream_upload' => true)));
     }
     if (is_singular() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
     if (get_post_type() === 'estate_property' && !is_tax()) {
         wp_enqueue_script('wpestate_property', trailingslashit(get_template_directory_uri()) . '/js/property.js', array('jquery'), '1.0', true);
     }
     $protocol = is_ssl() ? 'https' : 'http';
     $general_font = esc_html(get_option('wp_estate_general_font', ''));
     $headings_font_subset = esc_html(get_option('wp_estate_headings_font_subset', ''));
     if ($headings_font_subset != '') {
         $headings_font_subset = '&amp;subset=' . $headings_font_subset;
     }
     // embed custom fonts from admin
     if ($general_font && $general_font != 'x') {
         $general_font = str_replace(' ', '+', $general_font);
         wp_enqueue_style('wpestate-custom-font', "{$protocol}://fonts.googleapis.com/css?family={$general_font}:300,400,700,900{$headings_font_subset}");
     } else {
         wp_enqueue_style('wpestate-railway', "{$protocol}://fonts.googleapis.com/css?family=Raleway:500,600,400,700,800&amp;subset=latin,latin-ext");
         wp_enqueue_style('wpestate-opensans', "{$protocol}://fonts.googleapis.com/css?family=Open+Sans:400,600,300&amp;subset=latin,latin-ext");
     }
     $headings_font = esc_html(get_option('wp_estate_headings_font', ''));
     if ($headings_font && $headings_font != 'x') {
         $headings_font = str_replace(' ', '+', $headings_font);
         wp_enqueue_style('wpestate-custom-secondary-font', "{$protocol}://fonts.googleapis.com/css?family={$headings_font}:400,500,300");
     }
     wp_enqueue_style('wpestate_font-awesome.min', trailingslashit(get_template_directory_uri()) . '/css/fontawesome/css/font-awesome.min.css');
     if (!is_search() && !is_404() && !is_tax() && !is_category() && !is_tag()) {
         if (wpestate_check_if_admin_page($post->ID)) {
             $wp_estate_book_down = get_option('wp_estate_book_down', '');
             if ($wp_estate_book_down == '') {
                 $wp_estate_book_down = 10;
             }
             wp_enqueue_script('wpestate_dashboard-control', trailingslashit(get_template_directory_uri()) . '/js/dashboard-control.js', array('jquery'), '1.0', true);
             wp_localize_script('wpestate_dashboard-control', 'dashboard_vars', array('deleting' => esc_html__('deleting...', 'wpestate'), 'searchtext2' => esc_html__('Search here...', 'wpestate'), 'currency_symbol' => esc_html(get_option('wp_estate_submission_curency', '')), 'where_currency_symbol' => esc_html(get_option('wp_estate_where_currency_symbol', '')), 'book_down' => $wp_estate_book_down, 'discount' => esc_html__('Discount', 'wpestate'), 'delete_inv' => esc_html__('Delete Invoice', 'wpestate'), 'issue_inv' => esc_html__('Invoice Issued', 'wpestate'), 'confirmed' => esc_html__('Confirmed', 'wpestate'), 'issue_inv1' => esc_html__('Issue invoice', 'wpestate'), 'sending' => esc_html__('sending message...', 'wpestate'), 'plsfill' => esc_html__('Please fill in all the fields', 'wpestate'), 'datesb' => esc_html__('Dates are already booked. Please check the calendar for free days!', 'wpestate'), 'datepast' => esc_html__('You cannot select a date in the past! ', 'wpestate'), 'bookingstart' => esc_html__('Start date cannot be greater than end date !', 'wpestate'), 'selectprop' => esc_html__('Please select a property !', 'wpestate'), 'err_title' => esc_html__('Please submit a title !', 'wpestate'), 'err_category' => esc_html__('Please pick a category !', 'wpestate'), 'err_type' => esc_html__('Please pick a typr !', 'wpestate'), 'err_guest' => esc_html__('Please select the guest no !', 'wpestate'), 'err_city' => esc_html__('Please pick a city !', 'wpestate'), 'sending' => esc_html__('sending...', 'wpestate')));
         }
     }
 }