Ejemplo n.º 1
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;
    }
<?php

global $wpdb;
$adv_submit = wpestate_get_adv_search_link();
$guest_list = wpestate_get_guest_dropdown();
//  show cities or areas that are empty ?
$args = wpestate_get_select_arguments();
$action_select_list = wpestate_get_action_select_list($args);
$categ_select_list = wpestate_get_category_select_list($args);
$min_price_slider = floatval(get_option('wp_estate_show_slider_min_price', ''));
$max_price_slider = floatval(get_option('wp_estate_show_slider_max_price', ''));
$where_currency = esc_html(get_option('wp_estate_where_currency_symbol', ''));
$currency = esc_html(get_option('wp_estate_currency_symbol', ''));
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;
}
$neighbour = $wpdb->get_results('SELECT * FROM wp_izft_terms AS term INNER JOIN wp_izft_term_taxonomy AS tax ON tax.term_id = term.term_id AND tax.taxonomy = "property_area"', OBJECT);
?>

<div id="advanced_search_map_list">
    <div class="advanced_search_map_list_container">


        <div class="col-md-6 map_icon">
            <input type="text"   id="advanced_area" class="form-control search_location_city" name="advanced_area" placeholder="<?php 
esc_html_e('Where do you want to go ?', 'wpestate');
?>
" value="<?php 
if (isset($_GET['advanced_area'])) {
Ejemplo n.º 3
0
 function widget($args, $instance)
 {
     extract($args);
     $display = '';
     $select_tax_action_terms = '';
     $select_tax_category_terms = '';
     $title = apply_filters('widget_title', $instance['title']);
     print $before_widget;
     if ($title) {
         print $before_title . $title . $after_title;
     } else {
         print '<div class="widget-title-sidebar_blank"></div>';
     }
     $adv_submit = wpestate_get_adv_search_link();
     //  show cities or areas that are empty ?
     $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);
     $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', ''));
     $price_slider_label = wpestate_show_price_label_slider($min_price_slider, $max_price_slider, $currency, $where_currency);
     print '<form id="widget_search" method="get"   action="' . $adv_submit . '" >';
     print '
             <div class="map_icon">
                 <input type="text" id="search_location_filter_widget" class="form-control search_location_city" name="search_location" placeholder="' . esc_html__('Where are you going?', 'wpestate') . '" value="" autocomplete="off">
                 <input type="hidden" id="advanced_city_widget"   class="form-control" name="advanced_city" data-value=""   value="" >              
                 <input type="hidden" id="advanced_area_widget"   class="form-control" name="advanced_area"   data-value="" value="" >              
                 <input type="hidden" id="advanced_country_widget"   class="form-control" name="advanced_country"   data-value="" value="" >              
     
             </div>
             
             <div class="has_calendar calendar_icon ">
                 <input type="text" id="checkinwidget" class="form-control " name="check_in" placeholder="' . esc_html__('Check in', 'wpestate') . '">       
             </div>
             
             <div class="has_calendar calendar_icon ">
                 <input type="text" id="checkoutwidget" disabled class="form-control " name="check_out" placeholder="' . esc_html__('Check Out', 'wpestate') . '">
             </div>
             
             <div class="dropdown form-control guest_form">
                 <div data-toggle="dropdown" id="guest_no_widget" 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_wid" value="">
                 <ul class="dropdown-menu filter_menu" role="menu" aria-labelledby="guest_no_wid">' . wpestate_get_guest_dropdown() . '
                 </ul>
             </div>
             
   
            
             <div class="adv_search_widget">
                 <p>
                     <label>' . esc_html__('Price range:', 'wpestate') . '</label>
                     <span id="amount_wd"  style="border:0;">' . $price_slider_label . '</span>
                 </p>
                 <div id="slider_price_widget"></div>
                 <input type="hidden" id="price_low_widget"  name="price_low"  value="' . $min_price_slider . '"/>
                 <input type="hidden" id="price_max_widget"  name="price_max"  value="' . $max_price_slider . '"/>
             </div>';
     print '<button class="wpb_btn-info wpb_regularsize wpestate_vc_button  vc_button" id="advanced_submit_widget">' . esc_html__('Search', 'wpestate') . '</button>
             </form>  
             ';
     print $after_widget;
 }