function single_comment_output($comment, $args, $depth) { $GLOBALS['comment'] = $comment; global $post_comments; switch ($comment->comment_type) { case 'pingback': ?> <li class="trackback"> <p><?php _e('Trackback:', 'themerex'); ?> <?php comment_author_link(); edit_comment_link(__('Edit', 'themerex'), '<span class="edit-link">', '<span>'); ?> </p> <?php break; case 'trackback': ?> <li class="pingback"> <p><?php _e('Pingback:', 'themerex'); ?> <?php comment_author_link(); edit_comment_link(__('Edit', 'themerex'), '<span class="edit-link">', '<span>'); ?> </p> <?php break; default: $vote_max = get_custom_option('reviews_max_level'); $vote_points = get_comment_meta($comment->comment_ID, 'vote_points', true); $review_positive = get_comment_meta($comment->comment_ID, 'review_positive', true); $review_negative = get_comment_meta($comment->comment_ID, 'review_negative', true); $vote_results = trex_vote_results($vote_points, $vote_max); $author_id = $comment->user_id; $author_link = get_author_posts_url($author_id); $results_list = (array) json_decode($vote_points); ?> <li id="comment-<?php comment_ID(); ?> " <?php comment_class(); ?> > <?php if (count($results_list) == 1) { echo $vote_results; } ?> <div class="comment_author_avatar avatar"><?php echo get_avatar($comment, 65); ?> </div> <div class="comment_wrap"> <div class="comment_header"> <div class="comment_reply"><?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </div> <span class="comment_author"> <?php if ($author_id) { echo '<a href="' . $author_link . '">'; } comment_author(); if ($author_id) { echo '</a>'; } ?> </span> <span class="comment_date"><i class="icon-clock-1"></i><?php echo get_comment_date('Y M d / H:i'); ?> </span> <?php if ($depth < $args['max_depth']) { ?> <?php } ?> </div> <div class="authorInfo"> <?php if ($comment->comment_approved == 0) { ?> <div class="comment_not_approved"><?php _e('Your comment is awaiting moderation.', 'themerex'); ?> </div> <?php } ?> <?php comment_text(); ?> <div class="comment_content"> <?php if (count($results_list) > 1) { echo $vote_results; } if (!empty($review_positive) || !empty($review_negative)) { echo '<div class="comment_reviews">'; if (!empty($review_positive)) { echo '<div class="review_pos review"> <span class="label"><i class="icon-plus-squared"></i>' . __('Positives', 'themerex') . '</span> <div class="review_text">' . $review_positive . '</div></div>'; } if (!empty($review_negative)) { echo '<div class="review_neg review"> <span class="label"><i class="icon-minus-squared"></i>' . __('Negatives', 'themerex') . '</span> <div class="review_text">' . $review_negative . '</div></div>'; } echo '</div>'; } ?> </div> </div> </div> <?php break; } }
function sc_review_panel($atts, $content = null) { extract(shortcode_atts(array("id" => "", "post_id" => "", "title" => "", "max" => "100", "desc" => "", "align" => "", "width" => "-1", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)); global $THEMEREX_reviews_max, $THEMEREX_criterias_list; $THEMEREX_reviews_max = $max != 0 ? $max : 100; $width = (int) str_replace('%', '', $width); $s = ($top > 0 ? 'padding-top:' . $top . 'px;' : '') . ($bottom > 0 ? 'padding-bottom:' . $bottom . 'px;' : '') . ($left > 0 ? 'padding-left:' . $left . 'px;' : '') . ($right > 0 ? 'padding-right:' . $right . 'px;' : '') . ($width > 0 ? 'width:' . $width . 'px;' : '') . ($align == 'left' || $align == 'right' ? 'float: ' . $align : ($align == 'center' ? 'margin: 0 auto;' : '')); if (!empty($post_id)) { $title = empty($title) ? get_the_title($post_id) : $title; if (empty($desc)) { $post = get_post($post_id); $post_excerpt = !empty($post->post_excerpt) ? $post->post_excerpt : ''; $post_excerpt = do_shortcode($post_excerpt); $desc = $post_excerpt; } $post_cust = get_post_custom($post_id); $post_opts = !empty($post_cust['post_custom_options'][0]) ? unserialize($post_cust['post_custom_options'][0]) : ''; $review_marks = !empty($post_opts['reviews_marks']) ? $post_opts['reviews_marks'] : ''; $reviews_points = !empty($review_marks) ? explode(',', $review_marks) : ''; $review_criterias = get_custom_option('reviews_criterias', '', $post_id); $criterias_points = array(); if (!empty($review_criterias) && !empty($reviews_points)) { foreach ($review_criterias as $key => $criteria) { $criterias_points[$criteria] = $reviews_points[$key]; } } if (!empty($criterias_points)) { $content = trex_vote_results($criterias_points, $max, $width); } } else { $content = do_shortcode($content); $content = trex_vote_results($THEMEREX_criterias_list, $max, $width); } $output = '<div class="sc_review_panel" style="' . $s . '"> ' . (!empty($title) ? '<h3 class="sc_review_title">' . $title . '</h3>' : '') . ' <div class="sc_review_inner">'; $output .= $content; $output .= '</div> ' . (!empty($desc) ? '<div class="sc_review_desc">' . $desc . '</div>' : '') . ' </div>'; return $output; }
$criteria_points[$criteria] = $votes_list[$key]; } if ($use_tabs) { $users_total_block = trex_avg_total_score($author_avg_to_view, $author_avg); } $author_short_decs = '<div class="short_descr">' . getShortString(strip_tags($post_data['post_excerpt']), 100) . '</div>'; $author_full_decs = '<div class="full_descr">' . $post_data['post_excerpt'] . '</div>'; $user_short_desc = '<div class="short_descr">This section displays an average rating from all users according to specified criteria. Total number of ratings ' . $user_total_votes . '</div>'; $user_reviews_output .= $user_short_desc; /**/ $output = $marks = $users = ''; if ($use_tabs) { $author_tab = '<li class="squareButton"><a href="#author-tabs"><span>' . $author_avg_to_view . '</span>' . __('Editor rating', 'themerex') . '</a></li>'; $users_tab = '<li class="squareButton"><a href="#users-tabs"><span>' . $user_reviews_avg_to_view . '</span>' . __('Users rating', 'themerex') . '</a></li>'; $output .= '<div class="popularFiltr"><ul>' . ($reviews_first_author ? $author_tab . $users_tab : $users_tab . $author_tab) . '</ul></div>'; } // Criterias list $author_reviews_output = trex_vote_results($criteria_points, $vote_max, $width); $author_reviews_output .= !empty($users_total_block) ? $users_total_block : ''; $output .= '<div class="ratingStars" id="author-tabs"><div class="tab_block_inner">' . $author_reviews_output . (count($criterias_list) <= 1 ? $author_full_decs : $author_short_decs) . '</div></div>'; // Users marks if ((!$reviews_first_author || !$reviews_second_hide) && $use_tabs) { $output .= '<div class="ratingStars" id="users-tabs"' . (!$output ? ' style="display: block;"' : '') . '>' . $user_reviews_output . '</div>'; } $THEMEREX_REVIEWS_RATING .= $output . '</div>'; //if (get_custom_option('show_sidebar_main') == 'fullwidth') { echo $THEMEREX_REVIEWS_RATING; echo count($criterias_list) == 1 ? '<div class="sc_divider"></div>' : ''; $THEMEREX_REVIEWS_RATING = ''; // } }