/** * Performs front-end pre-header functionality * * - This function is not called on admin side. * - Loads conditional CSS styles. * - Determines if page is single property or property overview. * * @since 1.11 */ public function template_redirect() { global $post, $property, $wp_query, $wp_properties, $wp_styles, $wpp_query; /** * HACK. * @see self::parse_request(); * @author peshkov@UD */ if (get_query_var('_fix_to_page_template')) { $wp_query->is_single = false; $wp_query->is_page = true; } wp_localize_script('wpp-localization', 'wpp', array('instance' => $this->get_instance())); //** Load global wp-property script on all frontend pages */ wp_enqueue_script('wp-property-global'); if (apply_filters('wpp::custom_styles', false) === false) { //** Possibly load essential styles that are used in widgets */ wp_enqueue_style('wp-property-frontend'); //** Possibly load theme specific styles */ wp_enqueue_style('wp-property-theme-specific'); } if (!isset($wp_properties['configuration']['do_not_enable_text_widget_shortcodes']) || $wp_properties['configuration']['do_not_enable_text_widget_shortcodes'] != 'true') { add_filter('widget_text', 'do_shortcode'); } do_action('wpp_template_redirect'); //** Handle single property page previews */ if (!empty($wp_query->query_vars['preview']) && $post->post_type == "property" && $post->post_status == "publish") { wp_redirect(get_permalink($post->ID)); die; } /* (count($wp_query->posts) < 2) added post 1.31.1 release */ /* to avoid taxonomy archives from being broken by single property pages */ if (isset($post) && count($wp_query->posts) < 2 && ($post->post_type == "property" || isset($wp_query->is_child_property))) { $wp_query->single_property_page = true; //** This is a hack and should be done better */ if (!$post) { $post = get_post($wp_query->queried_object_id); $wp_query->posts[0] = $post; $wp_query->post = $post; } } //** If viewing root property page that is the default dynamic page. */ if (isset($wp_query->wpp_default_property_page)) { $wp_query->is_property_overview = true; } //** If this is the root page with a manually inserted shortcode, or any page with a PO shortcode */ if (isset($post) && strpos($post->post_content, "property_overview")) { $wp_query->is_property_overview = true; } //** If this is the root page and the shortcode is automatically inserted */ if (isset($wp_query->wpp_root_property_page) && $wp_properties['configuration']['automatically_insert_overview'] == 'true') { $wp_query->is_property_overview = true; } //** If search result page, and system not explicitly configured to not include PO on search result page automatically */ if (isset($wp_query->wpp_search_page) && (!isset($wp_properties['configuration']['do_not_override_search_result_page']) || $wp_properties['configuration']['do_not_override_search_result_page'] != 'true')) { $wp_query->is_property_overview = true; } //** Scripts and styles to load on all overview and single listing pages */ if (isset($wp_query->single_property_page) || isset($wp_query->is_property_overview)) { // Check for and load conditional browser styles $conditional_styles = apply_filters('wpp_conditional_style_slugs', array('IE', 'IE 7', 'msie')); foreach ($conditional_styles as $type) { // Fix slug for URL $url_slug = strtolower(str_replace(" ", "_", $type)); if (file_exists(STYLESHEETPATH . "/wp_properties-{$url_slug}.css")) { wp_register_style('wp-property-frontend-' . $url_slug, get_bloginfo('stylesheet_directory') . "/wp_properties-{$url_slug}.css", array('wp-property-frontend'), '1.13'); } elseif (file_exists(TEMPLATEPATH . "/wp_properties-{$url_slug}.css")) { wp_register_style('wp-property-frontend-' . $url_slug, get_bloginfo('template_url') . "/wp_properties-{$url_slug}.css", array('wp-property-frontend'), '1.13'); } elseif (file_exists(WPP_URL . "styles/wp_properties-{$url_slug}.css") && $wp_properties['configuration']['autoload_css'] == 'true') { wp_register_style('wp-property-frontend-' . $url_slug, WPP_URL . "styles/wp_properties-{$url_slug}.css", array('wp-property-frontend'), WPP_Version); } // Mark every style as conditional $wp_styles->add_data('wp-property-frontend-' . $url_slug, 'conditional', $type); wp_enqueue_style('wp-property-frontend-' . $url_slug); } } //** Scripts loaded only on single property pages */ if (isset($wp_query->single_property_page)) { WPP_F::console_log('Including scripts for all single property pages.'); WPP_F::load_assets(array('single')); do_action('template_redirect_single_property'); add_action('wp_head', create_function('', "do_action('wp_head_single_property'); ")); $property = (array) WPP_F::get_property($post->ID, "load_gallery=true"); $property_type = !empty($property['property_type']) ? $property['property_type'] : false; // Redirect to parent if property type is non-public. if (isset($wp_properties['redirect_to_parent']) && is_array($wp_properties['redirect_to_parent']) && in_array($property_type, $wp_properties['redirect_to_parent']) && $property['post_parent']) { die(wp_redirect(get_permalink($property['post_parent']))); } $property = prepare_property_for_display($property); //** Make certain variables available to be used within the single listing page */ $single_page_vars = apply_filters('wpp_property_page_vars', array('property' => $property, 'wp_properties' => $wp_properties)); //** By merging our extra variables into $wp_query->query_vars they will be extracted in load_template() */ if (is_array($single_page_vars)) { $wp_query->query_vars = array_merge($wp_query->query_vars, $single_page_vars); } } //** Current requests includes a property overview. PO may be via shortcode, search result, or due to this being the Default Dynamic Property page */ if (isset($wp_query->is_property_overview)) { WPP_F::console_log('Including scripts for all property overview pages.'); WPP_F::load_assets(array('overview')); if (isset($wp_query->wpp_default_property_page)) { WPP_F::console_log('Dynamic Default Property page detected, will load custom template.'); } else { WPP_F::console_log('Custom Default Property page detected, property overview content may be rendered via shortcode.'); } //** Make certain variables available to be used within the single listing page */ $overview_page_vars = apply_filters('wpp_overview_page_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($overview_page_vars)) { $wp_query->query_vars = array_merge($wp_query->query_vars, $overview_page_vars); } do_action('template_redirect_property_overview'); add_action('wp_head', create_function('', "do_action('wp_head_property_overview'); ")); } do_action('wpp_template_redirect_post_scripts'); }
/** * Returns printable array of property stats * * * @todo #property_stats is currently used in multiple instances when attribute list is displayed by groups. Cannot remove to avoid breaking styles. - potanin@UD (11/5/2011) * @since 1.11 * @args: exclude, return_blank, make_link */ function draw_stats($args = false, $property = false) { global $wp_properties, $post; if (!$property) { $property = $post; } $property = prepare_property_for_display($property); if (is_array($property)) { $property = WPP_F::array_to_object($property); } $defaults = array('sort_by_groups' => 'false', 'display' => 'dl_list', 'show_true_as_image' => 'false', 'make_link' => 'true', 'hide_false' => 'false', 'first_alt' => 'false', 'return_blank' => 'false', 'include' => '', 'exclude' => '', 'include_clsf' => 'attribute', 'stats_prefix' => sanitize_key(WPP_F::property_label('singular'))); if (!empty($wp_properties['configuration']['property_overview']['sort_stats_by_groups'])) { $defaults['sort_by_groups'] = $wp_properties['configuration']['property_overview']['sort_stats_by_groups']; } if (!empty($wp_properties['configuration']['property_overview']['show_true_as_image'])) { $defaults['show_true_as_image'] = $wp_properties['configuration']['property_overview']['show_true_as_image']; } extract($args = wp_parse_args($args, $defaults), EXTR_SKIP); $property_stats = array(); $groups = isset($wp_properties['property_groups']) ? (array) $wp_properties['property_groups'] : array(); /** * Determine if we should draw meta data. * The functionality below is related to WPP2.0 * Now it just adds compatibility with new Denali versions */ if ($include_clsf == 'detail') { $sort_by_groups = 'false'; foreach ($wp_properties['property_meta'] as $k => $v) { if ($k == 'tagline') { continue; } if (!empty($property->{$k})) { $property_stats[$k] = array('label' => $v, 'value' => $property->{$k}); } } } else { $property_stats = WPP_F::get_stat_values_and_labels($property, array('label_as_key' => 'false')); } /** Include only passed attributes */ if (!empty($include)) { $include = !is_array($include) ? explode(',', $include) : $include; foreach ($property_stats as $k => $v) { if (!in_array($k, $include)) { unset($property_stats[$k]); } } } /** Exclude specific attributes from list */ if (!empty($exclude)) { $exclude = !is_array($exclude) ? explode(',', $exclude) : $exclude; foreach ($exclude as $k) { if (isset($property_stats[$k])) { unset($property_stats[$k]); } } } if (empty($property_stats)) { return false; } //echo "<pre>"; print_r( $property_stats ); echo "</pre>"; die(); //* Prepare values before display */ $property_stats = apply_filters('wpp::draw_stats::attributes', $property_stats, $property); $stats = array(); foreach ($property_stats as $tag => $data) { if (empty($data['value'])) { continue; } $value = $data['value']; $attribute_data = UsabilityDynamics\WPP\Attributes::get_attribute_data($tag); //** Do not show attributes that have value of 'value' if enabled */ if ($hide_false == 'true' && $value == 'false') { continue; } //* Skip blank values (check after filters have been applied) */ if ($return_blank == 'false' && empty($value)) { continue; } $value = html_entity_decode($value); //** Single "true" is converted to 1 by get_properties() we check 1 as well, as long as it isn't a numeric attribute */ if (isset($attribute_data['data_input_type']) && $attribute_data['data_input_type'] == 'checkbox' && in_array(strtolower($value), array('true', '1', 'yes'))) { if ($show_true_as_image == 'true') { $value = '<div class="true-checkbox-image"></div>'; } else { $value = __('Yes', ud_get_wp_property()->domain); } } else { if ($value == 'false') { if ($show_true_as_image == 'true') { continue; } $value = __('No', ud_get_wp_property()->domain); } } //* Make URLs into clickable links */ if ($make_link == 'true' && WPP_F::isURL($value)) { $value = str_replace('–', '-', $value); $value = "<a href='{$value}' title='{$label}'>{$value}</a>"; } //* Make emails into clickable links */ if ($make_link == 'true' && WPP_F::is_email($value)) { $value = "<a href='mailto:{$value}'>{$value}</a>"; } $data['value'] = $value; $stats[$tag] = $data; } if (empty($stats)) { return false; } if ($display == 'array') { if ($sort_by_groups == 'true' && is_array($groups)) { $stats = sort_stats_by_groups($stats); } return $stats; } $alt = $first_alt == 'true' ? "" : "alt"; //** Disable regular list if groups are NOT enabled, or if groups is not an array */ if ($sort_by_groups != 'true' || !is_array($groups)) { foreach ($stats as $tag => $data) { $label = $data['label']; $value = $data['value']; $alt = $alt == "alt" ? "" : "alt"; switch ($display) { case 'dl_list': ?> <dt class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> wpp_stat_dt_<?php echo $tag; ?> "><?php echo $label; ?> <span class="wpp_colon">:</span></dt> <dd class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> wpp_stat_dd_<?php echo $tag; ?> <?php echo $alt; ?> "><?php echo $value; ?> </dd> <?php break; case 'list': ?> <li class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> wpp_stat_plain_list_<?php echo $tag; ?> <?php echo $alt; ?> "> <span class="attribute"><?php echo $label; ?> <span class="wpp_colon">:</span></span> <span class="value"><?php echo $value; ?> </span> </li> <?php break; case 'plain_list': ?> <span class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> attribute"><?php echo $label; ?> :</span> <span class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> value"><?php echo $value; ?> </span> <br/> <?php break; case 'detail': ?> <h4 class="wpp_attribute"><?php echo $label; ?> <span class="separator">:</span></h4> <p class="value"><?php echo $value; ?> </p> <?php break; } } } else { $stats_by_groups = sort_stats_by_groups($stats); $main_stats_group = $wp_properties['configuration']['main_stats_group']; foreach ($stats_by_groups as $gslug => $gstats) { ?> <div class="wpp_feature_list"> <?php if ($main_stats_group != $gslug || !@array_key_exists($gslug, $groups)) { $group_name = @array_key_exists($gslug, $groups) ? $groups[$gslug]['name'] : __('Other', ud_get_wp_property()->domain); ?> <h2 class="wpp_stats_group"><?php echo $group_name; ?> </h2> <?php } switch ($display) { case 'dl_list': ?> <dl class="wpp_property_stats overview_stats"> <?php foreach ($gstats as $tag => $data) { ?> <?php $label = $data['label']; $value = $data['value']; ?> <?php $alt = $alt == "alt" ? "" : "alt"; ?> <dt class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> wpp_stat_dt_<?php echo $tag; ?> "><?php echo $label; ?> </dt> <dd class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> wpp_stat_dd_<?php echo $tag; ?> <?php echo $alt; ?> "><?php echo $value; ?> </dd> <?php } ?> </dl> <?php break; case 'list': ?> <ul class="overview_stats wpp_property_stats list"> <?php foreach ($gstats as $tag => $data) { ?> <?php $label = $data['label']; $value = $data['value']; $alt = $alt == "alt" ? "" : "alt"; ?> <li class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> wpp_stat_plain_list_<?php echo $tag; ?> <?php echo $alt; ?> "> <span class="attribute"><?php echo $label; ?> :</span> <span class="value"><?php echo $value; ?> </span> </li> <?php } ?> </ul> <?php break; case 'plain_list': foreach ($gstats as $tag => $data) { $label = $data['label']; $value = $data['value']; ?> <span class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> attribute"><?php echo $label; ?> :</span> <span class="<?php echo $stats_prefix; ?> _<?php echo $tag; ?> value"><?php echo $value; ?> </span> <br/> <?php } break; } ?> </div> <?php } } }
/** * @param string $atts * @return string|void */ public function call($atts = "") { global $post, $property; $this_property = $property; if (empty($this_property) && $post->post_type == 'property') { $this_property = $post; } $this_property = (array) $this_property; if (!$atts) { $atts = array(); } $defaults = array('property_id' => $this_property['ID'], 'attribute' => '', 'before' => '', 'after' => '', 'if_empty' => '', 'do_not_format' => '', 'make_terms_links' => 'false', 'separator' => ' ', 'strip_tags' => ''); $args = array_merge($defaults, $atts); if (empty($args['attribute'])) { return false; } $attribute = $args['attribute']; if ($args['property_id'] != $this_property['ID']) { $this_property = WPP_F::get_property($args['property_id']); if ($args['do_not_format'] != "true") { $this_property = prepare_property_for_display($this_property); } } if (taxonomy_exists($attribute) && is_object_in_taxonomy('property', $attribute)) { foreach (wp_get_object_terms($this_property['ID'], $attribute) as $term_data) { if ($args['make_terms_links'] == 'true') { $terms[] = '<a class="wpp_term_link" href="' . get_term_link($term_data, $attribute) . '"><span class="wpp_term">' . $term_data->name . '</span></a>'; } else { $terms[] = '<span class="wpp_term">' . $term_data->name . '</span>'; } } if (isset($terms) && is_array($terms) && !empty($terms)) { $value = implode($args['separator'], $terms); } } //** Try to get value using get get_attribute() function */ if (!isset($value) || !$value && function_exists('get_attribute')) { $value = get_attribute($attribute, array('return' => 'true', 'property_object' => $this_property)); } if (!empty($args['before'])) { $return['before'] = html_entity_decode($args['before']); } $return['value'] = apply_filters('wpp_property_attribute_shortcode', $value, $this_property); if ($args['strip_tags'] == "true" && !empty($return['value'])) { $return['value'] = strip_tags($return['value']); } if (!empty($args['after'])) { $return['after'] = html_entity_decode($args['after']); } //** When no value is found */ if (empty($return['value'])) { if (!empty($args['if_empty'])) { return $args['if_empty']; } else { return false; } } if (is_array($return)) { return implode('', $return); } return false; }
/** * 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); } }
/** * 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"> </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"> </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; }
* @version 1.4 * @author Andy Potanin <*****@*****.**> * @package WP-Property */ if ($properties) { ?> <ul class="<?php wpp_css('property_overview_plain_list::row_view', "wpp_row_view"); ?> "> <?php foreach ($properties as $property_id) { ?> <?php $property = prepare_property_for_display(get_property($property_id, $show_children ? "get_property['children']={$show_property['children']}" : "")); ?> <li class="<?php wpp_css('property_overview_plain_list::property_div', "property_div"); ?> "> <a href="<?php echo $property['permalink']; ?> "><?php echo $property['post_title']; ?> </a> <?php if ($show_children && $property['children']) {