/** * Outputs the add to favourite line for the current post if not add listing preview page. * * @global object $post The current post object. * @global bool $preview True if the current page is add listing preview page. False if not. * since 1.0.0 * @package GeoDirectory */ function geodir_add_to_favourite_link() { global $post, $preview; if (!$preview && geodir_is_page('detail')) { ?> <p class="edit_link"> <?php geodir_favourite_html($post->post_author, $post->ID); ?> </p> <?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); /** * Called after printing favorite html. * * @since 1.0.0 */ do_action('geodir_after_favorite_html', $post->ID, 'widget'); if ($post->post_author == get_current_user_id()) { $addplacelink = get_permalink(geodir_add_listing_page_id()); $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); $ajaxlink = geodir_get_ajax_url(); $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); ?> <span class="geodir-authorlink clearfix"> <?php
/** * 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; } }
/** * 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; } }
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; } }