/**
 * Adds overall rating to the admin comments.
 *
 * @since 1.0.0
 * @package GeoDirectory_Review_Rating_Manager
 *
 * @param array $a Comment actions.
 * @return mixed
 */
function geodir_reviewrating_comment_meta_row_action($a)
{
    global $comment;
    $rating = geodir_get_commentoverall($comment->comment_ID);
    if ($rating != 0) {
        $comment_ratings = geodir_reviewrating_get_comment_rating_by_id($comment->comment_ID);
        echo geodir_reviewrating_draw_overall_rating($comment_ratings->overall_rating);
    }
    return $a;
}
Пример #2
0
/**
 * HTML for rating stars
 *
 * This is the main HTML markup that displays rating stars.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @param float $rating The post average rating.
 * @param int $post_id The post ID.
 * @param bool $small Optional. Display as small ratings? Default: false.
 * @return string Rating HTML.
 */
function geodir_get_rating_stars($rating, $post_id, $small = false)
{
    $a_rating = $rating / 5 * 100;
    if ($small) {
        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
    } else {
        if (function_exists('geodir_reviewrating_draw_overall_rating')) {
            // Show rating stars from review rating manager
            $r_html = geodir_reviewrating_draw_overall_rating($rating);
        } else {
            $rating_img = '<img alt="rating icon" src="' . get_option('geodir_default_rating_star_icon') . '" />';
            /* fix rating star for safari */
            $star_width = 23 * 5;
            //global $is_safari, $is_iphone, $ios, $is_chrome;
            //$attach_style = ( $is_safari || $is_iphone || $ios || $is_chrome ) && $star_width > 0 ? 'width:' . $star_width . 'px;max-width:none' : '';
            if ($star_width > 0) {
                $attach_style = 'max-width:' . $star_width . 'px';
            } else {
                $attach_style = '';
            }
            $r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
        }
    }
    return $r_html;
}
/**
 * Display reviews in GD settings 'reviews' tab.
 *
 * @since 1.0.0
 * @package GeoDirectory_Review_Rating_Manager
 *
 * @param array $geodir_reviews Reviews array.
 */
function geodir_reviewrating_show_comments($geodir_reviews = array())
{
    echo '<ul>';
    if (!empty($geodir_reviews)) {
        foreach ($geodir_reviews as $comment) {
            ?>
            <li id="comment-<?php 
            echo $comment->comment_ID;
            ?>
"  >
                <div class="clearfix">
                    <div class="comment-info">
                        <div class="clearfix">
                            <form>
                           		<input name="chk-action[]" type="checkbox" value="<?php 
            echo $comment->comment_ID;
            ?>
" />
                            </form>
                            <div class="post-info">
                            	<h2 class="comment-post-title"><?php 
            echo $comment->post_title;
            ?>
</h2>
															
															<?php 
            $comment_ratings = geodir_reviewrating_get_comment_rating_by_id($comment->comment_ID);
            $overall_html = geodir_reviewrating_draw_overall_rating($comment_ratings->overall_rating);
            echo '<span>' . $overall_html . '</span>';
            ?>
															
                            	<p><?php 
            echo wpautop(stripslashes($comment->comment_content));
            ?>
</p>
                                
                                
                               
															 <div class="post-action clearfix">
																
															<?php 
            if ($comment->comment_approved == '0') {
                ?>
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="approvecomment"><a href="javascript:void(0);"><?php 
                _e('Approve', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="spamcomment"><a href="javascript:void(0);"><?php 
                _e('Spam', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="trashcomment"><a href="javascript:void(0);"><?php 
                _e('Trash', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<?php 
            } elseif ($comment->comment_approved == '1') {
                ?>
																	
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="unapprovecomment"><a href="javascript:void(0);"><?php 
                _e('Unapprove', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="spamcomment"><a href="javascript:void(0);"><?php 
                _e('Spam', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="trashcomment"><a href="javascript:void(0);"><?php 
                _e('Trash', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<?php 
            } elseif ($comment->comment_approved == 'spam') {
                ?>
																	
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="unspamcomment"><a href="javascript:void(0);"><?php 
                _e('Not Spam', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="deletecomment"><a href="javascript:void(0);"><?php 
                _e('Delete Permanently', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<?php 
            } elseif ($comment->comment_approved == 'trash') {
                ?>
																	
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="untrashcomment"><a href="javascript:void(0);"><?php 
                _e('Restore', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="deletecomment"><a href="javascript:void(0);"><?php 
                _e('Delete Permanently', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																	<?php 
            }
            ?>
                
<?php 
            $multirating_over_all = unserialize($comment->ratings);
            //if($multirating_over_all[1] != 0) {
            if (is_array($multirating_over_all) && array_filter($multirating_over_all)) {
                /* if all values not empty */
                ?>
                                <span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="ratingshowhide" ><a href="javascript:void(0);"><?php 
                _e('Show Multi Ratings', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																
	<?php 
            }
            ?>
                                                                
                                                                					<?php 
            if ($comment->comment_images != '') {
                ?>
																<span comment_id="<?php 
                echo $comment->comment_ID;
                ?>
" action="commentimages" ><a href="javascript:void(0);"><?php 
                _e('Show Images', GEODIRREVIEWRATING_TEXTDOMAIN);
                ?>
</a></span>
																<?php 
            }
            ?>
																
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="author-info">                                 
                        <div class="clearfix"> 
                            <div class="avtar-img">
                            	<?php 
            echo get_avatar($comment->user_id, 60);
            ?>
 
                            </div>
                            <div class="author-name">                                      
                            	<?php 
            echo $comment->comment_author;
            ?>
                            	<span><?php 
            echo $comment->comment_author_email;
            ?>
</span>
                            	<span><?php 
            if (isset($comment->omment_author_IP)) {
                echo $comment->omment_author_IP;
            }
            ?>
</span>
                            </div>
                        </div>                                 
                        <span class="time">Submitted on:
                        <?php 
            if (!function_exists('how_long_ago')) {
                echo get_comment_date('M d, Y', $comment->comment_ID);
            } else {
                echo get_comment_time('M d, Y');
            }
            ?>
                        </span>
                    </div>
									
                </div>
								<?php 
            $ratings = @unserialize($comment_ratings->ratings);
            $ratings_html = geodir_reviewrating_draw_ratings($ratings);
            echo '<div class="edit-form-comment-rating" style="display:none;">' . $ratings_html . '</div>';
            ?>
									
									<div class="edit-form-comment-images" style="display:none;">
									
									<?php 
            if ($comment->comment_images != '') {
                $comment_data = geodir_reviewrating_get_comment_images($comment->comment_id);
                echo $comment_data->html;
            }
            ?>
	
									</div>
            </li>
	<?php 
        }
    }
    echo '</ul>';
}