Exemple #1
0
/**
 * Returns calculated data for average blog rating including bayesian estimate mean.
 *
 * @global class $gdsr
 * @param string $select articles to select postpage|post|page
 * @param string $show votes to use: total|users|visitors
 * @return object with average blog rating values
 */
function wp_gdsr_blog_rating($select = "postpage", $show = "total")
{
    $widget = array("select" => $select, "show" => $show);
    return GDSRRenderT2::prepare_wbr($widget);
}
Exemple #2
0
 function render_wbr($widget)
 {
     $widget = apply_filters('gdsr_widget_parameters_wbr', $widget);
     $template = GDSRRenderT2::get_template($widget['template_id'], 'WBR');
     $tpl_render = $template->elm['normal'];
     $tpl_render = html_entity_decode($tpl_render);
     $tpl_render = apply_filters('gdsr_t2render_wbr', $tpl_render, $template, $widget, 'normal');
     $data = GDSRRenderT2::prepare_wbr($widget);
     if ($widget['source'] == 'thumbs' && $data->rating > 0) {
         $data->rating = '+' . $data->rating;
     }
     if ($widget['source'] == 'thumbs') {
         $data->voters = $data->votes;
     }
     if ($data->percentage == 0) {
         $data->percentage = gdsr_zero_percentage();
     }
     $rt = str_replace('%PERCENTAGE%', $data->percentage, $tpl_render);
     $rt = str_replace('%RATING%', $data->rating, $rt);
     $rt = str_replace('%MAX_RATING%', $data->max_rating, $rt);
     $rt = str_replace('%VOTES%', $data->voters, $rt);
     $rt = str_replace('%COUNT%', $data->count, $rt);
     $rt = str_replace('%BAYES_RATING%', $data->bayes_rating, $rt);
     $word_votes = $template->dep['EWV'];
     $tense = $data->voters == 1 ? $word_votes->elm['singular'] : $word_votes->elm['plural'];
     $rt = str_replace('%WORD_VOTES%', __($tense), $rt);
     return $rt;
 }
Exemple #3
0
 function render_wbr($widget)
 {
     $widget = apply_filters('gdsr_widget_parameters_wbr', $widget);
     $template = GDSRRenderT2::get_template($widget["template_id"], "WBR");
     $tpl_render = $template->elm["normal"];
     $tpl_render = html_entity_decode($tpl_render);
     $tpl_render = apply_filters('gdsr_t2render_wbr', $tpl_render, $template, $widget, "normal");
     $data = GDSRRenderT2::prepare_wbr($widget);
     if ($widget["source"] == "thumbs" && $data->rating > 0) {
         $data->rating = "+" . $data->rating;
     }
     if ($widget["source"] == "thumbs") {
         $data->voters = $data->votes;
     }
     if ($data->percentage == 0) {
         $data->percentage = gdsr_zero_percentage();
     }
     $rt = str_replace('%PERCENTAGE%', $data->percentage, $tpl_render);
     $rt = str_replace('%RATING%', $data->rating, $rt);
     $rt = str_replace('%MAX_RATING%', $data->max_rating, $rt);
     $rt = str_replace('%VOTES%', $data->voters, $rt);
     $rt = str_replace('%COUNT%', $data->count, $rt);
     $rt = str_replace('%BAYES_RATING%', $data->bayes_rating, $rt);
     $word_votes = $template->dep["EWV"];
     $tense = $data->voters == 1 ? $word_votes->elm["singular"] : $word_votes->elm["plural"];
     $rt = str_replace('%WORD_VOTES%', __($tense), $rt);
     return $rt;
 }
 function render_wbr($widget)
 {
     $template = GDSRRenderT2::get_template($widget["template_id"], "WBR");
     $tpl_render = $template->elm["normal"];
     $tpl_render = html_entity_decode($tpl_render);
     $data = GDSRRenderT2::prepare_wbr($widget);
     $rt = str_replace('%PERCENTAGE%', $data->percentage, $tpl_render);
     $rt = str_replace('%RATING%', $data->rating, $rt);
     $rt = str_replace('%MAX_RATING%', $data->max_rating, $rt);
     $rt = str_replace('%VOTES%', $data->voters, $rt);
     $rt = str_replace('%COUNT%', $data->count, $rt);
     $rt = str_replace('%BAYES_RATING%', $data->bayes_rating, $rt);
     $word_votes = $template->dep["EWV"];
     $tense = $data->voters == 1 ? $word_votes->elm["singular"] : $word_votes->elm["plural"];
     $rt = str_replace('%WORD_VOTES%', __($tense), $rt);
     return $rt;
 }