示例#1
0
 /**
  * Exports all properties to CSV file
  */
 public function maybe_export_properties_to_scv()
 {
     if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpp_export_to_scv' && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'export_properties_to_scv')) {
         // output headers so that the file is downloaded rather than displayed
         header('Content-Type: text/csv; charset=utf-8');
         header('Content-Disposition: attachment; filename=properties.csv');
         $headings = array('ID' => __('ID', ud_get_wp_property('domain')), 'post_title' => __('Title', ud_get_wp_property('domain')), 'post_content' => __('Content', ud_get_wp_property('domain')), 'post_date' => __('Date', ud_get_wp_property('domain')), 'post_modified' => __('Modified Date', ud_get_wp_property('domain')), 'post_parent' => __('Falls Under', ud_get_wp_property('domain')), 'menu_order' => __('Menu Order', ud_get_wp_property('domain')), 'post_author' => __('Author', ud_get_wp_property('domain')), 'property_type_label' => __('Property Type', ud_get_wp_property('domain')));
         $headings = array_merge($headings, (array) ud_get_wp_property('property_stats', array()));
         $headings = array_merge($headings, (array) ud_get_wp_property('property_meta', array()));
         foreach ((array) ud_get_wp_property('geo_type_attributes', array()) as $k) {
             $headings[$k] = \WPP_F::de_slug($k);
         }
         $headings['latitude'] = __('Latitude', ud_get_wp_property('domain'));
         $headings['longitude'] = __('Longitude', ud_get_wp_property('domain'));
         $headings['permalink'] = __('Permalink', ud_get_wp_property('domain'));
         // create a file pointer connected to the output stream
         $output = fopen('php://output', 'w');
         // output the column headings
         fputcsv($output, array_values($headings));
         $ids = \WPP_F::get_properties();
         $keys = array_keys($headings);
         foreach ($ids as $id) {
             $property = Property_Factory::get($id, array('get_children' => 'false', 'load_gallery' => 'false', 'load_thumbnail' => 'true', 'load_parent' => 'false'));
             $data = array();
             foreach ($keys as $k) {
                 $v = isset($property[$k]) ? $property[$k] : '';
                 if (is_array($v)) {
                     $v = implode(',', $v);
                 }
                 switch ($k) {
                     case 'post_content':
                         $v = strip_shortcodes($v);
                         $v = apply_filters('the_content', $v);
                         $v = str_replace(']]>', ']]>', $v);
                         $v = wp_trim_words($v, 55, '...');
                         break;
                     case 'author':
                         $v = get_the_author_meta('display_name', $v);
                         break;
                 }
                 $data[$k] = $v;
             }
             fputcsv($output, $data);
         }
         exit;
     }
 }
    /**
     * Widget body
     *
     * @param array $args
     * @param array $instance
     */
    function widget($args, $instance)
    {
        global $post, $wp_properties, $property;
        $before_widget = '';
        $before_title = '';
        $after_title = '';
        $after_widget = '';
        extract($args);
        $instance = apply_filters('OtherPropertiesWidget', $instance);
        $title = isset($instance['title']) ? $instance['title'] : '';
        $show_title = isset($instance['show_title']) ? $instance['show_title'] : false;
        $image_type = isset($instance['image_type']) ? $instance['image_type'] : false;
        $hide_image = isset($instance['hide_image']) ? $instance['hide_image'] : false;
        $stats = isset($instance['stats']) ? $instance['stats'] : false;
        $address_format = isset($instance['address_format']) ? $instance['address_format'] : '';
        $amount_items = !empty($instance['amount_items']) ? $instance['amount_items'] : 0;
        $show_properties_of_type = isset($instance['show_properties_of_type']) ? $instance['show_properties_of_type'] : false;
        $shuffle_order = isset($instance['shuffle_order']) ? $instance['shuffle_order'] : false;
        if (!isset($post->ID) || $post->post_parent == 0 && $show_properties_of_type != 'on') {
            return;
        }
        $this_property = (array) $property;
        if ($post->post_parent) {
            $properties = get_posts(array('numberposts' => $amount_items, 'post_type' => 'property', 'post_status' => 'publish', 'post_parent' => $post->post_parent, 'exclude' => $post->ID));
        } else {
            $properties = WPP_F::get_properties("property_type={$this_property['property_type']}&pagi=0--{$amount_items}");
        }
        if (empty($properties)) {
            return;
        }
        $html[] = $before_widget;
        $html[] = "<div class='wpp_other_properties_widget'>";
        if ($title) {
            $html[] = $before_title . $title . $after_title;
        }
        if ($shuffle_order == 'on') {
            shuffle($properties);
        }
        ob_start();
        foreach ($properties as $single) {
            $property_id = is_object($single) ? $single->ID : $single;
            $this_property = WPP_F::get_property($property_id, 'return_object=true');
            $this_property = prepare_property_for_display($this_property);
            $image = isset($this_property->featured_image) && !empty($image_type) ? wpp_get_image_link($this_property->featured_image, $image_type, array('return' => 'array')) : false;
            ?>
      <div class="property_widget_block apartment_entry clearfix" style="<?php 
            echo !empty($image['width']) ? 'width: ' . ($image['width'] + 5) . 'px;' : '';
            ?>
">
        <?php 
            if ($hide_image !== 'on' && !empty($image)) {
                ?>
          <a class="sidebar_property_thumbnail thumbnail" href="<?php 
                echo $this_property->permalink;
                ?>
">
            <img width="<?php 
                echo $image['width'];
                ?>
" height="<?php 
                echo $image['height'];
                ?>
" src="<?php 
                echo $image['link'];
                ?>
" alt=""/>
          </a>
        <?php 
            }
            ?>

        <?php 
            if ($show_title == 'on') {
                ?>
          <p class="title"><a
                href="<?php 
                echo $this_property->permalink;
                ?>
"><?php 
                echo $this_property->post_title;
                ?>
</a></p>
        <?php 
            }
            ?>

        <ul class="wpp_widget_attribute_list">
          <?php 
            if (is_array($stats)) {
                foreach ($stats as $stat) {
                    if (!isset($this_property->{$stat})) {
                        continue;
                    }
                    switch (true) {
                        case !empty($wp_properties['configuration']['address_attribute']) && $wp_properties['configuration']['address_attribute'] == $stat:
                            $content = wpp_format_address_attribute($this_property->{$stat}, $this_property, $address_format);
                            break;
                        case $stat == 'property_type':
                            $content = nl2br(apply_filters("wpp_stat_filter_property_type_label", $this_property->property_type_label));
                            break;
                        default:
                            $content = nl2br(apply_filters("wpp_stat_filter_{$stat}", $this_property->{$stat}));
                            break;
                    }
                    if (empty($content)) {
                        continue;
                    }
                    ?>
              <li class="<?php 
                    echo $stat;
                    ?>
">
                <span class="attribute"><?php 
                    echo $wp_properties['property_stats'][$stat];
                    ?>
:</span>
                <span class="value"><?php 
                    echo $content;
                    ?>
</span>
              </li>
            <?php 
                }
            }
            ?>
        </ul>

        <?php 
            if ($instance['enable_more'] == 'on') {
                echo '<p class="more"><a href="' . $this_property->permalink . '" class="btn btn-info">' . __('More', ud_get_wp_property()->domain) . '</a></p>';
            }
            ?>

      </div>

      <?php 
            unset($this_property);
        }
        $html['widget_content'] = ob_get_contents();
        ob_end_clean();
        if ($instance['enable_view_all'] == 'on') {
            $html[] = '<p class="view-all"><a href="' . site_url() . '/' . $wp_properties['configuration']['base_slug'] . '" class="btn btn-large">' . __('View All', ud_get_wp_property()->domain) . '</a></p>';
        }
        $html[] = '</div>';
        $html[] = $after_widget;
        if (!empty($html['widget_content'])) {
            echo implode('', $html);
        }
    }
 /**
  * Displays property overview
  *
  * Performs searching/filtering functions, provides template with $properties file
  * Retirms html content to be displayed after location attribute on property edit page
  *
  * @since 1.081
  *
  * @param string $listing_id Listing ID must be passed
  *
  * @return string $result
  *
  * @uses WPP_F::get_properties()
  *
  */
 public static function render($atts = "")
 {
     global $wp_properties, $wpp_query, $property, $post, $wp_query;
     $_property = $property;
     $wpp_query = array();
     $atts = wp_parse_args($atts, array());
     \WPP_F::force_script_inclusion('jquery-ui-widget');
     \WPP_F::force_script_inclusion('jquery-ui-mouse');
     \WPP_F::force_script_inclusion('jquery-ui-slider');
     \WPP_F::force_script_inclusion('wpp-jquery-address');
     \WPP_F::force_script_inclusion('wpp-jquery-scrollTo');
     \WPP_F::force_script_inclusion('wpp-jquery-fancybox');
     \WPP_F::force_script_inclusion('wp-property-frontend');
     //** Load all queriable attributes **/
     foreach (\WPP_F::get_queryable_keys() as $key) {
         //** This needs to be done because a key has to exist in the $deafult array for shortcode_atts() to load passed value */
         $queryable_keys[$key] = false;
     }
     //** Allow the shorthand of "type" as long as there is not a custom attribute of "type". If "type" does exist as an attribute, then users need to use the full "property_type" query tag. **/
     if (!array_key_exists('type', $queryable_keys) && (is_array($atts) && array_key_exists('type', $atts))) {
         $atts['property_type'] = $atts['type'];
         unset($atts['type']);
     }
     //** Get ALL allowed attributes that may be passed via shortcode (to include property attributes) */
     $defaults['strict_search'] = false;
     $defaults['show_children'] = isset($wp_properties['configuration']['property_overview']['show_children']) ? $wp_properties['configuration']['property_overview']['show_children'] : 'true';
     $defaults['child_properties_title'] = __('Floor plans at location:', ud_get_wp_property()->domain);
     $defaults['fancybox_preview'] = $wp_properties['configuration']['property_overview']['fancybox_preview'];
     $defaults['bottom_pagination_flag'] = isset($wp_properties['configuration']['bottom_insert_pagenation']) && $wp_properties['configuration']['bottom_insert_pagenation'] == 'true' ? true : false;
     $defaults['thumbnail_size'] = $wp_properties['configuration']['property_overview']['thumbnail_size'];
     $defaults['sort_by_text'] = __('Sort By:', ud_get_wp_property()->domain);
     $defaults['sort_by'] = 'post_date';
     $defaults['sort_order'] = 'DESC';
     $defaults['template'] = false;
     $defaults['ajax_call'] = false;
     $defaults['disable_wrapper'] = false;
     $defaults['sorter_type'] = 'buttons';
     $defaults['sorter'] = 'on';
     $defaults['pagination'] = 'on';
     $defaults['pagination_type'] = ud_get_wp_property('configuration.property_overview.pagination_type') ? ud_get_wp_property('configuration.property_overview.pagination_type') : 'slider';
     $defaults['hide_count'] = false;
     $defaults['per_page'] = 10;
     $defaults['starting_row'] = 0;
     $defaults['unique_hash'] = rand(10000, 99900);
     $defaults['detail_button'] = false;
     $defaults['stats'] = '';
     $defaults['class'] = 'wpp_property_overview_shortcode';
     $defaults['in_new_window'] = false;
     $defaults = apply_filters('shortcode_property_overview_allowed_args', $defaults, $atts);
     //* Determine if we should disable sorter */
     if (isset($atts['sorter']) && in_array($atts['sorter'], array('off', 'false'))) {
         $atts['sorter'] = false;
         $atts['sorter_type'] = 'none';
     }
     if (!empty($atts['ajax_call'])) {
         //** If AJAX call then the passed args have all the data we need */
         $wpp_query = $atts;
         //* Fix ajax data. Boolean value false is returned as string 'false'. */
         foreach ($wpp_query as $key => $value) {
             if ($value == 'false') {
                 $wpp_query[$key] = false;
             }
         }
         $wpp_query['ajax_call'] = true;
         //** Everything stays the same except for sort order and page */
         $wpp_query['starting_row'] = ($wpp_query['requested_page'] - 1) * $wpp_query['per_page'];
         //** Figure out current page */
         $wpp_query['current_page'] = $wpp_query['requested_page'];
     } else {
         /** Determine if fancybox style is included */
         \WPP_F::force_style_inclusion('wpp-jquery-fancybox-css');
         //** Merge defaults with passed arguments */
         $wpp_query = shortcode_atts($defaults, $atts);
         $wpp_query['query'] = shortcode_atts($queryable_keys, $atts);
         //** Handle search */
         if (!empty($_REQUEST['wpp_search'])) {
             $wpp_query['query'] = shortcode_atts($wpp_query['query'], $_REQUEST['wpp_search']);
             $wpp_query['query'] = \WPP_F::prepare_search_attributes($wpp_query['query']);
             if (isset($_REQUEST['wpp_search']['sort_by'])) {
                 $wpp_query['sort_by'] = $_REQUEST['wpp_search']['sort_by'];
             }
             if (isset($_REQUEST['wpp_search']['sort_order'])) {
                 $wpp_query['sort_order'] = $_REQUEST['wpp_search']['sort_order'];
             }
             if (isset($_REQUEST['wpp_search']['pagination'])) {
                 $wpp_query['pagination'] = $_REQUEST['wpp_search']['pagination'];
             }
             if (isset($_REQUEST['wpp_search']['per_page'])) {
                 $wpp_query['per_page'] = $_REQUEST['wpp_search']['per_page'];
             }
             if (isset($_REQUEST['wpp_search']['strict_search'])) {
                 $wpp_query['strict_search'] = $_REQUEST['wpp_search']['strict_search'];
             }
         }
     }
     //** Load certain settings into query for get_properties() to use */
     $wpp_query['query']['sort_by'] = $wpp_query['sort_by'];
     $wpp_query['query']['sort_order'] = $wpp_query['sort_order'];
     $wpp_query['query']['pagi'] = $wpp_query['starting_row'] . '--' . $wpp_query['per_page'];
     if (!isset($wpp_query['current_page'])) {
         $wpp_query['current_page'] = $wpp_query['starting_row'] / $wpp_query['per_page'] + 1;
     }
     //** Load settings that are not passed via shortcode atts */
     $wpp_query['sortable_attrs'] = \WPP_F::get_sortable_keys();
     //** Replace dynamic field values */
     //** Detect currently property for conditional in-shortcode usage that will be replaced from values */
     if (isset($post) && is_object($post)) {
         $dynamic_fields['post_id'] = isset($post->ID) ? $post->ID : 0;
         $dynamic_fields['post_parent'] = isset($post->post_parent) ? $post->post_parent : 0;
         $dynamic_fields['property_type'] = isset($post->property_type) ? $post->property_type : false;
         $dynamic_fields = apply_filters('shortcode_property_overview_dynamic_fields', $dynamic_fields);
         if (is_array($dynamic_fields)) {
             foreach ($wpp_query['query'] as $query_key => $query_value) {
                 if (!empty($dynamic_fields[$query_value])) {
                     $wpp_query['query'][$query_key] = $dynamic_fields[$query_value];
                 }
             }
         }
     }
     //** Remove all blank values */
     $wpp_query['query'] = array_filter($wpp_query['query']);
     //echo "<pre>"; print_r( $wpp_query ); echo "</pre>";
     //** We add # to value which says that we don't want to use LIKE in SQL query for searching this value. */
     $required_strict_search = apply_filters('wpp::required_strict_search', array('wpp_agents'));
     $ignored_strict_search_field_types = apply_filters('wpp:ignored_strict_search_field_types', array('range_dropdown', 'range_input'));
     foreach ($wpp_query['query'] as $key => $val) {
         if (!array_key_exists($key, $defaults) && $key != 'property_type') {
             //** Be sure that the attribute exists of parameter is required for strict search */
             if (in_array($wpp_query['strict_search'], array('true', 'on')) && isset($wp_properties['property_stats'][$key]) || in_array($key, $required_strict_search)) {
                 /**
                  * Ignore specific search attribute fields for strict search.
                  * For example, range values must not be included to strict search.
                  * Also, be sure to ignore list of values
                  */
                 if (isset($wp_properties['searchable_attr_fields'][$key]) && in_array($wp_properties['searchable_attr_fields'][$key], (array) $ignored_strict_search_field_types) || substr_count($val, ',') || substr_count($val, '&ndash;') || substr_count($val, '--')) {
                     continue;
                 } elseif (substr_count($val, '-')) {
                     $_val = explode('-', $val);
                     if (count($_val) == 2 && is_numeric($_val[0]) && is_numeric($_val[1])) {
                         continue;
                     }
                 }
                 $wpp_query['query'][$key] = '#' . trim($val, '#') . '#';
             }
         }
     }
     //** Unset this because it gets passed with query (for back-button support) but not used by get_properties() */
     unset($wpp_query['query']['per_page']);
     unset($wpp_query['query']['pagination']);
     unset($wpp_query['query']['requested_page']);
     //** Load the results */
     $wpp_query['properties'] = \WPP_F::get_properties($wpp_query['query'], true);
     //** Calculate number of pages */
     if ($wpp_query['pagination'] == 'on') {
         $wpp_query['pages'] = ceil($wpp_query['properties']['total'] / $wpp_query['per_page']);
     }
     $property_type = isset($wpp_query['query']['property_type']) ? $wpp_query['query']['property_type'] : false;
     if (!empty($property_type) && isset($wp_properties['hidden_attributes'][$property_type])) {
         foreach ((array) $wp_properties['hidden_attributes'][$property_type] as $attr_key) {
             unset($wpp_query['sortable_attrs'][$attr_key]);
         }
     }
     //** Legacy Support - include variables so old templates still work */
     $properties = $wpp_query['properties']['results'];
     $thumbnail_sizes = \WPP_F::image_sizes($wpp_query['thumbnail_size']);
     $child_properties_title = $wpp_query['child_properties_title'];
     $unique = $wpp_query['unique_hash'];
     $thumbnail_size = $wpp_query['thumbnail_size'];
     //* Debugger */
     if (isset($wp_properties['configuration']['developer_mode']) && $wp_properties['configuration']['developer_mode'] == 'true' && !$wpp_query['ajax_call']) {
         echo '<script type="text/javascript">console.log( ' . json_encode($wpp_query) . ' ); </script>';
     }
     ob_start();
     //** Make certain variables available to be used within the single listing page */
     $wpp_overview_shortcode_vars = apply_filters('wpp_overview_shortcode_vars', array('wp_properties' => $wp_properties, 'wpp_query' => $wpp_query));
     //** By merging our extra variables into $wp_query->query_vars they will be extracted in load_template() */
     if (is_array($wpp_overview_shortcode_vars)) {
         $wp_query->query_vars = array_merge($wp_query->query_vars, $wpp_overview_shortcode_vars);
     }
     $template = $wpp_query['template'];
     $fancybox_preview = $wpp_query['fancybox_preview'];
     $show_children = $wpp_query['show_children'];
     $class = $wpp_query['class'];
     $stats = $wpp_query['stats'];
     $in_new_window = !empty($wpp_query['in_new_window']) ? " target=\"_blank\" " : "";
     //** Make query_vars available to emulate WP template loading */
     extract($wp_query->query_vars, EXTR_SKIP);
     //** Try find custom template */
     $template_found = \WPP_F::get_template_part(array("property-overview-{$template}", "property-overview-" . sanitize_key($property_type), "property-overview"), array(ud_get_wp_property()->path('static/views', 'dir')));
     if ($template_found) {
         include $template_found;
     }
     $ob_get_contents = ob_get_contents();
     ob_end_clean();
     $ob_get_contents = apply_filters('shortcode_property_overview_content', $ob_get_contents, $wpp_query);
     // Initialize result (content which will be shown) and open wrap (div) with unique id
     if ($wpp_query['disable_wrapper'] != 'true') {
         $result['top'] = '<div id="wpp_shortcode_' . $wpp_query['unique_hash'] . '" class="wpp_ui ' . $wpp_query['class'] . '">';
     }
     $result['top_pagination'] = self::draw_pagination(array('type' => $wpp_query['pagination_type'], 'class' => 'wpp_top_pagination', 'sorter_type' => $wpp_query['sorter_type'], 'hide_count' => $wpp_query['hide_count'], 'sort_by_text' => $wpp_query['sort_by_text']));
     $result['result'] = $ob_get_contents;
     if ($wpp_query['bottom_pagination_flag'] == 'true') {
         $result['bottom_pagination'] = self::draw_pagination(array('type' => $wpp_query['pagination_type'], 'class' => 'wpp_bottom_pagination', 'sorter_type' => $wpp_query['sorter_type'], 'hide_count' => $wpp_query['hide_count'], 'sort_by_text' => $wpp_query['sort_by_text'], 'javascript' => false));
     }
     if ($wpp_query['disable_wrapper'] != 'true') {
         $result['bottom'] = '</div>';
     }
     $result = apply_filters('wpp_property_overview_render', $result);
     /* Reset global property to default. */
     $property = $_property;
     if ($wpp_query['ajax_call']) {
         return json_encode(array('wpp_query' => $wpp_query, 'display' => implode('', $result)));
     } else {
         return implode('', $result);
     }
 }
 /**
  * Returns array of searchable property IDs
  *
  *
  * @return array|$wp_properties
  * @since 0.621
  *
  */
 public static function get_searchable_properties()
 {
     global $wp_properties;
     $searchable_properties = array();
     if (!is_array($wp_properties['searchable_property_types'])) {
         return;
     }
     // Get IDs of all property types
     foreach ($wp_properties['searchable_property_types'] as $property_type) {
         $this_type_properties = WPP_F::get_properties("property_type={$property_type}");
         if (is_array($this_type_properties) && is_array($searchable_properties)) {
             $searchable_properties = array_merge($searchable_properties, $this_type_properties);
         }
     }
     if (is_array($searchable_properties)) {
         return $searchable_properties;
     }
     return false;
 }
    /**
     * @see WP_Widget::widget
     *
     */
    function widget($args, $instance)
    {
        global $wp_properties;
        $before_widget = '';
        $before_title = '';
        $after_title = '';
        $after_widget = '';
        extract($args);
        $title = apply_filters('widget_title', !empty($instance['title']) ? $instance['title'] : '');
        $instance = apply_filters('FeaturedPropertiesWidget', $instance);
        $show_title = isset($instance['show_title']) ? $instance['show_title'] : false;
        $image_type = isset($instance['image_type']) ? $instance['image_type'] : false;
        $amount_items = isset($instance['amount_items']) ? $instance['amount_items'] : false;
        $stats = isset($instance['stats']) ? $instance['stats'] : false;
        $address_format = isset($instance['address_format']) ? $instance['address_format'] : false;
        $hide_image = isset($instance['hide_image']) ? $instance['hide_image'] : false;
        $amount_items = isset($instance['amount_items']) ? $instance['amount_items'] : false;
        $random_items = isset($instance['random_items']) ? $instance['random_items'] : false;
        $property_stats = isset($wp_properties['property_stats']) ? $wp_properties['property_stats'] : array();
        if (empty($address_format)) {
            $address_format = "[street_number] [street_name], [city], [state]";
        }
        if (!$image_type) {
            $image_type = '';
        } else {
            $image_size = WPP_F::image_sizes($image_type);
        }
        if (!isset($property_stats['property_type'])) {
            $property_stats['property_type'] = sprintf(__('%s Type', ud_get_wp_property()->domain), WPP_F::property_label());
        }
        $random_sort = $random_items == 1 ? '&sort_by=random' : '';
        $all_featured = WPP_F::get_properties("featured=true&property_type=all&pagi=0--{$amount_items}{$random_sort}");
        /** Bail out if no children */
        if (!$all_featured) {
            return;
        }
        //** The current widget can be used on the page twice. So ID of the current DOM element (widget) has to be unique */
        /*
            //Removed since this will cause problems with jQuery Tabs in Denali.
            $before_widget = preg_replace('/id="([^\s]*)"/', 'id="$1_'.rand().'"', $before_widget);
            //*/
        echo $before_widget;
        echo "<div class='wpp_featured_properties_widget'>";
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $count = 0;
        foreach ($all_featured as $featured) {
            if ($amount_items == $count) {
                continue;
            }
            $count++;
            $this_property = WPP_F::get_property($featured, 'return_object=true');
            if (!empty($this_property->featured_image)) {
                $image = wpp_get_image_link($this_property->featured_image, $image_type, array('return' => 'array'));
                $width = !empty($image_size['width']) ? $image_size['width'] : (!empty($image['width']) ? $image['width'] : '');
                $height = !empty($image_size['height']) ? $image_size['height'] : (!empty($image['height']) ? $image['height'] : '');
            }
            ?>
      <div class="property_widget_block clearfix" style="<?php 
            echo $width ? 'width: ' . ($width + 5) . 'px;' : '';
            ?>
 min-height: <?php 
            echo $height;
            ?>
px;">
        <?php 
            if ($hide_image !== 'on') {
                ?>
          <?php 
                if (!empty($image)) {
                    ?>
            <a class="sidebar_property_thumbnail thumbnail" href="<?php 
                    echo $this_property->permalink;
                    ?>
">
              <img width="<?php 
                    echo $image['width'];
                    ?>
" height="<?php 
                    echo $image['height'];
                    ?>
" src="<?php 
                    echo $image['link'];
                    ?>
" alt=""/></a>
          <?php 
                } else {
                    ?>
            <div class="wpp_no_image" style="width:<?php 
                    echo $width;
                    ?>
px;height:<?php 
                    echo $height;
                    ?>
px;"></div>
          <?php 
                }
                ?>
        <?php 
            }
            ?>

        <?php 
            if ($show_title == 'on') {
                ?>
          <p class="title"><a
                href="<?php 
                echo $this_property->permalink;
                ?>
"><?php 
                echo $this_property->post_title;
                ?>
</a></p>
        <?php 
            }
            ?>

        <ul class="wpp_widget_attribute_list">
          <?php 
            if (is_array($stats)) {
                ?>
            <?php 
                foreach ($stats as $stat) {
                    if (!isset($this_property->{$stat})) {
                        continue;
                    }
                    switch (true) {
                        case !empty($wp_properties['configuration']['address_attribute']) && $wp_properties['configuration']['address_attribute'] == $stat:
                            $content = wpp_format_address_attribute($this_property->{$stat}, $this_property, $address_format);
                            break;
                        case $stat == 'property_type':
                            $content = nl2br(apply_filters("wpp_stat_filter_property_type_label", $this_property->property_type_label));
                            break;
                        default:
                            $content = nl2br(apply_filters("wpp_stat_filter_{$stat}", $this_property->{$stat}));
                            break;
                    }
                    if (empty($content)) {
                        continue;
                    }
                    ?>
              <li class="<?php 
                    echo $stat;
                    ?>
"><span class='attribute'><?php 
                    echo $property_stats[$stat];
                    ?>
:</span>
                <span class='value'><?php 
                    echo $content;
                    ?>
</span></li>
            <?php 
                }
                ?>
          <?php 
            }
            ?>
        </ul>
        <?php 
            if (isset($instance['enable_more']) && $instance['enable_more'] == 'on') {
                ?>
          <p class="more"><a href="<?php 
                echo $this_property->permalink;
                ?>
" class="btn btn-info"><?php 
                _e('More', ud_get_wp_property()->domain);
                ?>
</a></p>
        <?php 
            }
            ?>
      </div>
      <?php 
            unset($this_property);
        }
        if (isset($instance['enable_view_all']) && $instance['enable_view_all'] == 'on') {
            echo '<p class="view-all"><a href="' . site_url() . '/' . $wp_properties['configuration']['base_slug'] . '" class="btn btn-large">' . __('View All', ud_get_wp_property()->domain) . '</a></p>';
        }
        echo '<div class="clear"></div>';
        echo '</div>';
        echo $after_widget;
    }