/** * Output the current post overall review and a small image compatible with google hreviews. * * @global WP_Post|null $post The current post, if available. * @global bool $preview True if the current page is add listing preview page. False if not. * @global object $post_images Image objects of current post if available. * @since 1.0.0 * @package GeoDirectory */ function geodir_detail_page_review_rating() { global $post, $preview, $post_images; ob_start(); // Start buffering; /** * This is called before the rating html in the function geodir_detail_page_review_rating(). * * This is called outside the check for an actual rating and the check for preview page. * * @since 1.0.0 */ do_action('geodir_before_detail_page_review_rating'); $comment_count = geodir_get_review_count_total($post->ID); $post_avgratings = geodir_get_post_rating($post->ID); if ($post_avgratings != 0 && !$preview) { /** * This is called before the rating html in the function geodir_detail_page_review_rating(). * * This is called inside the check for an actual rating and the check for preview page. * * @since 1.0.0 * @param float $post_avgratings Average rating for the surrent post. * @param int $post->ID Current post ID. */ 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) || strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3 ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</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 (isset($post_img) && $post_img) { $html .= '<br /><img src="' . $post_img . '" class="photo hreview-img" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo hreview-img" />'; } $html .= '</span>'; echo $html .= '</div>'; /** * This is called after the rating html in the function geodir_detail_page_review_rating(). * * This is called inside the check for an actual rating and the check for preview page. * * @since 1.0.0 * @param float $post_avgratings Average rating for the surrent post. * @param int $post->ID Current post ID. */ do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID); } /** * This is called before the rating html in the function geodir_detail_page_review_rating(). * * This is called outside the check for an actual rating and the check for preview page. * * @since 1.0.0 */ do_action('geodir_after_detail_page_review_rating'); $content_html = ob_get_clean(); if (trim($content_html) != '') { $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; } if ((int) get_option('geodir_disable_rating_info_section') != 1) { /** * Filter the geodir_detail_page_review_rating() function content. * * @since 1.0.0 * @param string $content_html The output html of the geodir_detail_page_review_rating() function. */ echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html); } }
?> <?php /** This action is documented in geodirectory-templates/listing-listview.php */ do_action('geodir_after_listing_post_excerpt', $post); ?> </div> <!-- gd-content ends here--> <footer class="geodir-entry-meta"> <div class="geodir-addinfo clearfix"> <?php $review_show = geodir_is_reviews_show('listview'); if ($review_show) { $post_avgratings = geodir_get_post_rating($post->ID); /** This action is documented in geodirectory-templates/listing-listview.php */ do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); echo geodir_get_rating_stars($post_avgratings, $post->ID); /** This action is documented in geodirectory-templates/listing-listview.php */ do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); ?> <a href="<?php comments_link(); ?> " class="geodir-pcomments"><i class="fa fa-comments"></i> <?php geodir_comments_number($post->rating_count); ?> </a> <?php } geodir_favourite_html($post->post_author, $post->ID); /**
/** * Returns the recent reviews. * * @since 1.0.0 * @package GeoDirectory * @param int $g_size Optional. Avatar size in pixels. Default 60. * @param int $no_comments Optional. Number of reviews you want to display. Default: 10. * @param int $comment_lenth Optional. Maximum number of characters you want to display. After that read more link will appear. * @param bool $show_pass_post Optional. Not yet implemented. * @global object $wpdb WordPress Database object. * @return string Returns the recent reviews html. */ function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) { global $wpdb, $tablecomments, $tableposts, $rating_table_name; $tablecomments = $wpdb->comments; $tableposts = $wpdb->posts; $comments_echo = ''; //print_r($_SESSION); $city_filter = ''; $region_filter = ''; $country_filter = ''; if (isset($_SESSION['gd_multi_location'])) { if (isset($_SESSION['gd_country']) && $_SESSION['gd_country']) { $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $_SESSION['gd_country'])); } if (isset($_SESSION['gd_region']) && $_SESSION['gd_region']) { $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $_SESSION['gd_region'])); } if (isset($_SESSION['gd_city']) && $_SESSION['gd_city']) { $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $_SESSION['gd_city'])); } } /*if(isset($_SESSION['all_near_me'])){ $mylat = $_SESSION['user_lat']; $mylon = $_SESSION['user_lon']; if(isset($_SESSION['near_me_range']) && is_numeric($_SESSION['near_me_range'])){$dist =$_SESSION['near_me_range']; } elseif(get_option('geodir_near_me_dist')!=''){$dist = get_option('geodir_near_me_dist');} else{ $dist = '200'; } $lon1 = $mylon- $dist/abs(cos(deg2rad($mylat))*69); $lon2 = $mylon+$dist/abs(cos(deg2rad($mylat))*69); $lat1 = $mylat-($dist/69); $lat2 = $mylat+($dist/69); $rlon1 = is_numeric(min($lon1,$lon2)) ? min($lon1,$lon2) : ''; $rlon2 = is_numeric(max($lon1,$lon2)) ? max($lon1,$lon2) : ''; $rlat1 = is_numeric(min($lat1,$lat2)) ? min($lat1,$lat2) : ''; $rlat2 = is_numeric(max($lat1,$lat2)) ? max($lat1,$lat2) : ''; $country_filter =''; $region_filter = ''; $city_filter = " AND post_latitude between $rlat1 and $rlat2 AND post_longitude between $rlon1 and $rlon2 "; $join = }*/ $review_table = GEODIR_REVIEW_TABLE; $request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM {$review_table} as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 {$country_filter} {$region_filter} {$city_filter} ORDER BY r.post_date DESC, r.id DESC LIMIT {$no_comments}"; //$request = "SELECT r.*,c.* FROM $review_table r JOIN $wpdb->comments c ON r.comment_ID=c.comment_ID WHERE r.post_status = 1 AND r.status =1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments"; //echo $request; $comments = $wpdb->get_results($request); foreach ($comments as $comment) { // Set the extra comment info needed. $comment_extra = $wpdb->get_row("SELECT * FROM {$wpdb->comments} WHERE comment_ID ={$comment->comment_ID}"); //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; $comment->comment_content = $comment_extra->comment_content; $comment->comment_author = $comment_extra->comment_author; $comment->comment_author_email = $comment_extra->comment_author_email; $comment_id = ''; $comment_id = $comment->comment_ID; $comment_content = strip_tags($comment->comment_content); $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content); $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID; $comment_author_email = $comment->comment_author_email; $comment_post_ID = $comment->post_id; $na = true; if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) { $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); if ($comment_post_ID == $comment_post_ID2) { } else { $na = false; } } $post_title = get_the_title($comment_post_ID); $permalink = get_permalink($comment_post_ID); $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>'; $comment_content_length = strlen($comment_content); if ($comment_content_length > $comment_lenth) { $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more; } else { $comment_excerpt = $comment_content; } if ($comment->user_id) { $user_profile_url = get_author_posts_url($comment->user_id); } else { $user_profile_url = ''; } if ($comment_id && $na) { $comments_echo .= '<li class="clearfix">'; $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; if (function_exists('get_avatar')) { if (!isset($comment->comment_type)) { if ($user_profile_url) { $comments_echo .= '<a href="' . $user_profile_url . '">'; } $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); if ($user_profile_url) { $comments_echo .= '</a>'; } } elseif (isset($comment->comment_type) && $comment->comment_type == 'trackback' || isset($comment->comment_type) && $comment->comment_type == 'pingback') { if ($user_profile_url) { $comments_echo .= '<a href="' . $user_profile_url . '">'; } $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); } } elseif (function_exists('gravatar')) { if ($user_profile_url) { $comments_echo .= '<a href="' . $user_profile_url . '">'; } $comments_echo .= "<img src=\""; if ('' == $comment->comment_type) { $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); if ($user_profile_url) { $comments_echo .= '</a>'; } } elseif ('trackback' == $comment->comment_type || 'pingback' == $comment->comment_type) { if ($user_profile_url) { $comments_echo .= '<a href="' . $user_profile_url . '">'; } $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); if ($user_profile_url) { $comments_echo .= '</a>'; } } $comments_echo .= "\" alt=\"\" class=\"avatar\" />"; } $comments_echo .= "</span>\n"; $comments_echo .= '<span class="geodir_reviewer_content">'; if ($comment->user_id) { $comments_echo .= '<a href="' . get_author_posts_url($comment->user_id) . '">'; } $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; if ($comment->user_id) { $comments_echo .= '</a>'; } $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> '; $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt); $comments_echo .= '</p>'; $comments_echo .= "</span>\n"; $comments_echo .= '</li>'; } } return $comments_echo; }
/** * Add rating information in comment text. * * @since 1.0.0 * @package GeoDirectory * @param string $content The comment content. * @param object|string $comment The comment object. * @return string The comment content. */ function geodir_wrap_comment_text($content, $comment = '') { $rating = 0; if (!empty($comment)) { $rating = geodir_get_commentoverall($comment->comment_ID); } if ($rating != 0 && !is_admin()) { return '<div>' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>'; } else { return $content; } }
/** * Set post Map Marker info html. * * @since 1.0.0 * @package GeoDirectory * @global array $geodir_addon_list List of active GeoDirectory extensions. * @param object $postinfo_obj The post details object. * @param string $post_preview Is this a post preview?. * @return mixed|string|void */ function geodir_get_infowindow_html($postinfo_obj, $post_preview = '') { global $preview; $srcharr = array("'", "/", "-", '"', '\\'); $replarr = array("′", "⁄", "–", "“", ''); 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); $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 $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)); } // filter field as per price package global $geodir_addon_list; if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { $post_type = get_post_type($ID); $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL; $field_name = 'geodir_contact'; if (!check_field_visibility($package_id, $field_name, $post_type)) { $contact = ''; } $field_name = 'geodir_timing'; if (!check_field_visibility($package_id, $field_name, $post_type)) { $timing = ''; } } if ($lat && $lng) { ob_start(); ?> <div class="gd-bubble" style="height: 100px;max-height: 100px;"> <div class="gd-bubble-inside"> <?php $comment_count = ''; $rating_star = ''; if ($ID != '') { $rating_star = ''; $comment_count = geodir_get_review_count_total($ID); if (!$preview) { $post_avgratings = geodir_get_post_rating($ID); $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false); /** * Filter to change rating stars * * You can use this filter to change Rating stars. * * @since 1.0.0 * @package GeoDirectory * @param string $rating_star Rating stars. * @param float $post_avgratings Average ratings of the post. * @param int $ID The post ID. */ $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 alt="bubble image" 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; ?> </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 } /** * Fires after the meta info in the map info window. * * This can be used to add more info to the map info window after the normal meta info. * * @since 1.4.2 * @param object $postinfo_obj The posts info as an object. * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * */ do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview); ?> </div> <?php if (isset($postinfo_obj->recurring_dates)) { $recuring_data = unserialize($postinfo_obj->recurring_dates); $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-fade"></div> <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(); /** * Filter to change infowindow html * * You can use this filter to change infowindow html. * * @since 1.0.0 * @package GeoDirectory * @param string $html Infowindow html. * @param object $postinfo_obj The Post object. * @param bool|string $post_preview Is this a post preview? */ $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview); return $html; } }
/** * Set post Map Marker info html. * * @since 1.0.0 * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before". * @package GeoDirectory * @global array $geodir_addon_list List of active GeoDirectory extensions. * @param object $postinfo_obj The post details object. * @param string $post_preview Is this a post preview?. * @return mixed|string|void */ function geodir_get_infowindow_html($postinfo_obj, $post_preview = '') { global $preview; $srcharr = array("'", "/", "-", '"', '\\'); $replarr = array("′", "⁄", "–", "“", ''); 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); $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 $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)); } // filter field as per price package global $geodir_addon_list; if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { $post_type = get_post_type($ID); $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL; $field_name = 'geodir_contact'; if (!check_field_visibility($package_id, $field_name, $post_type)) { $contact = ''; } $field_name = 'geodir_timing'; if (!check_field_visibility($package_id, $field_name, $post_type)) { $timing = ''; } } if ($lat && $lng) { ob_start(); ?> <div class="gd-bubble" style=""> <div class="gd-bubble-inside"> <?php $comment_count = ''; $rating_star = ''; if ($ID != '') { $rating_star = ''; $comment_count = geodir_get_review_count_total($ID); if (!$preview) { $post_avgratings = geodir_get_post_rating($ID); $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false); /** * Filter to change rating stars * * You can use this filter to change Rating stars. * * @since 1.0.0 * @package GeoDirectory * @param string $rating_star Rating stars. * @param float $post_avgratings Average ratings of the post. * @param int $ID The post ID. */ $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 alt="bubble image" style="max-height:50px;" src="<?php echo $post_images[0]; ?> "/></a></div> <?php } else { echo '<div class="geodir-bubble_image"></div>'; } } 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 } else { echo '<div class="geodir-bubble_image"></div>'; } } ?> <div class="geodir-bubble-meta-side"> <?php /** * Fires before the meta info in the map info window. * * This can be used to add more info to the map info window before the normal meta info. * * @since 1.5.4 * @param int $ID The post id. * @param object $postinfo_obj The posts info as an object. * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * */ do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview); ?> <span class="geodir_address"><i class="fa fa-home"></i> <?php echo $address; ?> </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 } /** * Fires after the meta info in the map info window. * * This can be used to add more info to the map info window after the normal meta info. * * @since 1.4.2 * @param object $postinfo_obj The posts info as an object. * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * */ do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview); ?> </div> <?php if ($ID) { $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID); ?> <div class="geodir-bubble-meta-fade"></div> <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(); /** * Filter to change infowindow html * * You can use this filter to change infowindow html. * * @since 1.0.0 * @package GeoDirectory * @param string $html Infowindow html. * @param object $postinfo_obj The Post object. * @param bool|string $post_preview Is this a post preview? */ $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview); return $html; } }
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("′", "⁄", "–", "“", ''); 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; } }