function rehub_format_score($size = 'small', $type = 'star') { if (vp_metabox('rehub_post.rehub_framework_post_type') == 'review') { $overall_score_icon = rehub_get_overall_score(); $total = $overall_score_icon * 10; if ($overall_score_icon != '0') { if ($type == 'star') { echo '<div class="star-' . $size . '"><span class="stars-rate"><span style="width: ' . $total . '%;"></span></span></div>'; } elseif ($type == 'square') { echo '<span class="overlay_post_formats review_formats_score">' . $overall_score_icon . '</span>'; } elseif ($type == 'line') { ?> <div class="rate-line rate-line-inner<?php if (rehub_option('color_type_review') == 'multicolor') { echo ' colored_rate_bar'; } ?> "> <div class="line" data-percent="<?php echo $total; ?> %"> <span class="filled r_score_<?php echo round($overall_score_icon); ?> "><?php echo $overall_score_icon; ?> </span> </div> </div> <?php } } } }
function set_content_end($content) { global $post; if (is_feed()) { return $content; } $output = ''; ob_start(); wp_link_pages(array('before' => '<div class="page-link">' . __('Pages:', 'rehub_child'), 'after' => '</div>')); $output .= ob_get_clean(); $offer_url_exist = get_post_meta($post->ID, 'rehub_offer_product_url', true); if (!empty($offer_url_exist)) { $offer_shortcode = get_post_meta($post->ID, 'rehub_offer_shortcode', true); if (empty($offer_shortcode)) { ob_start(); echo '<div class="lined_r_title">' . __('Where to buy', 'rehub_child') . '</div>'; rehub_quick_offer(); $output .= ob_get_clean(); } } elseif (vp_metabox('rehub_post.rehub_framework_post_type') == 'review') { if (vp_metabox('rehub_post.review_post.0.review_post_product.0.review_post_offer_shortcode') != '1' && vp_metabox('rehub_post.review_post.0.review_post_schema_type') == 'review_post_review_product') { ob_start(); echo '<div class="lined_r_title">' . __('Where to buy', 'rehub_child') . '</div>'; rehub_get_offer(); $output .= ob_get_clean(); } if (vp_metabox('rehub_post.review_post.0.review_aff_product.0.review_aff_offer_shortcode') != '1' && vp_metabox('rehub_post.review_post.0.review_post_schema_type') == 'review_aff_product') { ob_start(); echo '<div class="lined_r_title">' . __('Where to buy', 'rehub_child') . '</div>'; rehub_get_aff_offer(); $output .= ob_get_clean(); } if (vp_metabox('rehub_post.review_post.0.review_woo_product.0.review_woo_offer_shortcode') != '1' && vp_metabox('rehub_post.review_post.0.review_post_schema_type') == 'review_woo_product') { $review_woo_link = vp_metabox('rehub_post.review_post.0.review_woo_product.0.review_woo_link'); ob_start(); echo '<div class="lined_r_title">' . __('Where to buy', 'rehub_child') . '</div>'; rehub_get_woo_offer($review_woo_link); $output .= ob_get_clean(); } if (vp_metabox('rehub_post.review_post.0.review_woo_list.0.review_woo_list_shortcode') != '1' && vp_metabox('rehub_post.review_post.0.review_post_schema_type') == 'review_woo_list') { $review_woo_list_links = vp_metabox('rehub_post.review_post.0.review_woo_list.0.review_woo_list_links'); if (is_array($review_woo_list_links)) { $review_woo_list_links = implode(',', $review_woo_list_links); } ob_start(); echo '<div class="lined_r_title">' . __('Where to buy', 'rehub_child') . '</div>'; rehub_get_woo_list($data_source = 'ids', $type = '', $cat = '', $tag = '', $ids = $review_woo_list_links); $output .= ob_get_clean(); } } if (vp_metabox('rehub_post.rehub_framework_post_type') == 'review' && vp_metabox('rehub_post.review_post.0.review_post_product_shortcode') == '0') { $overal_score = rehub_get_overall_score(); $postAverage = get_post_meta(get_the_ID(), 'post_user_average', true); ob_start(); if (rehub_option('type_user_review') == 'full_review' && ($postAverage != '0' && $postAverage != '')) { echo '<div class="lined_r_title">' . __('Review Score', 'rehub_child') . '</div>'; } elseif ($overal_score != '0' && $overal_score != '') { echo '<div class="lined_r_title">' . __('Review Score', 'rehub_child') . '</div>'; } rehub_get_review(); $output .= ob_get_clean(); } return $content . $output; }
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $tags = $instance['tags']; $number = $instance['number']; $post_type = $instance['post_type']; global $post; if ($post_type == 'tags') { $query = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'tag' => $tags); } elseif ($post_type == 'featured') { $query = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => 'is_featured', 'meta_value' => '1'); } else { $query = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => 'is_featured', 'meta_value' => '1'); } $loop = new WP_Query($query); /* Before widget (defined by themes). */ echo $before_widget; if ($loop->have_posts()) { /* Display the widget title if one was input (before and after defined by themes). */ if ($title) { echo $before_title . $title . $after_title; } ?> <?php wp_enqueue_script('flexslider'); ?> <div class="slides"> <?php while ($loop->have_posts()) { $loop->the_post(); ?> <div class="slide"> <div class="wrap"> <a href="<?php the_permalink(); ?> " class="view-link"> <span class="pattern"></span> <div class="image"><?php wpsm_thumb('grid_news'); ?> </div> <?php if (vp_metabox('rehub_post.rehub_framework_post_type') == 'review') { ?> <span class="score"><i><?php echo rehub_get_overall_score(); ?> </i><?php _e('SCORE', 'rehub_framework'); ?> </span><?php } ?> <?php $category = get_the_category($post->ID); $first_cat = $category[0]->term_id; $cat_name = get_cat_name($first_cat); ?> <span class="reviews"><?php echo $cat_name; ?> </span> </a> <h3><a class="link" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h3> <p><?php kama_excerpt('maxchar=100'); ?> </p> </div> </div> <?php } ?> </div> <?php wp_reset_query(); ?> <?php } else { _e('No posts for this criteria.', 'rehub_framework'); ?> <?php } ?> <?php /* After widget (defined by themes). */ echo $after_widget; }
</div> </div> <?php } elseif ($rating_circle == '2') { ?> <div class="score square_score"> <span class="it_score"><?php echo rehub_get_overall_score(); ?> </span></div> <?php } else { ?> <div class="score"> <span class="it_score"><?php echo rehub_get_overall_score(); ?> </span></div> <?php } ?> <a href="<?php the_permalink(); ?> " class="read_full" target="_blank"><?php if (rehub_option('rehub_review_text') != '') { echo rehub_option('rehub_review_text'); } else { _e('Read review', 'rehub_framework'); } ?>
" alt="<?php echo esc_attr($offer_title_first); ?> " /> <?php } ?> </div> <div class="product-summary col_item"> <?php if (vp_metabox('rehub_post.rehub_framework_post_type') == 'review' && rehub_get_overall_score() != '0') { ?> <?php $overal_score = rehub_get_overall_score(); ?> <div class="rate_bar_wrap top_score_wrap<?php if (rehub_option('type_user_review') == 'full_review' && ($postAverage != '0' && $postAverage != '')) { echo ' two_rev'; } if (rehub_option('color_type_review') == 'multicolor') { echo ' colored_rate_bar'; } ?> "> <div class="review-top" > <div class="overall-score"> <span class="overall r_score_<?php echo round($overal_score); ?>
function wpsm_toprating_shortcode($atts, $content = null) { extract(shortcode_atts(array('id' => '', 'full_width' => '0'), $atts)); if (isset($atts['id']) && $atts['id']) { $toppost = get_post($atts['id']); $module_cats = get_post_meta($toppost->ID, 'top_review_cat', true); $module_tag = get_post_meta($toppost->ID, 'top_review_tag', true); $module_fetch = get_post_meta($toppost->ID, 'top_review_fetch', true); $module_ids = get_post_meta($toppost->ID, 'manual_ids', true); $order_choose = get_post_meta($toppost->ID, 'top_review_choose', true); $module_desc = get_post_meta($toppost->ID, 'top_review_desc', true); $module_desc_fields = get_post_meta($toppost->ID, 'top_review_custom_fields', true); $rating_circle = get_post_meta($toppost->ID, 'top_review_circle', true); $module_field_sorting = get_post_meta($toppost->ID, 'top_review_field_sort', true); $module_order = get_post_meta($toppost->ID, 'top_review_order', true); if ($module_fetch == '') { $module_fetch = '10'; } if ($module_desc == '') { $module_desc = 'post'; } if ($rating_circle == '') { $rating_circle = '1'; } ob_start(); ?> <div class="clearfix"></div> <?php if ($order_choose == 'cat_choose') { ?> <?php $query = array('cat' => $module_cats, 'tag' => $module_tag, 'posts_per_page' => $module_fetch, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => 'rehub_review_overall_score', 'orderby' => 'meta_value_num', 'meta_query' => array(array('key' => 'rehub_framework_post_type', 'value' => 'review', 'compare' => 'LIKE'))); ?> <?php if (!empty($module_field_sorting)) { $query['meta_key'] = $module_field_sorting; } ?> <?php if ($module_order == 'asc') { $query['order'] = 'ASC'; } ?> <?php } elseif ($order_choose == 'manual_choose' && $module_ids != '') { ?> <?php $query = array('post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => -1, 'orderby' => 'post__in', 'post__in' => $module_ids); ?> <?php } else { ?> <?php $query = array('posts_per_page' => $module_fetch, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => 'rehub_review_overall_score', 'orderby' => 'meta_value_num', 'meta_query' => array(array('key' => 'rehub_framework_post_type', 'value' => 'review', 'compare' => 'LIKE'))); ?> <?php if (!empty($module_field_sorting)) { $query['meta_key'] = $module_field_sorting; } ?> <?php if ($module_order == 'asc') { $query['order'] = 'ASC'; } ?> <?php } ?> <?php $loop = new WP_Query($query); $i = 0; if ($loop->have_posts()) { ?> <div class="top_rating_block<?php if (isset($atts['full_width']) && $atts['full_width'] == '1') { ?> full_width_rating<?php } else { ?> with_sidebar_rating<?php } ?> list_style_rating"> <?php while ($loop->have_posts()) { $loop->the_post(); $i++; ?> <div class="top_rating_item" id='rank_<?php echo $i; ?> '> <div class="product_image_col"> <?php if (vp_metabox('rehub_post_side.is_editor_choice') == '1') { ?> <div class="ed_choice_label"><img src="<?php echo get_template_directory_uri(); ?> /images/editor_hor_badge.png" width="115" height="36" alt=""></div><?php } ?> <figure> <span class="rank_count"><?php if ($i == '1') { ?> <i class="fa fa-trophy"></i><?php } else { echo $i; } ?> </span> <a href="<?php the_permalink(); ?> "> <?php $img = get_post_thumb(); $nothumb = get_template_directory_uri() . '/images/default/noimage_100_70.png'; if (rehub_option('aq_resize_crop') == '1') { $params = array('width' => 100); } else { $params = array('width' => 100, 'height' => 100, 'crop' => true); } ?> <?php if (!empty($img)) { ?> <img src="<?php echo bfi_thumb($img, $params); ?> " alt="<?php the_title_attribute(); ?> " /> <?php } else { ?> <img src="<?php echo $nothumb; ?> " alt="<?php the_title_attribute(); ?> " /> <?php } ?> </a> </figure> </div> <div class="desc_col"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <p> <?php if ($module_desc == 'post') { ?> <?php kama_excerpt('maxchar=120'); ?> <?php } elseif ($module_desc == 'review') { ?> <?php echo wp_kses_post(vp_metabox('rehub_post.review_post.0.review_post_summary_text')); ?> <?php } elseif ($module_desc == 'field') { ?> <?php if (get_post_meta(get_the_ID(), $module_desc_fields, true)) { ?> <?php echo get_post_meta(get_the_ID(), $module_desc_fields, true); ?> <?php } ?> <?php } elseif ($module_desc == 'none') { ?> <?php } else { ?> <?php kama_excerpt('maxchar=120'); ?> <?php } ?> </p> <div class="star"><?php rehub_get_user_results('small', 'yes'); ?> </div> </div> <div class="rating_col"> <?php if ($rating_circle == '1') { ?> <?php $rating_score_clean = rehub_get_overall_score(); ?> <div class="top-rating-item-circle-view"> <div class="radial-progress" data-rating="<?php echo $rating_score_clean; ?> "> <div class="circle"> <div class="mask full"> <div class="fill"></div> </div> <div class="mask half"> <div class="fill"></div> <div class="fill fix"></div> </div> </div> <div class="inset"> <div class="percentage"><?php echo $rating_score_clean; ?> </div> </div> </div> </div> <?php } elseif ($rating_circle == '2') { ?> <div class="score square_score"> <span class="it_score"><?php echo rehub_get_overall_score(); ?> </span></div> <?php } else { ?> <div class="score"> <span class="it_score"><?php echo rehub_get_overall_score(); ?> </span></div> <?php } ?> </div> <div class="buttons_col"> <?php rehub_create_btn(''); ?> <a href="<?php the_permalink(); ?> " class="read_full"><?php if (rehub_option('rehub_review_text') != '') { echo rehub_option('rehub_review_text'); } else { _e('Read full review', 'rehub_framework'); } ?> </a> </div> </div> <?php } ?> </div> <?php wp_reset_query(); ?> <?php } else { _e('No posts for this criteria.', 'rehub_framework'); ?> <?php } ?> <?php $output = ob_get_contents(); ob_end_clean(); return $output; } }
the_title(); ?> </a></h2> <p> <?php kama_excerpt('maxchar=120'); ?> </p> <div class="star"><?php rehub_get_user_results('small', 'yes'); ?> </div> </div> <div class="rating_col"> <?php $rating_score_clean = rehub_get_overall_score(); ?> <div class="top-rating-item-circle-view"> <div class="radial-progress" data-rating="<?php echo $rating_score_clean; ?> "> <div class="circle"> <div class="mask full"> <div class="fill"></div> </div> <div class="mask half"> <div class="fill"></div> <div class="fill fix"></div> </div>
function rehub_get_review() { ?> <?php $schema = rehub_option('type_schema_review') == 'editor' ? ' itemtype="http://schema.org/Review" itemscope="" itemprop="review"' : ''; ?> <?php $overal_score = rehub_get_overall_score(); $postAverage = get_post_meta(get_the_ID(), 'post_user_average', true); ?> <div class="rate_bar_wrap<?php if (rehub_option('type_user_review') == 'full_review' && ($postAverage != '0' && $postAverage != '')) { echo ' two_rev'; } if (rehub_option('color_type_review') == 'multicolor') { echo ' colored_rate_bar'; } ?> "<?php echo $schema; ?> > <?php if (rehub_option('type_schema_review') == 'editor') { ?> <div style="display:none" itemprop="reviewBody"><?php echo wp_kses_post(vp_metabox('rehub_post.review_post.0.review_post_summary_text')); ?> </div> <?php if (get_the_author_meta('google')) { ?> <div class="vcard author disauthor" itemprop="author" itemscope itemtype="http://schema.org/Person"><strong class="fn" itemprop="name"><a href="<?php the_author_meta('google'); ?> ?rel=author">+<?php echo get_the_author(); ?> </a></strong></div> <?php } else { ?> <div class="vcard author disauthor" itemprop="author" itemscope itemtype="http://schema.org/Person"><strong class="fn" itemprop="name"><?php the_author_posts_link(); ?> </strong></div> <?php } ?> <?php } ?> <?php if ($overal_score != '0') { ?> <div class="review-top"> <?php if (rehub_option('type_schema_review') == 'user' && rehub_option('type_user_review') == 'full_review') { ?> <div class="overall-score" itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating"> <meta itemprop="worstRating" content="1" /> <meta itemprop="bestRating" content="10" /> <span class="overall r_score_<?php echo round($overal_score); ?> " itemprop="ratingValue"><?php echo round($overal_score, 1); ?> </span> <span class="overall-text"><?php _e('Total Score', 'rehub_framework'); ?> </span> <div class="overall-user-votes"><span itemprop="ratingCount"><?php $user_rates = get_post_meta(get_the_ID(), 'post_user_raitings', true); echo $user_rates['criteria'][0]['count']; ?> </span> <?php _e('reviews', 'rehub_framework'); ?> </div> </div> <?php } elseif (rehub_option('type_schema_review') == 'editor') { ?> <div class="overall-score" itemtype="http://schema.org/Rating" itemscope="" itemprop="reviewRating"> <meta itemprop="worstRating" content="1" /> <meta itemprop="bestRating" content="10" /> <span class="overall r_score_<?php echo round($overal_score); ?> " itemprop="ratingValue"><?php echo round($overal_score, 1); ?> </span> <span class="overall-text"><?php _e('Total Score', 'rehub_framework'); ?> </span> </div> <?php } else { ?> <div class="overall-score"> <span class="overall r_score_<?php echo round($overal_score); ?> "><?php echo round($overal_score, 1); ?> </span> <span class="overall-text"><?php _e('Total Score', 'rehub_framework'); ?> </span> </div> <?php } ?> <div class="review-text"> <span class="review-header"><?php echo vp_metabox('rehub_post.review_post.0.review_post_heading'); ?> </span> <p> <?php echo wp_kses_post(vp_metabox('rehub_post.review_post.0.review_post_summary_text')); ?> </p> </div> </div> <?php } ?> <?php $thecriteria = vp_metabox('rehub_post.review_post.0.review_post_criteria'); $firstcriteria = $thecriteria[0]['review_post_name']; ?> <?php if (rehub_option('type_user_review') == 'full_review' && ($postAverage != '0' && $postAverage != '')) { ?> <div class="rate_bar_wrap_two_reviews"> <?php if ($firstcriteria) { ?> <div class="review-criteria"> <div class="l_criteria"><span class="score_val r_score_<?php echo round(rehub_get_overall_score_editor()); ?> "><?php echo rehub_get_overall_score_editor(); ?> </span><span class="score_tit"><?php _e('Editor\'s score', 'rehub_framework'); ?> </span></div> <div class="r_criteria"> <?php foreach ($thecriteria as $criteria) { ?> <?php $perc_criteria = $criteria['review_post_score'] * 10; ?> <div class="rate-bar clearfix" data-percent="<?php echo $perc_criteria; ?> %"> <div class="rate-bar-title"><span><?php echo $criteria['review_post_name']; ?> </span></div> <div class="rate-bar-bar r_score_<?php echo round($criteria['review_post_score']); ?> "></div> <div class="rate-bar-percent"><?php echo $criteria['review_post_score']; ?> </div> </div> <?php } ?> </div> </div> <?php } ?> <?php $user_rates = get_post_meta(get_the_ID(), 'post_user_raitings', true); $usercriterias = $user_rates['criteria']; ?> <div class="review-criteria user-review-criteria"> <div class="l_criteria"><span class="score_val r_score_<?php echo round($postAverage); ?> "><?php echo $postAverage; ?> </span><span class="score_tit"><?php _e('User\'s score', 'rehub_framework'); ?> </span></div> <div class="r_criteria"> <?php foreach ($usercriterias as $usercriteria) { ?> <?php $perc_criteria = $usercriteria['average'] * 10; ?> <div class="rate-bar user-rate-bar clearfix" data-percent="<?php echo $perc_criteria; ?> %"> <div class="rate-bar-title"><span><?php echo $usercriteria['name']; ?> </span></div> <div class="rate-bar-bar r_score_<?php echo round($usercriteria['average']); ?> "></div> <div class="rate-bar-percent"><?php echo $usercriteria['average']; ?> </div> </div> <?php } ?> </div> </div> </div> <?php } else { ?> <?php if ($firstcriteria) { ?> <div class="review-criteria"> <?php foreach ($thecriteria as $criteria) { ?> <?php $perc_criteria = $criteria['review_post_score'] * 10; ?> <div class="rate-bar clearfix" data-percent="<?php echo $perc_criteria; ?> %"> <div class="rate-bar-title"><span><?php echo $criteria['review_post_name']; ?> </span></div> <div class="rate-bar-bar r_score_<?php echo round($criteria['review_post_score']); ?> "></div> <div class="rate-bar-percent"><?php echo $criteria['review_post_score']; ?> </div> </div> <?php } ?> </div> <?php } ?> <?php } ?> <?php if (rehub_option('type_user_review') == 'simple') { ?> <?php if ($overal_score != '0') { ?> <div class="rating_bar"><?php echo rehub_get_user_rate(); ?> </div> <?php } else { ?> <div class="rating_bar no_rev"><?php echo rehub_get_user_rate(); ?> </div> <?php } ?> <?php } elseif (rehub_option('type_user_review') == 'full_review') { ?> <a href="#respond" class="rehub_scroll add_user_review_link"><?php _e("Add your review", "rehub_framework"); ?> </a> <?php $comments_count = wp_count_comments(get_the_ID()); if ($comments_count->total_comments != '') { ?> <span class="add_user_review_link"> | </span><a href="#comments" class="rehub_scroll add_user_review_link"><?php _e("Read reviews and comments", "rehub_framework"); ?> </a><?php } ?> <?php } ?> </div> <?php }