function mhk_geodir_detail_page_review_rating()
{
    global $post, $preview, $post_images;
    ob_start();
    // Start  buffering;
    do_action('geodir_before_detail_page_review_rating');
    $comment_count = isset($post->rating_count) ? $post->rating_count : 0;
    $post_ratings = geodir_get_postoverall($post->ID);
    if ($post_ratings != 0 && !$preview) {
        if ($comment_count > 0) {
            $post_avgratings = $post_ratings / $comment_count;
        } else {
            $post_avgratings = $post_ratings;
        }
        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
        $html = '<p style=" float:left;">';
        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
        $post_avgratings = is_float($post_avgratings) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
        if ($comment_count > 1) {
            $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average">' . $post_avgratings . '</span> /  <span itemprop="best">5</span> ' . __("based on", GEODIRECTORY_TEXTDOMAIN) . ' <span class="count" itemprop="count">' . $comment_count . '</span> ' . __("reviews", GEODIRECTORY_TEXTDOMAIN) . '</span><br />';
        } else {
            $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average">' . $post_avgratings . '</span> /  <span itemprop="best">5</span> ' . __("based on", GEODIRECTORY_TEXTDOMAIN) . ' <span class="count" itemprop="count">' . $comment_count . '</span> ' . __("review", GEODIRECTORY_TEXTDOMAIN) . '</span><br />';
        }
        $html .= '<span class="item">';
        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
        if ($post_images) {
            foreach ($post_images as $img) {
                $post_img = $img->src;
                break;
            }
        }
        if ($post_img) {
            $html .= '<br /><img src="' . $post_img . '" class="photo hreview-img"  alt="' . $post->post_title . '" itemprop="photo" />';
        }
        $html .= '</span>';
        echo $html .= '</div>';
        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
    }
    do_action('geodir_after_detail_page_review_rating');
    $content_html = ob_get_clean();
    if (trim($content_html) != '') {
        $content_html = '<div class="rating-container"><div class="rating-title"><h4>Rating</h4></div><div class="geodir-company_info more_info_rating">' . $content_html . '</div></div>';
    }
    echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
}
    function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
    {
        global $preview;
        $srcharr = array("'", "/", "-", '"', '\\');
        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
        if (isset($_SESSION['listing']) && isset($post_preview) && $post_preview != '') {
            $ID = '';
            $plink = '';
            if (isset($postinfo_obj->pid)) {
                $ID = $postinfo_obj->pid;
                $plink = get_permalink($ID);
            }
            $title = str_replace($srcharr, $replarr, $postinfo_obj->post_title);
            $lat = $postinfo_obj->post_latitude;
            $lng = $postinfo_obj->post_longitude;
            $address = str_replace($srcharr, $replarr, $postinfo_obj->post_address);
            $city = str_replace($srcharr, $replarr, $postinfo_obj->post_city);
            $contact = str_replace($srcharr, $replarr, $postinfo_obj->geodir_contact);
            $timing = str_replace($srcharr, $replarr, $postinfo_obj->geodir_timing);
        } else {
            $ID = $postinfo_obj->post_id;
            $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8'));
            // fix by Stiofan
            $plink = get_permalink($ID);
            $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
            $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
            $address = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_address', true), ENT_COMPAT, 'UTF-8'));
            // fix by Stiofan
            $city = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_city', true), ENT_COMPAT, 'UTF-8'));
            $contact = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'geodir_contact', true), ENT_COMPAT, 'UTF-8'));
            $timing = str_replace($srcharr, $replarr, geodir_get_post_meta($ID, 'geodir_timing', true));
        }
        if ($lat && $lng) {
            ob_start();
            ?>

	<div class="bubble">
		<div style="position: relative;margin:5px 0px; ">
			<?php 
            $comment_count = '';
            $rating_star = '';
            if ($ID != '') {
                $rating_star = '';
                //$comment_count = get_comments_number($ID); // for some reason the filter is not applied here.
                $comment_count = isset($postinfo_obj->rating_count) ? $postinfo_obj->rating_count : 0;
                //$comment_count = geodir_get_comments_number($ID);
                $post_ratings = geodir_get_postoverall($ID);
                // $post_ratings = geodir_get_commentoverall_number($ID);
                if (!$preview) {
                    if ($comment_count > 0) {
                        $post_avgratings = $post_ratings / $comment_count;
                    } else {
                        $post_avgratings = $post_ratings;
                    }
                    //$rating_star = geodir_get_rating_stars($post_avgratings,$ID,true);
                    $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
                    $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
                }
            }
            ?>
				
			<div class="geodir-bubble_desc">
				<h4>
					<a href="<?php 
            if ($plink != '') {
                echo $plink;
            } else {
                echo 'javascript:void(0);';
            }
            ?>
"><?php 
            echo $title;
            ?>
</a>
				</h4>
               <?php 
            if (isset($_SESSION['listing']) && isset($post_preview) && $post_preview != '') {
                $post_images = array();
                if (!empty($postinfo_obj->post_images)) {
                    $post_images = explode(",", $postinfo_obj->post_images);
                }
                if (!empty($post_images)) {
                    ?>
					
					<div class="geodir-bubble_image" >
					<a href="<?php 
                    if ($plink != '') {
                        echo $plink;
                    } else {
                        echo 'javascript:void(0);';
                    }
                    ?>
">
					<img style="max-height:50px;" src="<?php 
                    echo $post_images[0];
                    ?>
" />
					</a>
					</div> 
				<?php 
                }
            } else {
                if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
                    ?>
				<div class="geodir-bubble_image" >
					<a href="<?php 
                    echo $plink;
                    ?>
">
					<?php 
                    echo $image;
                    ?>
					</a>
				</div> 
				<?php 
                }
            }
            ?>
                
                
                
				
                
              <div class="geodir-bubble-meta-side">
				<span class="geodir_address"><i class="fa fa-home"></i> <?php 
            echo $address . ', ' . $city;
            ?>
</span>
				<?php 
            if ($contact) {
                ?>
<span class="geodir_contact"><i class="fa fa-phone"></i> <?php 
                echo $contact;
                ?>
</span><?php 
            }
            ?>
				<?php 
            if ($timing) {
                ?>
<span class="geodir_timing"><i class="fa fa-clock-o"></i> <?php 
                echo $timing;
                ?>
</span><?php 
            }
            ?>
              </div>
             
            <?php 
            if (isset($postinfo_obj->recurring_dates)) {
                $recuring_data = unserialize($postinfo_obj->recurring_dates);
                //print_r($recuring_data); echo '###';
                $output = '';
                $output .= '<div class="geodir_event_schedule">';
                $event_recurring_dates = explode(',', $recuring_data['event_recurring_dates']);
                $starttimes = isset($recuring_data['starttime']) ? $recuring_data['starttime'] : '';
                $endtimes = isset($recuring_data['endtime']) ? $recuring_data['endtime'] : '';
                $e = 0;
                foreach ($event_recurring_dates as $key => $date) {
                    if (strtotime($date) < strtotime(date("Y-m-d"))) {
                        continue;
                    }
                    // if the event is old don't show it on the map
                    $e++;
                    if ($e == 2) {
                        break;
                    }
                    // only show 3 event dates
                    $output .= '<p>';
                    //$geodir_num_dates++;
                    if (isset($recuring_data['different_times']) && $recuring_data['different_times'] == '1') {
                        $starttimes = isset($recuring_data['starttimes'][$key]) ? $recuring_data['starttimes'][$key] : '';
                        $endtimes = isset($recuring_data['endtimes'][$key]) ? $recuring_data['endtimes'][$key] : '';
                    }
                    $sdate = strtotime($date . ' ' . $starttimes);
                    $edate = strtotime($date . ' ' . $endtimes);
                    if ($starttimes > $endtimes) {
                        $edate = strtotime($date . ' ' . $endtimes . " +1 day");
                    }
                    global $geodir_date_time_format;
                    $output .= '<i class="fa fa-caret-right"></i>' . date($geodir_date_time_format, $sdate);
                    //$output .=  __(' To', GEODIREVENTS_TEXTDOMAIN).' ';
                    $output .= '<br />';
                    $output .= '<i class="fa fa-caret-left"></i>' . date($geodir_date_time_format, $edate);
                    //.'<br />';
                    $output .= '</p>';
                }
                $output .= '</div>';
                echo $output;
            }
            if ($ID) {
                $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
                ?>

              <div class="geodir-bubble-meta-bottom">
                  <span class="geodir-bubble-rating"><?php 
                echo $rating_star;
                ?>
</span>
                  
                  <span class="geodir-bubble-fav"><?php 
                echo geodir_favourite_html($post_author, $ID);
                ?>
</span>
                  <span class="geodir-bubble-reviews"><a href="<?php 
                echo get_comments_link($ID);
                ?>
" class="geodir-pcomments"><i class="fa fa-comments"></i>
                            <?php 
                echo get_comments_number($ID);
                ?>
                                     </a></span>
              </div>
 
       <?php 
            }
            ?>
 
			       
			</div>             					
		</div>
	</div>
	<?php 
            $html = ob_get_clean();
            $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
            return $html;
        }
    }