Exemplo n.º 1
0
 /**
  * Return Thumnail
  *
  * @param $post
  * @return mixed|string
  */
 public function column_thumbnail($post)
 {
     $data = '';
     $wp_image_sizes = get_intermediate_image_sizes();
     $thumbnail_id = get_post_meta($post->ID, '_thumbnail_id', true);
     if ($thumbnail_id) {
         foreach ($wp_image_sizes as $image_name) {
             $this_url = wp_get_attachment_image_src($thumbnail_id, $image_name, true);
             $return['images'][$image_name] = $this_url[0];
         }
         $featured_image_id = $thumbnail_id;
     } else {
         $attachments = get_children(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC'));
         if ($attachments) {
             foreach ($attachments as $attachment_id => $attachment) {
                 $featured_image_id = $attachment_id;
                 break;
             }
         }
     }
     if (empty($featured_image_id)) {
         return $data;
     }
     $overview_thumb_type = ud_get_wp_property('configuration.admin_ui.overview_table_thumbnail_size');
     if (empty($overview_thumb_type)) {
         $overview_thumb_type = 'thumbnail';
     }
     $image_large_obj = wpp_get_image_link($featured_image_id, 'large', array('return' => 'array'));
     $image_thumb_obj = wpp_get_image_link($featured_image_id, $overview_thumb_type, array('return' => 'array'));
     if (!empty($image_large_obj) && !empty($image_thumb_obj)) {
         $data = '<a href="' . $image_large_obj['url'] . '" class="fancybox" rel="overview_group" title="' . $post->post_title . '"><img src="' . $image_thumb_obj['url'] . '" width="' . $image_thumb_obj['width'] . '" height="' . $image_thumb_obj['height'] . '" /></a>';
     }
     return $data;
 }
Exemplo n.º 2
0
<?php

/**
 * Template Child Properties Widget
 *
 *
 */
global $wp_properties;
echo "<div class='wpp_child_properties_widget'>";
if ($title) {
    echo $before_title . $title . $after_title;
}
foreach ($properties as $property) {
    $this_property = WPP_F::get_property($property->ID, 'return_object=true');
    $image = isset($this_property->featured_image) ? wpp_get_image_link($this_property->featured_image, $image_type, array('return' => 'array')) : false;
    $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 apartment_entry clearfix"
       style="<?php 
    echo $width ? 'width: ' . ($width + 5) . 'px;' : '';
    ?>
">
    <?php 
    if ($hide_image !== 'on') {
        ?>
      <?php 
        if (!empty($image)) {
            ?>
        <a class="sidebar_property_thumbnail thumbnail" href="<?php 
            echo $this_property->permalink;
Exemplo n.º 3
0
 /**
  * Return Thumnail
  *
  * @param $post
  * @return mixed|string
  */
 public function column_thumbnail($post)
 {
     $data = '';
     $wp_image_sizes = get_intermediate_image_sizes();
     $thumbnail_id = Property_Factory::get_thumbnail_id($post->ID);
     if ($thumbnail_id) {
         foreach ($wp_image_sizes as $image_name) {
             $this_url = wp_get_attachment_image_src($thumbnail_id, $image_name, true);
             $return['images'][$image_name] = $this_url[0];
         }
         $featured_image_id = $thumbnail_id;
     }
     if (empty($featured_image_id)) {
         return $data;
     }
     $overview_thumb_type = ud_get_wp_property('configuration.admin_ui.overview_table_thumbnail_size');
     if (empty($overview_thumb_type)) {
         $overview_thumb_type = 'thumbnail';
     }
     $image_large_obj = wpp_get_image_link($featured_image_id, 'large', array('return' => 'array'));
     $image_thumb_obj = wpp_get_image_link($featured_image_id, $overview_thumb_type, array('return' => 'array'));
     if (!empty($image_large_obj) && !empty($image_thumb_obj)) {
         $data = '<a href="' . $image_large_obj['url'] . '" class="fancybox" rel="overview_group" title="' . $post->post_title . '"><img src="' . $image_thumb_obj['url'] . '" width="' . $image_thumb_obj['width'] . '" height="' . $image_thumb_obj['height'] . '" /></a>';
     }
     return $data;
 }
Exemplo n.º 4
0
    /**
     * Renders the overview image of current property
     *
     * Used for property_overview to render the overview image based on current query and global $property object
     *
     * @args return, image_type
     *
     * @since 1.17.3
     */
    function property_overview_image($args = '')
    {
        global $wpp_query, $property;
        $thumbnail_size = $wpp_query['thumbnail_size'];
        $defaults = array('return' => 'false', 'image_type' => $thumbnail_size);
        $args = wp_parse_args($args, $defaults);
        /* Make sure that a feature image URL exists prior to committing to fancybox */
        if ($wpp_query['fancybox_preview'] == 'true' && !empty($property['featured_image_url'])) {
            $thumbnail_link = $property['featured_image_url'];
            $link_class = "fancybox_image";
        } else {
            $thumbnail_link = $property['permalink'];
            $link_class = '';
        }
        $image = !empty($property['featured_image']) ? wpp_get_image_link($property['featured_image'], $thumbnail_size, array('return' => 'array')) : false;
        if (!empty($image)) {
            ob_start();
            ?>
      <div class="property_image">
        <a href="<?php 
            echo $thumbnail_link;
            ?>
" title="<?php 
            echo $property['post_title'] . (!empty($property['parent_title']) ? __(' of ', ud_get_wp_property()->domain) . $property['parent_title'] : "");
            ?>
" class="property_overview_thumb property_overview_thumb_<?php 
            echo $thumbnail_size;
            ?>
 <?php 
            echo $link_class;
            ?>
 thumbnail" rel="<?php 
            echo $property['post_name'];
            ?>
">
          <img width="<?php 
            echo $image['width'];
            ?>
" height="<?php 
            echo $image['height'];
            ?>
" src="<?php 
            echo $image['link'];
            ?>
" alt="<?php 
            echo $property['post_title'];
            ?>
" style="width:<?php 
            echo $image['width'];
            ?>
px;height:<?php 
            echo $image['height'];
            ?>
px;"/>
        </a>
      </div>
      <?php 
            $html = ob_get_contents();
            ob_end_clean();
        } else {
            $html = '';
        }
        if ($args['return'] == 'true') {
            return $html;
        } else {
            echo $html;
        }
    }
Exemplo n.º 5
0
    /**
     * @see WP_Widget::widget
     */
    function widget($args, $instance)
    {
        global $wp_properties;
        $before_widget = '';
        $before_title = '';
        $after_title = '';
        $after_widget = '';
        extract($args);
        $instance = apply_filters('LatestPropertiesWidget', $instance);
        $title = isset($instance['title']) ? $instance['title'] : '';
        $stats = isset($instance['stats']) ? $instance['stats'] : array();
        $image_type = !empty($instance['image_type']) ? $instance['image_type'] : '';
        $hide_image = isset($instance['hide_image']) ? $instance['hide_image'] : false;
        $show_title = isset($instance['show_title']) ? $instance['show_title'] : false;
        $address_format = isset($instance['address_format']) ? $instance['address_format'] : '';
        $property_stats = isset($wp_properties['property_stats']) ? $wp_properties['property_stats'] : array();
        if (!empty($image_type)) {
            $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());
        }
        $arg = array('post_type' => 'property', 'numberposts' => !empty($instance['amount_items']) ? $instance['amount_items'] : 5, 'post_status' => 'publish', 'post_parent' => null, 'order' => 'DESC', 'orderby' => 'post_date');
        $postslist = get_posts($arg);
        echo $before_widget;
        echo "<div class='wpp_latest_properties_widget'>";
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        foreach ($postslist as $post) {
            $this_property = WPP_F::get_property($post->ID, 'return_object=true');
            $image = isset($this_property->featured_image) ? wpp_get_image_link($this_property->featured_image, $image_type, array('return' => 'array')) : false;
            $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 latest_entry clearfix"
           style="<?php 
            echo $width ? 'width: ' . ($width + 5) . 'px;' : '';
            ?>
">
        <?php 
            if ($hide_image !== 'on') {
                ?>
          <?php 
                if (!empty($image)) {
                    ?>
            <a class="sidebar_property_thumbnail latest_property_thumbnail thumbnail"
               href="<?php 
                    echo $this_property->permalink;
                    ?>
">
              <img width="<?php 
                    echo $image['width'];
                    ?>
" height="<?php 
                    echo $image['height'];
                    ?>
"
                   src="<?php 
                    echo $image['url'];
                    ?>
"
                   alt="<?php 
                    echo sprintf(__('%s at %s for %s', ud_get_wp_property()->domain), $this_property->post_title, $this_property->location, $this_property->price);
                    ?>
"/>
            </a>
          <?php 
                } else {
                    ?>
            <div class="wpp_no_image" style="width:<?php 
                    echo $width;
                    ?>
px;height:<?php 
                    echo $height;
                    ?>
px;"></div>
          <?php 
                }
                ?>
        <?php 
            }
            if ($show_title == 'on') {
                echo '<p class="title"><a href="' . $this_property->permalink . '">' . $post->post_title . '</a></p>';
            }
            echo '<ul class="wpp_widget_attribute_list">';
            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;
                    }
                    echo '<li class="' . $stat . '"><span class="attribute">' . $property_stats[$stat] . ':</span> <span class="value">' . $content . '</span></li>';
                }
            }
            echo '</ul>';
            if (isset($instance['enable_more']) && $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);
        }
        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;
    }
Exemplo n.º 6
0
    /**
     * Widget body
     * @param array $args
     * @param array $instance
     */
    function widget($args, $instance)
    {
        global $wp_properties, $post, $property;
        $before_widget = '';
        $before_title = '';
        $after_title = '';
        $after_widget = '';
        extract($args);
        $title = isset($instance['title']) ? $instance['title'] : '';
        $image_type = !empty($instance['image_type']) ? $instance['image_type'] : 'thumbnail';
        $big_image_type = isset($instance['big_image_type']) ? $instance['big_image_type'] : false;
        $gallery_count = isset($instance['gallery_count']) ? $instance['gallery_count'] : false;
        $show_caption = isset($instance['show_caption']) ? $instance['show_caption'] : false;
        $show_description = isset($instance['show_description']) ? $instance['show_description'] : false;
        $gallery = isset($post->gallery) ? (array) $post->gallery : (isset($property['gallery']) ? (array) $property['gallery'] : array());
        $slideshow_images = !empty($post->slideshow_images) ? $post->slideshow_images : (!empty($property['slideshow_images']) ? $property['slideshow_images'] : false);
        $slideshow_order = maybe_unserialize($slideshow_images);
        $gallery_order = maybe_unserialize(!empty($post->gallery_images) ? $post->gallery_images : (!empty($property['gallery_images']) ? $property['gallery_images'] : false));
        //** Calculate order of images */
        if (is_array($slideshow_order) || is_array($gallery_order)) {
            $order = array_unique(array_merge((array) $slideshow_order, (array) $gallery_order));
            $prepared_gallery_images = array();
            //** Get images from the list of images by order */
            foreach ($order as $order_id) {
                foreach ($gallery as $image_slug => $gallery_image_data) {
                    if ($gallery_image_data['attachment_id'] == $order_id) {
                        $prepared_gallery_images[$image_slug] = $gallery_image_data;
                        unset($gallery[$image_slug]);
                    }
                }
            }
            //** Be sure we show ALL property images in gallery */
            $gallery = array_merge($prepared_gallery_images, $gallery);
        }
        if (!is_array($gallery)) {
            return NULL;
        }
        $thumbnail_dimensions = WPP_F::image_sizes($image_type);
        //** 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);
        */
        $html[] = $before_widget;
        $html[] = "<div class='wpp_gallery_widget'>";
        if ($title) {
            $html[] = $before_title . $title . $after_title;
        }
        ob_start();
        if (is_array($gallery)) {
            $real_count = 0;
            foreach ($gallery as $image) {
                $thumb_image = wpp_get_image_link($image['attachment_id'], $image_type);
                ?>
        <div class="sidebar_gallery_item">
          <?php 
                if (!empty($big_image_type)) {
                    ?>
            <?php 
                    $big_image = wpp_get_image_link($image['attachment_id'], $big_image_type);
                    ?>
            <a href="<?php 
                    echo $big_image;
                    ?>
" class="fancybox_image thumbnail" rel="property_gallery">
              <img src="<?php 
                    echo $thumb_image;
                    ?>
"
                   title="<?php 
                    echo esc_attr($image['post_excerpt'] ? $image['post_excerpt'] : $image['post_title'] . ' - ' . $post->post_title);
                    ?>
"
                   alt="<?php 
                    echo esc_attr($image['post_excerpt'] ? $image['post_excerpt'] : $image['post_title']);
                    ?>
"
                   class="wpp_gallery_widget_image size-thumbnail "
                   width="<?php 
                    echo $thumbnail_dimensions['width'];
                    ?>
"
                   height="<?php 
                    echo $thumbnail_dimensions['height'];
                    ?>
"/>
            </a>
          <?php 
                } else {
                    ?>
            <img src="<?php 
                    echo $thumb_image;
                    ?>
"
                 title="<?php 
                    echo esc_attr($image['post_excerpt'] ? $image['post_excerpt'] : $image['post_title'] . ' - ' . $post->post_title);
                    ?>
"
                 alt="<?php 
                    echo esc_attr($image['post_excerpt'] ? $image['post_excerpt'] : $image['post_title']);
                    ?>
"
                 class="wpp_gallery_widget_image size-thumbnail "
                 width="<?php 
                    echo $thumbnail_dimensions['width'];
                    ?>
"
                 height="<?php 
                    echo $thumbnail_dimensions['height'];
                    ?>
"/>            <?php 
                }
                ?>
          <?php 
                if ($show_caption == 'on' && !empty($image['post_excerpt'])) {
                    ?>
            <div class="wpp_image_widget_caption"><?php 
                    echo $image['post_excerpt'];
                    ?>
</div>
          <?php 
                }
                ?>

          <?php 
                if ($show_description == 'on') {
                    ?>
            <div class="wpp_image_widget_description"><?php 
                    echo $image['post_content'];
                    ?>
</div>
          <?php 
                }
                ?>

        </div>
        <?php 
                $real_count++;
                if (!empty($gallery_count) && $gallery_count == $real_count) {
                    break;
                }
            }
        }
        $html['images'] = ob_get_contents();
        ob_end_clean();
        $html[] = "</div>";
        $html[] = $after_widget;
        $html = apply_filters('wpp_widget_property_gallery', $html, array('args' => $args, 'instance' => $instance, 'post' => $post));
        if (!empty($html['images']) && is_array($html)) {
            echo implode('', $html);
        }
        return;
    }
Exemplo n.º 7
0
    /**
     * 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);
        }
    }
Exemplo n.º 8
0
    /**
     * Returns a minified Google Maps Infobox
     *
     * Used in property map and supermap
     *
     * @filter wpp_google_maps_infobox
     * @version 1.11 - added return if $post or address attribute are not set to prevent fatal error
     * @since 1.081
     *
     */
    public static function google_maps_infobox($post, $args = false)
    {
        global $wp_properties;
        $map_image_type = $wp_properties['configuration']['single_property_view']['map_image_type'];
        $infobox_attributes = $wp_properties['configuration']['google_maps']['infobox_attributes'];
        $infobox_settings = $wp_properties['configuration']['google_maps']['infobox_settings'];
        if (empty($wp_properties['configuration']['address_attribute'])) {
            return;
        }
        if (empty($post)) {
            return;
        }
        if (is_array($post)) {
            $post = (object) $post;
        }
        $property = (array) prepare_property_for_display($post, array('load_gallery' => 'false', 'scope' => 'google_map_infobox'));
        //** Check if we have children */
        if (!empty($property['children']) && (!isset($wp_properties['configuration']['google_maps']['infobox_settings']['do_not_show_child_properties']) || $wp_properties['configuration']['google_maps']['infobox_settings']['do_not_show_child_properties'] != 'true')) {
            foreach ($property['children'] as $child_property) {
                $child_property = (array) $child_property;
                $html_child_properties[] = '<li class="infobox_child_property"><a href="' . $child_property['permalink'] . '">' . $child_property['post_title'] . '</a></li>';
            }
        }
        if (empty($infobox_attributes)) {
            $infobox_attributes = array('price', 'bedrooms', 'bathrooms');
        }
        if (empty($infobox_settings)) {
            $infobox_settings = array('show_direction_link' => true, 'show_property_title' => true);
        }
        $infobox_style = !empty($infobox_settings['minimum_box_width']) ? 'style="min-width: ' . $infobox_settings['minimum_box_width'] . 'px;"' : '';
        foreach ($infobox_attributes as $attribute) {
            if (!empty($wp_properties['property_stats'][$attribute])) {
                $property_stats[$attribute] = $wp_properties['property_stats'][$attribute];
            }
        }
        $property_stats = WPP_F::get_stat_values_and_labels($property, array('property_stats' => $property_stats));
        if (!empty($property['featured_image'])) {
            $image = wpp_get_image_link($property['featured_image'], $map_image_type, array('return' => 'array'));
            if (!empty($image) && is_array($image)) {
                $imageHTML = "<img width=\"{$image['width']}\" height=\"{$image['height']}\" src=\"{$image['link']}\" alt=\"" . addslashes($post->post_title) . "\" />";
                if (@$wp_properties['configuration']['property_overview']['fancybox_preview'] == 'true' && !empty($property['featured_image_url'])) {
                    $imageHTML = "<a href=\"{$property['featured_image_url']}\" class=\"fancybox_image thumbnail\">{$imageHTML}</a>";
                }
            }
        }
        ob_start();
        ?>

    <div id="infowindow" <?php 
        echo $infobox_style;
        ?>
>
      <?php 
        if ($infobox_settings['show_property_title'] == 'true') {
            ?>
        <div class="wpp_google_maps_attribute_row_property_title">
          <a href="<?php 
            echo get_permalink($property['ID']);
            ?>
"><?php 
            echo $property['post_title'];
            ?>
</a>
        </div>
      <?php 
        }
        ?>

      <table cellpadding="0" cellspacing="0" class="wpp_google_maps_infobox_table" style="">
        <tr>
          <?php 
        if (!empty($imageHTML)) {
            ?>
            <td class="wpp_google_maps_left_col" style=" width: <?php 
            echo $image['width'];
            ?>
px">
              <?php 
            echo $imageHTML;
            ?>
              <?php 
            if ($infobox_settings['show_direction_link'] == 'true' && !empty($property['latitude']) && !empty($property['longitude'])) {
                ?>
                <div class="wpp_google_maps_attribute_row wpp_google_maps_attribute_row_directions_link">
                  <a target="_blank"
                     href="http://maps.google.com/maps?gl=us&daddr=<?php 
                echo $property['latitude'];
                ?>
,<?php 
                echo $property['longitude'];
                ?>
"
                     class="btn btn-info"><?php 
                _e('Get Directions', ud_get_wp_property()->domain);
                ?>
</a>
                </div>
              <?php 
            }
            ?>
            </td>
          <?php 
        }
        ?>

          <td class="wpp_google_maps_right_col" vertical-align="top" style="vertical-align: top;">
            <?php 
        if (!empty($imageHTML) && $infobox_settings['show_direction_link'] == 'true' && !empty($property['latitude']) && !empty($property['longitude'])) {
            ?>
              <div class="wpp_google_maps_attribute_row wpp_google_maps_attribute_row_directions_link">
                <a target="_blank"
                   href="http://maps.google.com/maps?gl=us&daddr=<?php 
            echo $property['latitude'];
            ?>
,<?php 
            echo $property['longitude'];
            ?>
"
                   class="btn btn-info"><?php 
            _e('Get Directions', ud_get_wp_property()->domain);
            ?>
</a>
              </div>
            <?php 
        }
        $attributes = array();
        $labels_to_keys = array_flip($wp_properties['property_stats']);
        if (is_array($property_stats)) {
            foreach ($property_stats as $attribute_label => $value) {
                $attribute_slug = $labels_to_keys[$attribute_label];
                $attribute_data = UsabilityDynamics\WPP\Attributes::get_attribute_data($attribute_slug);
                if (empty($value)) {
                    continue;
                }
                if (!empty($attribute_data['data_input_type']) && $attribute_data['data_input_type'] == 'checkbox' && ($value == 'true' || $value == 1)) {
                    if ($wp_properties['configuration']['google_maps']['show_true_as_image'] == 'true') {
                        $value = '<div class="true-checkbox-image"></div>';
                    } else {
                        $value = __('Yes', ud_get_wp_property()->domain);
                    }
                } elseif ($value == 'false') {
                    continue;
                }
                $attributes[] = '<li class="wpp_google_maps_attribute_row wpp_google_maps_attribute_row_' . $attribute_slug . '">';
                $attributes[] = '<span class="attribute">' . $attribute_label . '</span>';
                $attributes[] = '<span class="value">' . $value . '</span>';
                $attributes[] = '</li>';
            }
        }
        if (count($attributes) > 0) {
            echo '<ul class="wpp_google_maps_infobox">' . implode('', $attributes) . '<li class="wpp_google_maps_attribute_row wpp_fillter_element">&nbsp;</li></ul>';
        }
        if (!empty($html_child_properties)) {
            echo '<ul class="infobox_child_property_list">' . implode('', $html_child_properties) . '<li class="infobox_child_property wpp_fillter_element">&nbsp;</li></ul>';
        }
        ?>

          </td>
        </tr>
      </table>

    </div>

    <?php 
        $data = ob_get_contents();
        $data = preg_replace(array('/[\\r\\n]+/'), array(""), $data);
        $data = addslashes($data);
        ob_end_clean();
        $data = apply_filters('wpp_google_maps_infobox', $data, $post);
        return $data;
    }
    /**
     * @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;
    }