/** * Returns object with all needed multi rating properties for post or page. * * @global object $post post data * @global GDStarRating $gdsr main rating class instance * @param int $multi_set_id id of the multi rating set * @param int $post_id post to get rating for, leave 0 to get post from loop * @return object rating post properties */ function wp_gdsr_rating_multi($multi_set_id = 0, $post_id = 0) { if ($post_id == 0) { global $post; $post_id = $post->ID; } $multi_set_id = $multi_set_id == 0 ? gdsr_get_multi_set($post_id) : $multi_set_id; $multis_data = GDSRDBMulti::get_multi_rating_data($multi_set_id, $post_id); if (count($multis_data) == 0) { return null; } return new GDSRArticleMultiRating($multis_data, $multi_set_id); }
/** * Renders the multi review result * * @param string $settings rendering parameters * @param bool $echo echo results or return it as a string * @return string html with rendered contents */ function gdsr_render_multi_review($settings = array(), $echo = true) { global $gdsr; $defaults = array("multi_id" => 0, "post_id" => 0, "tpl" => 0, "factor" => 1, "id" => 0, "element_stars" => "oxygen", "element_stars_ie6" => "oxygen_gif", "element_size" => 20, "average_stars" => "oxygen", "average_stars_ie6" => "oxygen_gif", "average_size" => 20); $settings = wp_parse_args($settings, $defaults); $settings = apply_filters('gdsr_fn_render_multi_review', $settings); if ($settings["post_id"] == 0) { global $post; $settings["post_id"] = $post->ID; } $settings["id"] = $settings["multi_id"] == 0 ? gdsr_get_multi_set($settings["post_id"]) : $settings["multi_id"]; if ($echo) { echo $gdsr->shortcode_starreviewmulti($settings); } else { return $gdsr->shortcode_starreviewmulti($settings); } }
/** * Renders single rating stars image with average rating for the multi rating review. * * @param int $set_id id of the multi rating set * @param int $post_id id of the post rating will be attributed to * @param bool $echo echo results or return it as a string * @return string html with rendered contents */ function wp_gdsr_multi_review_average($multi_set_id = 0, $post_id = 0, $echo = true) { global $gdsr, $post; if ($post_id == 0) { $post_id = $post->ID; } $multi_set_id = $multi_set_id == 0 ? gdsr_get_multi_set($post_id) : $multi_set_id; $review = $gdsr->get_multi_average_rendered($post_id, array("id" => $multi_set_id, "render" => "review")); if ($echo) { echo $review; } else { return $review; } }