function es_print_scripts()
{
    global $wpdb;
    $sql = 'SELECT prop_address FROM ' . $wpdb->prefix . 'estatik_properties WHERE prop_pub_unpub = 1 order by prop_id desc';
    $es_addresses = $wpdb->get_results($sql);
    echo "<script type='text/javascript'>\n";
    $es_settings = es_front_settings();
    if (is_singular('properties')) {
        echo "jQuery(window).load(function(e) { \r\r\n\t\t\t  \t \r\r\n\t\t\t\tvar navPos = parseInt(jQuery('.es_prop_single_tabs').offset().top);\r\r\n\t\t\t\tvar navPosLeft = parseInt(jQuery('.es_prop_single_tabs').offset().left);\r\r\n\t\t\t\tvar navWidth = parseInt(jQuery('.es_prop_single_tabs').width());\r\r\n\t\t\t\tjQuery(window).scroll(function(e) { \r\r\n\t\t\t\t\tif(jQuery(this).scrollTop()>=navPos){\r\r\n\t\t\t\t\t\tjQuery('.es_prop_single_tabs').addClass('fixed');\r\r\n\t\t\t\t\t\tjQuery('.es_prop_single_tabs').css({'left':navPosLeft+'px','width':navWidth+'px'});\t\t\r\r\n\t\t\t\t\t} else {\r\r\n\t\t\t\t\t\tjQuery('.es_prop_single_tabs').removeClass('fixed');\r\r\n\t\t\t\t\t\tjQuery('.es_prop_single_tabs').css({'left':'0px','width':'auto'});\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t});\r\r\n\t\t\t  });";
    }
    echo "  jQuery(document).ready(function(e) { \r\r\n\t\t\t\t\tvar pagerWidth = jQuery('#es_prop_single_pager_outer').width()/" . $es_settings->prop_singleview_photo_thumb_width . ";\r\r\n\t\t\t\t\tjQuery('.es_prop_single_pics').bxSlider({\r\r\n\t\t\t\t\t  slideMargin: 0,\r\r\n\t\t\t\t\t  controls: false,\r\r\n\t\t\t\t\t  infiniteLoop: false,\r\r\n\t\t\t\t\t  maxSlides: 1,\r\r\n\t\t\t\t\t  pagerCustom: '.es_prop_single_pager'\r\r\n\t\t\t\t\t});\r\r\n\t\t\t\t\tjQuery('.es_prop_single_pager').bxSlider({\r\r\n\t\t\t\t\t  slideWidth: " . $es_settings->prop_singleview_photo_thumb_width . ",\r\r\n\t\t\t\t\t  slideMargin: 10,\r\r\n\t\t\t\t\t  pager: false,\r\r\n\t\t\t\t\t  infiniteLoop: false,\r\r\n\t\t\t\t\t  minSlides: parseInt(pagerWidth),\r\r\n\t\t\t\t\t  maxSlides: parseInt(pagerWidth),\r\r\n\t\t\t\t\t});\r\r\n\t\t\t\t\tjQuery('.es_prop_single_pager li a').each(function(index, element) {\r\r\n\t\t\t\t\t\tjQuery(this).attr('data-slide-index',index);\r\r\n\t\t\t\t\t});\r\r\n\t\t\t\t});";
    echo "jQuery(function() {\r\r\n\t\t\t\tvar availableTags = [";
    if (!empty($es_addresses)) {
        foreach ($es_addresses as $es_addres) {
            echo "'" . $es_addres->prop_address . "',";
        }
    }
    echo "];\r\r\n\t\t\t\tjQuery( '.es_address_auto' ).autocomplete({\r\r\n\t\t\t\t\tsource: availableTags\r\r\n\t\t\t\t});\r\r\n\t\t\t});\r\r\n\t\t";
    echo "\n</script>";
}
function get_images($listing_id)
{
    global $wpdb;
    $image_sql = "SELECT prop_meta_value FROM {$wpdb->prefix}estatik_properties_meta \r\r\n                    WHERE prop_id={$listing_id}  AND prop_meta_key = 'images'";
    unset($uploaded_images, $image_url);
    $uploaded_images = $wpdb->get_row($image_sql);
    $uploaded_images_count = "0";
    if (!empty($uploaded_images)) {
        $upload_image_data = unserialize($uploaded_images->prop_meta_value);
        $uploaded_images_count = count($upload_image_data);
    }
    if (!empty($uploaded_images) && !empty($upload_image_data)) {
        $upload_dir = wp_upload_dir();
        $es_settings = es_front_settings();
        $list_image_name = explode("/", $upload_image_data[0]);
        $list_image_name = end($list_image_name);
        $list_image_path = str_replace($list_image_name, "", $upload_image_data[0]);
        return array("{$upload_dir['baseurl']}{$list_image_path}{$list_image_name}", $uploaded_images_count);
    }
    return array(get_template_directory_uri() . "/images/placeholder_banner.png", 0);
}
function es_prop_media_images()
{
    $es_prop_id = sanitize_text_field($_GET['es_prop_id']);
    $uploadedfile = $_FILES['es_media_images'];
    $upload_dir = wp_upload_dir();
    $save_image_array = array();
    $es_settings = es_front_settings();
    for ($i = 0; $i < count($uploadedfile['name']); $i++) {
        $es_extention = explode(".", $uploadedfile['name'][$i]);
        $es_extention = strtolower(end($es_extention));
        if ($es_extention == "zip") {
            $file_name = time() . "_" . $uploadedfile['name'][$i];
            $sourcePath = $uploadedfile['tmp_name'][$i];
            $targetPath = $upload_dir['path'] . "/" . $file_name;
            move_uploaded_file($sourcePath, $targetPath);
            $zip = new ZipArchive();
            $zip = zip_open($targetPath);
            if ($zip) {
                while ($zip_entry = zip_read($zip)) {
                    $save_image_array[] = $upload_dir['subdir'] . "/" . zip_entry_name($zip_entry);
                }
            }
            $zip = new ZipArchive();
            $res = $zip->open($targetPath);
            $zip->extractTo($upload_dir['path']);
            $zip->close();
            @unlink($targetPath);
        } else {
            if ($_FILES["es_media_images"]["error"][$i] == 0) {
                $image_name = time() . "_" . $_FILES['es_media_images']['name'][$i];
                $sourcePath = $_FILES['es_media_images']['tmp_name'][$i];
                $targetPath = $upload_dir['path'] . "/" . $image_name;
                move_uploaded_file($sourcePath, $targetPath);
                es_crop($targetPath, $upload_dir['path'] . "/list_" . $image_name, $es_settings->prop_listview_list_width, $es_settings->prop_listview_list_height);
                es_crop($targetPath, $upload_dir['path'] . "/2column_" . $image_name, $es_settings->prop_listview_2column_width, $es_settings->prop_listview_2column_height);
                es_crop($targetPath, $upload_dir['path'] . "/table_" . $image_name, $es_settings->prop_listview_table_width, $es_settings->prop_listview_table_height);
                es_crop($targetPath, $upload_dir['path'] . "/single_lr_" . $image_name, $es_settings->prop_singleview_photo_lr_width, $es_settings->prop_singleview_photo_lr_height);
                es_crop($targetPath, $upload_dir['path'] . "/single_center_" . $image_name, $es_settings->prop_singleview_photo_center_width, $es_settings->prop_singleview_photo_center_height);
                es_crop($targetPath, $upload_dir['path'] . "/single_thumb_" . $image_name, $es_settings->prop_singleview_photo_thumb_width, $es_settings->prop_singleview_photo_thumb_height);
                $save_image_array[] = $upload_dir['subdir'] . "/" . $image_name;
            }
        }
    }
    global $wpdb;
    $old_images = "";
    $prop_images = $wpdb->get_row('SELECT prop_meta_value FROM ' . $wpdb->prefix . 'estatik_properties_meta WHERE prop_id = ' . $es_prop_id . " and prop_meta_key = 'images'");
    if (!empty($prop_images)) {
        $old_images = $prop_images->prop_meta_value;
    }
    $upload_image_data = array();
    if ($old_images != "") {
        $old_image_data = unserialize($old_images);
        $upload_image_data = array_merge($old_image_data, $save_image_array);
    } else {
        $upload_image_data = $save_image_array;
    }
    $wpdb->query('delete from ' . $wpdb->prefix . 'estatik_properties_meta WHERE prop_id = ' . $es_prop_id . " and prop_meta_key = 'images'");
    $wpdb->insert($wpdb->prefix . 'estatik_properties_meta', array('prop_id' => $es_prop_id, 'prop_meta_key' => 'images', 'prop_meta_value' => serialize($upload_image_data)));
    include "es_property_temps/es_property_images.php";
    die;
}
<?php 
$es_settings = es_front_settings();
?>


<?php 
if (is_search() || isset($_GET['s'])) {
    ?>

    <div class="es_success"><?php 
    _e("Your search results.", 'es-plugin');
    ?>
</div>
<?php 
}
?>



<div class="es_my_listing clearfix">
    <ul>
        <?php 
global $wpdb;
$address = isset($_GET['address']) ? sanitize_text_field($_GET['address']) : "";
$country = isset($_GET['country']) ? sanitize_text_field($_GET['country']) : "";
$state = isset($_GET['state']) ? sanitize_text_field($_GET['state']) : "";
$city = isset($_GET['city']) ? sanitize_text_field($_GET['city']) : "";
$key_words = isset($_GET['key_words']) ? sanitize_text_field($_GET['key_words']) : "";
$agent = isset($_GET['agent']) ? sanitize_text_field($_GET['agent']) : "";
$type = isset($_GET['type']) ? sanitize_text_field($_GET['type']) : "";
$category = isset($_GET['category']) ? sanitize_text_field($_GET['category']) : "";