Exemplo n.º 1
0
 function render_article_rss()
 {
     global $post;
     $rd_post_id = intval($post->ID);
     $post_data = GDSRDatabase::get_post_data($rd_post_id);
     $template_id = $this->g->o["default_ssb_template"];
     $votes = $score = 0;
     $stars = 10;
     if ($this->g->o["rss_datasource"] == "thumbs") {
         if ($rules_articles == "A" || $rules_articles == "N") {
             $votes = $post_data->user_recc_plus + $post_data->user_recc_minus + $post_data->visitor_recc_plus + $post_data->visitor_recc_minus;
             $score = $post_data->user_recc_plus - $post_data->user_recc_minus + $post_data->visitor_recc_plus - $post_data->visitor_recc_minus;
         } else {
             if ($rules_articles == "V") {
                 $votes = $post_data->visitor_recc_plus + $post_data->visitor_recc_minus;
                 $score = $post_data->visitor_recc_plus - $post_data->visitor_recc_minus;
             } else {
                 $votes = $post_data->user_recc_plus + $post_data->user_recc_minus;
                 $score = $post_data->user_recc_plus - $post_data->user_recc_minus;
             }
         }
     } else {
         if ($this->g->o["rss_datasource"] == "standard") {
             $stars = $this->g->o["stars"];
             if ($post_data->rules_articles == "A" || $post_data->rules_articles == "N") {
                 $votes = $post_data->user_voters + $post_data->visitor_voters;
                 $score = $post_data->user_votes + $post_data->visitor_votes;
             } else {
                 if ($post_data->rules_articles == "V") {
                     $votes = $post_data->visitor_voters;
                     $score = $post_data->visitor_votes;
                 } else {
                     $votes = $post_data->user_voters;
                     $score = $post_data->user_votes;
                 }
             }
         } else {
             $data = gdsrBlgDB::get_rss_multi_data($post_id);
             if (count($row) > 0) {
                 $set = wp_gdget_multi_set($data->multi_id);
                 $stars = $set->stars;
                 if ($post_data->rules_articles == "A" || $post_data->rules_articles == "N") {
                     $sum = $data->average_rating_users * $data->total_votes_users + $data->average_rating_visitors * $data->total_votes_visitors;
                     $votes = $data->total_votes_visitors + $data->total_votes_users;
                     $score = number_format($votes == 0 ? 0 : $sum / $votes, 1);
                 } else {
                     if ($post_data->rules_articles == "V") {
                         $votes = $data->total_votes_visitors;
                         $score = $data->average_rating_visitors;
                     } else {
                         $votes = $data->total_votes_users;
                         $score = $data->average_rating_users;
                     }
                 }
             }
         }
     }
     $rating_block = GDSRRenderT2::render_ssb($template_id, array("post_id" => $rd_post_id, "votes" => $votes, "score" => $score, "unit_count" => $stars, "header_text" => $this->g->o["rss_header_text"], "type" => $this->g->o["rss_datasource"]));
     return $rating_block;
 }
Exemplo n.º 2
0
 function render_article_rss()
 {
     global $post;
     $rd_post_id = intval($post->ID);
     $post_data = GDSRDatabase::get_post_data($rd_post_id);
     $votes = 0;
     $score = 0;
     if ($post_data->rules_articles == "A" || $post_data->rules_articles == "N") {
         $votes = $post_data->user_voters + $post_data->visitor_voters;
         $score = $post_data->user_votes + $post_data->visitor_votes;
     } else {
         if ($post_data->rules_articles == "V") {
             $votes = $post_data->visitor_voters;
             $score = $post_data->visitor_votes;
         } else {
             $votes = $post_data->user_voters;
             $score = $post_data->user_votes;
         }
     }
     $template_id = $this->o["default_ssb_template"];
     $rating_block = GDSRRenderT2::render_ssb($template_id, $rd_post_id, $votes, $score, $this->o["rss_style"], $this->o["rss_size"], $this->o["stars"], $this->o["rss_header_text"]);
     return $rating_block;
 }