Exemplo n.º 1
0
 function render_stars_custom_value($settings = array())
 {
     $style = $this->g->is_ie6 ? $settings["style_ie6"] : $settings["style"];
     $value = isset($settings["vote"]) ? floatval($settings["vote"]) : 0;
     $star_factor = $settings["star_factor"];
     $stars = $settings["max_value"];
     $size = $settings["size"];
     return GDSRRender::render_static_stars($style, $size, $stars, $value, "", "", $star_factor);
 }
Exemplo n.º 2
0
 function rating_stars($style, $unit_width, $rater_id, $class, $rating_width, $allow_vote, $unit_count, $type, $id, $user_id, $loader_id, $rater_length, $typecls, $wait_msg = '', $template_id = 0)
 {
     $rater = '<div id="' . $rater_id . '" class="' . $class . '"><div class="starsbar">';
     $rater .= '<div class="gdouter" align="left"><div id="gdr_vote_' . $type . $id . '" style="width: ' . $rating_width . 'px;" class="gdinner"></div>';
     if ($allow_vote) {
         $rater .= '<div id="gdr_stars_' . $type . $id . '" class="gdsr_rating_as">';
         for ($ic = 0; $ic < $unit_count; $ic++) {
             $ncount = $unit_count - $ic;
             $url = $_SERVER['REQUEST_URI'];
             $url_pos = strpos($url, "?");
             if ($url_pos === false) {
                 $first_char = '?';
             } else {
                 $first_char = '&amp;';
             }
             $ajax_id = sprintf("gdsrX%sX%sX%sX%sX%sX%sX%s", $id, $ncount, $user_id, $type, $rater_id, $loader_id, $template_id);
             $rater .= '<a id="' . $ajax_id . '" title="' . $ncount . ' / ' . $unit_count . '" class="s' . $ncount . '" rel="nofollow"></a>';
         }
         $rater .= '</div>';
     }
     $rater .= '</div></div></div>';
     if ($allow_vote) {
         $rater .= GDSRRender::rating_wait($loader_id, $rater_length . "px", $typecls, $wait_msg);
     }
     return $rater;
 }
Exemplo n.º 3
0
 /**
  * Renders single rating stars image with average rating for the multi rating post results from rating or review.
  *
  * @param int $post_id id of the post rating will be attributed to
  * @param bool $review if set to true average of review will be rendered
  * @param array $settings override settings for rendering the block
  */
 function get_multi_average_rendered($post_id, $settings = array())
 {
     $sum = $votes = $rating = 0;
     if ($settings["id"] == "") {
         $multi_id = $this->o["mur_review_set"];
     } else {
         $multi_id = $settings["id"];
     }
     if ($multi_id > 0 && $post_id > 0) {
         $set = gd_get_multi_set($multi_id);
         $data = GDSRDBMulti::get_averages($post_id, $multi_id);
         if ($set != null && is_object($data)) {
             if ($settings["render"] == "review") {
                 $review = GDSRRender::render_static_stars($this->is_ie6 ? $this->o["mur_style_ie6"] : $this->o["mur_style"], $this->o['mur_size'], $set->stars, $data->average_review);
                 return $review;
             } else {
                 switch ($settings["show"]) {
                     case "visitors":
                         $rating = $data->average_rating_visitors;
                         break;
                     case "users":
                         $rating = $data->average_rating_users;
                         break;
                     case "total":
                         $sum = $data->average_rating_users * $data->total_votes_users + $data->average_rating_visitors * $data->total_votes_visitors;
                         $votes = $data->total_votes_users + $data->total_votes_visitors;
                         $rating = number_format($votes == 0 ? 0 : $sum / $votes, 1);
                         break;
                 }
                 $rating = GDSRRender::render_static_stars($this->is_ie6 ? $this->o["mur_style_ie6"] : $this->o["mur_style"], $this->o['mur_size'], $set->stars, $rating);
                 return $rating;
             }
         }
     }
     $max = is_null($set) ? 10 : $set->stars;
     $rating = GDSRRender::render_static_stars($this->is_ie6 ? $this->o["mur_style_ie6"] : $this->o["mur_style"], $this->o['mur_size'], $max, 0);
     return $rating;
 }
Exemplo n.º 4
0
 function render_car($template_id, $rpar = array())
 {
     $rdef = array("votes" => 0, "rating" => 0, "comments" => 0, "star_style" => "oxygen", "star_size" => 20, "star_max" => 10);
     $rpar = wp_parse_args($rpar, $rdef);
     $rpar = apply_filters('gdsr_t2parameters_car', $rpar);
     extract($rpar, EXTR_SKIP);
     $template = GDSRRenderT2::get_template($template_id, "CAR");
     $tpl_render = $template->elm["normal"];
     $tpl_render = html_entity_decode($tpl_render);
     $tpl_render = apply_filters('gdsr_t2render_car_normal', $tpl_render, $template, $rpar, "normal");
     $tpl_render = str_replace("%CMM_COUNT%", apply_filters('gdsr_t2_tag_value', ${$comments}, "CAR", "%CMM_COUNT%"), $tpl_render);
     $tpl_render = str_replace("%CMM_VOTES%", apply_filters('gdsr_t2_tag_value', $votes, "CAR", "%CMM_VOTES%"), $tpl_render);
     $tpl_render = str_replace("%CMM_RATING%", apply_filters('gdsr_t2_tag_value', $rating, "CAR", "%CMM_RATING%"), $tpl_render);
     $tpl_render = str_replace("%MAX_CMM_RATING%", $star_max, $tpl_render);
     $word_votes = $template->dep["EWV"];
     $tense = $votes == 1 ? $word_votes->elm["singular"] : $word_votes->elm["plural"];
     $tpl_render = str_replace('%WORD_VOTES%', __($tense), $tpl_render);
     $rating_stars = GDSRRender::render_static_stars($star_style, $star_size, $star_max, $rating);
     $tpl_render = str_replace("%CMM_STARS%", $rating_stars, $tpl_render);
     return $tpl_render;
 }
Exemplo n.º 5
0
 function render_car($template_id, $rpar = array())
 {
     $rdef = array('votes' => 0, 'rating' => 0, 'comments' => 0, 'star_style' => 'oxygen', 'star_size' => 20, 'star_max' => 10);
     $rpar = wp_parse_args($rpar, $rdef);
     $rpar = apply_filters('gdsr_t2parameters_car', $rpar);
     extract($rpar, EXTR_SKIP);
     $template = GDSRRenderT2::get_template($template_id, 'CAR');
     $tpl_render = $template->elm['normal'];
     $tpl_render = html_entity_decode($tpl_render);
     $tpl_render = apply_filters('gdsr_t2render_car_normal', $tpl_render, $template, $rpar, 'normal');
     $tpl_render = str_replace('%CMM_COUNT%', apply_filters('gdsr_t2_tag_value', ${$comments}, 'CAR', '%CMM_COUNT%'), $tpl_render);
     $tpl_render = str_replace('%CMM_VOTES%', apply_filters('gdsr_t2_tag_value', $votes, 'CAR', '%CMM_VOTES%'), $tpl_render);
     $tpl_render = str_replace('%CMM_RATING%', apply_filters('gdsr_t2_tag_value', $rating, 'CAR', '%CMM_RATING%'), $tpl_render);
     $tpl_render = str_replace('%MAX_CMM_RATING%', $star_max, $tpl_render);
     $word_votes = $template->dep['EWV'];
     $tense = $votes == 1 ? $word_votes->elm['singular'] : $word_votes->elm['plural'];
     $tpl_render = str_replace('%WORD_VOTES%', __($tense), $tpl_render);
     $rating_stars = GDSRRender::render_static_stars($star_style, $star_size, $star_max, $rating);
     $tpl_render = str_replace('%CMM_STARS%', $rating_stars, $tpl_render);
     return $tpl_render;
 }
Exemplo n.º 6
0
 function render_static_stars($star_style, $star_size, $star_max, $rating, $id = "", $rendering = "", $star_factor = 1)
 {
     if ($rendering == "") {
         $rendering = STARRATING_STARS_GENERATOR;
     }
     switch ($rendering) {
         case "GFX":
             return GDSRRender::render_static_stars_gfx($star_style, $star_size, $star_max, $rating, $id, $star_factor);
             break;
         default:
         case "DIV":
             return GDSRRender::render_static_stars_div($star_style, $star_size, $star_max, $rating, $id, $star_factor);
             break;
     }
 }
Exemplo n.º 7
0
 function render_car($template_id, $votes, $rating, $comments, $star_style, $star_size, $star_max)
 {
     $template = GDSRRenderT2::get_template($template_id, "CAR");
     $tpl_render = $template->elm["normal"];
     $tpl_render = html_entity_decode($tpl_render);
     $tpl_render = str_replace("%CMM_COUNT%", $comments, $tpl_render);
     $tpl_render = str_replace("%CMM_VOTES%", $votes, $tpl_render);
     $tpl_render = str_replace("%MAX_CMM_RATING%", $star_max, $tpl_render);
     $tpl_render = str_replace("%CMM_RATING%", $rating, $tpl_render);
     $word_votes = $template->dep["EWV"];
     $tense = $votes == 1 ? $word_votes->elm["singular"] : $word_votes->elm["plural"];
     $tpl_render = str_replace('%WORD_VOTES%', __($tense), $tpl_render);
     $rating_stars = GDSRRender::render_static_stars($star_style, $star_size, $star_max, $rating);
     $tpl_render = str_replace("%CMM_STARS%", $rating_stars, $tpl_render);
     return $tpl_render;
 }
Exemplo n.º 8
0
function gd_get_rating_ajax($post)
{
    $rating = GDSRDatabase::get_post_data($post->ID);
    $uservoters = $rating->user_voters;
    $visitorvoters = $rating->visitor_voters;
    $votes = $uservoters + $visitorvotes;
    $uservotes = $rating->user_votes;
    $visitorvotes = $rating->visitor_votes;
    if ($votes > 0) {
        $finalrating = number_format(($visitorvotes + $uservotes) / ($visitorvoters + $uservoters), 1);
    }
    return GDSRRender::render_static_stars("magnovus", "20", "5", $finalrating, "", "", 1);
}